Skip to content

Commit 1b897b5

Browse files
authored
Merge branch 'main' into patch-1
2 parents d95fafb + 0416cec commit 1b897b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1062
-207
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- "README.md"
1212
- "packages/hub/README.md"
1313
- "packages/inference/README.md"
14-
- "packages/agents/README.md"
14+
- "packages/tiny-agents/README.md"
1515
- ".github/workflows/documentation.yml"
1616

1717
jobs:

.github/workflows/pr-documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- "packages/hub/README.md"
99
- "packages/doc-internal/**"
1010
- "packages/inference/README.md"
11-
- "packages/agents/README.md"
11+
- "packages/tiny-agents/README.md"
1212

1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ You can run our packages with vanilla JS, without any bundler, by using a CDN or
9797

9898
```html
9999
<script type="module">
100-
import { InferenceClient } from 'https://cdn.jsdelivr.net/npm/@huggingface/inference@3.15.0/+esm';
101-
import { createRepo, commit, deleteRepo, listFiles } from "https://cdn.jsdelivr.net/npm/@huggingface/hub@2.1.0/+esm";
100+
import { InferenceClient } from 'https://cdn.jsdelivr.net/npm/@huggingface/inference@4.0.0/+esm';
101+
import { createRepo, commit, deleteRepo, listFiles } from "https://cdn.jsdelivr.net/npm/@huggingface/hub@2.2.0/+esm";
102102
</script>
103103
```
104104

docs/_toctree.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
isExpanded: true
1919
sections:
2020
- local: mcp-client/README
21-
title: Simple MCP Client and smol Agent built on top of Inference Client
22-
- title: "@huggingface/agent"
21+
title: Simple MCP Client built on top of Inference Client
22+
- title: "@huggingface/tiny-agents"
2323
isExpanded: true
2424
sections:
25-
- local: agents/README
26-
title: Use Agents to run multi-modal workflows from a natural language API
27-
- local: agents/modules
28-
title: API Reference
25+
- local: tiny-agents/README
26+
title: A lightweight MCP-powered Agent built on top of Inference Client
2927
- title: "@huggingface/space-header"
3028
isExpanded: true
3129
sections:

