Skip to content

Commit

Permalink
Also test web blob on xet file (#1231)
Browse files Browse the repository at this point in the history
Follow up #1230 cc @Wauplin 

Since the header should be present now

Co-authored-by: Lucain <lucain@huggingface.co>
  • Loading branch information
coyotte508 and Wauplin authored Feb 27, 2025
1 parent 2e596a0 commit 66253c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/hub/src/utils/WebBlob.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ describe("WebBlob", () => {
expect(await webBlob.slice(10, 22).text()).toBe("__metadata__");
});

it("should lazy load a Xet file hosted on Hugging Face", async () => {
const stableDiffusionUrl =
"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/unet/diffusion_pytorch_model.fp16.safetensors";
const url = new URL(stableDiffusionUrl);
const webBlob = await WebBlob.create(url);

expect(webBlob.size).toBe(5_135_149_760);
expect(webBlob).toBeInstanceOf(WebBlob);
expect(webBlob).toMatchObject({ url });
expect(await webBlob.slice(10, 22).text()).toBe("__metadata__");
});

it("should create a slice on the file", async () => {
const expectedText = fullText.slice(10, 20);

Expand Down

0 comments on commit 66253c7

Please sign in to comment.