packages/doc-internal/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"description": "Package to generate doc for other @huggingface packages",
66
"private": true,
77
"scripts": {
8-
"start": "pnpm run fix-cdn-versions && pnpm run doc-hub && pnpm run doc-inference && pnpm run doc-agents && pnpm run doc-space-header && pnpm run doc-gguf && pnpm run doc-mcp-client && cp ../../README.md ../../docs/index.md && pnpm run update-toc && pnpm run fix-md-links && pnpm run fix-md-headinghashlinks",
8+
"start": "pnpm run fix-cdn-versions && pnpm run doc-hub && pnpm run doc-inference && pnpm run doc-space-header && pnpm run doc-gguf && pnpm run doc-mcp-client && pnpm run doc-tiny-agents && cp ../../README.md ../../docs/index.md && pnpm run update-toc && pnpm run fix-md-links && pnpm run fix-md-headinghashlinks",
99
"lint": "eslint --quiet --fix --ext .cjs,.ts .",
1010
"lint:check": "eslint --ext .cjs,.ts .",
1111
"format": "prettier --write .",
1212
"format:check": "prettier --check .",
1313
"doc-hub": "typedoc --tsconfig ../hub/tsconfig.json --githubPages false --plugin typedoc-plugin-markdown --out ../../docs/hub --hideBreadcrumbs --hideInPageTOC --sourceLinkTemplate https://github.com/huggingface/huggingface.js/blob/main/{path}#L{line} ../hub/index.ts",
1414
"doc-inference": "typedoc --tsconfig ../inference/tsconfig.json --githubPages false --plugin typedoc-plugin-markdown --out ../../docs/inference --hideBreadcrumbs --hideInPageTOC --sourceLinkTemplate https://github.com/huggingface/huggingface.js/blob/main/{path}#L{line} ../inference/src/index.ts",
15-
"doc-agents": "typedoc --tsconfig ../agents/tsconfig.json --githubPages false --plugin typedoc-plugin-markdown --out ../../docs/agents --hideBreadcrumbs --hideInPageTOC --sourceLinkTemplate https://github.com/huggingface/huggingface.js/blob/main/{path}#L{line} ../agents/src/index.ts",
1615
"doc-gguf": "mkdir -p ../../docs/gguf && cp ../../packages/gguf/README.md ../../docs/gguf/README.md",
1716
"doc-mcp-client": "mkdir -p ../../docs/mcp-client && cp ../../packages/mcp-client/README.md ../../docs/mcp-client/README.md",
17+
"doc-tiny-agents": "mkdir -p ../../docs/tiny-agents && cp ../../packages/tiny-agents/README.md ../../docs/tiny-agents/README.md",
1818
"doc-space-header": "mkdir -p ../../docs/space-header && cp ../../packages/space-header/README.md ../../docs/space-header/README.md",
1919
"update-toc": "tsx update-toc.ts",
2020
"fix-cdn-versions": "tsx fix-cdn-versions.ts",

packages/hub/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@huggingface/hub",
33
"packageManager": "[email protected]",
4-
"version": "2.1.0",
4+
"version": "2.2.0",
55
"description": "Utilities to interact with the Hugging Face hub",
66
"repository": "https://github.com/huggingface/huggingface.js.git",
77
"publishConfig": {

packages/hub/src/lib/file-download-info.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("fileDownloadInfo", () => {
55
it("should fetch LFS file info", async () => {
66
const info = await fileDownloadInfo({
77
repo: {
8-
name: "bert-base-uncased",
8+
name: "google-bert/bert-base-uncased",
99
type: "model",
1010
},
1111
path: "tf_model.h5",
@@ -19,7 +19,7 @@ describe("fileDownloadInfo", () => {
1919
it("should fetch raw LFS pointer info", async () => {
2020
const info = await fileDownloadInfo({
2121
repo: {
22-
name: "bert-base-uncased",
22+
name: "google-bert/bert-base-uncased",
2323
type: "model",
2424
},
2525
path: "tf_model.h5",
@@ -34,7 +34,7 @@ describe("fileDownloadInfo", () => {
3434
it("should fetch non-LFS file info", async () => {
3535
const info = await fileDownloadInfo({
3636
repo: {
37-
name: "bert-base-uncased",
37+
name: "google-bert/bert-base-uncased",
3838
type: "model",
3939
},
4040
path: "tokenizer_config.json",

packages/hub/src/lib/file-exists.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe("fileExists", () => {
55
it("should return true for file that exists", async () => {
66
const info = await fileExists({
77
repo: {
8-
name: "bert-base-uncased",
8+
name: "google-bert/bert-base-uncased",
99
type: "model",
1010
},
1111
path: "tf_model.h5",
@@ -18,7 +18,7 @@ describe("fileExists", () => {
1818
it("should return false for file that does not exist", async () => {
1919
const info = await fileExists({
2020
repo: {
21-
name: "bert-base-uncased",
21+
name: "google-bert/bert-base-uncased",
2222
type: "model",
2323
},
2424
path: "tf_model.h5dadazdzazd",

packages/hub/src/lib/list-files.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe("listFiles", () => {
66
it("should fetch the list of files from the repo", async () => {
77
const cursor = listFiles({
88
repo: {
9-
name: "bert-base-uncased",
9+
name: "google-bert/bert-base-uncased",
1010
type: "model",
1111
},
1212
revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7",
@@ -67,7 +67,7 @@ describe("listFiles", () => {
6767
it("should fetch the list of files from the repo, including last commit", async () => {
6868
const cursor = listFiles({
6969
repo: {
70-
name: "bert-base-uncased",
70+
name: "google-bert/bert-base-uncased",
7171
type: "model",
7272
},
7373
revision: "dd4bc8b21efa05ec961e3efc4ee5e3832a3679c7",

packages/hub/src/lib/parse-safetensors-metadata.spec.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { sum } from "../utils/sum";
55
describe("parseSafetensorsMetadata", () => {
66
it("fetch info for single-file (with the default conventional filename)", async () => {
77
const parse = await parseSafetensorsMetadata({
8-
repo: "bert-base-uncased",
8+
repo: "google-bert/bert-base-uncased",
99
computeParametersCount: true,
1010
revision: "86b5e0934494bd15c9632b12f734a8a67f723594",
1111
});
@@ -88,7 +88,7 @@ describe("parseSafetensorsMetadata", () => {
8888
assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 859_520_964);
8989
});
9090

91-
it("fetch info for sharded (with the default conventional filename) with file path", async () => {
91+
it("fetch info for sharded with file path", async () => {
9292
const parse = await parseSafetensorsMetadata({
9393
repo: "Alignment-Lab-AI/ALAI-gemma-7b",
9494
computeParametersCount: true,
@@ -110,6 +110,29 @@ describe("parseSafetensorsMetadata", () => {
110110
assert.deepStrictEqual(sum(Object.values(parse.parameterCount)), 8_537_680_896);
111111
});
112112

113+
it("fetch info for sharded, but get param count directly from metadata", async () => {
114+
const parse = await parseSafetensorsMetadata({
115+
repo: "hf-internal-testing/sharded-model-metadata-num-parameters",
116+
computeParametersCount: true,
117+
revision: "999395eb3db277f3d7a0393402b02486ca91cef8",
118+
});
119+
120+
assert(parse.sharded);
121+
assert.deepStrictEqual(parse.parameterTotal, 109_482_240);
122+
// total params = 109M
123+
});
124+
125+
it("fetch info for single-file, but get param count directly from metadata", async () => {
126+
const parse = await parseSafetensorsMetadata({
127+
repo: "hf-internal-testing/single-file-model",
128+
computeParametersCount: true,
129+
revision: "75fcd3fed0285ac7f1092897ff2aefdf24bf872e",
130+
});
131+
132+
assert(!parse.sharded);
133+
assert.deepStrictEqual(parse.parameterTotal, 109_482_240);
134+
});
135+
113136
it("should detect sharded safetensors filename", async () => {
114137
const safetensorsFilename = "model_00005-of-00072.safetensors"; // https://huggingface.co/bigscience/bloom/blob/4d8e28c67403974b0f17a4ac5992e4ba0b0dbb6f/model_00005-of-00072.safetensors
115138
const safetensorsShardFileInfo = parseSafetensorsShardFilename(safetensorsFilename);

0 commit comments

Comments
 (0)