Skip to content

Commit 89473d5

Browse files
authored
Merge branch 'main' into add-video-to-video
2 parents 79b7a15 + 0e2b369 commit 89473d5

File tree

224 files changed

+2639
-645
lines changed

Some content is hidden

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

224 files changed

+2639
-645
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.13.2/+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.6/+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/cli.ts

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { parseArgs } from "node:util";
44
import { typedEntries } from "./src/utils/typedEntries";
5-
import { createBranch, createRepo, deleteBranch, repoExists, uploadFilesWithProgress } from "./src";
5+
import { createBranch, createRepo, deleteBranch, deleteRepo, repoExists, uploadFilesWithProgress } from "./src";
66
import { pathToFileURL } from "node:url";
77
import { stat } from "node:fs/promises";
88
import { basename, join } from "node:path";
@@ -78,7 +78,6 @@ const commands = {
7878
{
7979
name: "repo-type" as const,
8080
enum: ["dataset", "model", "space"],
81-
default: "model",
8281
description:
8382
"The type of repo to upload to. Defaults to model. You can also prefix the repo name with the type, e.g. datasets/username/repo-name",
8483
},
@@ -126,9 +125,8 @@ const commands = {
126125
{
127126
name: "repo-type" as const,
128127
enum: ["dataset", "model", "space"],
129-
default: "model",
130128
description:
131-
"The type of repo to create. Defaults to model. You can also prefix the repo name with the type, e.g. datasets/username/repo-name",
129+
"The type of the repo to create the branch into. Defaults to model. You can also prefix the repo name with the type, e.g. datasets/username/repo-name",
132130
},
133131
{
134132
name: "revision" as const,
@@ -173,7 +171,6 @@ const commands = {
173171
{
174172
name: "repo-type" as const,
175173
enum: ["dataset", "model", "space"],
176-
default: "model",
177174
description:
178175
"The type of repo to delete the branch from. Defaults to model. You can also prefix the repo name with the type, e.g. datasets/username/repo-name",
179176
},
@@ -187,6 +184,35 @@ const commands = {
187184
},
188185
},
189186
} satisfies CommandGroup,
187+
repo: {
188+
description: "Manage repositories on the Hub",
189+
subcommands: {
190+
delete: {
191+
description: "Delete a repository from the Hub",
192+
args: [
193+
{
194+
name: "repo-name" as const,
195+
description:
196+
"The name of the repo to delete. You can also prefix the repo name with the type, e.g. datasets/username/repo-name",
197+
positional: true,
198+
required: true,
199+
},
200+
{
201+
name: "repo-type" as const,
202+
enum: ["dataset", "model", "space"],
203+
description:
204+
"The type of the repo to delete. Defaults to model. You can also prefix the repo name with the type, e.g. datasets/username/repo-name",
205+
},
206+
{
207+
name: "token" as const,
208+
description:
209+
"The access token to use for authentication. If not provided, the HF_TOKEN environment variable will be used.",
210+
default: process.env.HF_TOKEN,
211+
},
212+
] as const,
213+
},
214+
},
215+
} satisfies CommandGroup,
190216
version: {
191217
description: "Print the version of the CLI",
192218
args: [] as const,
@@ -389,6 +415,54 @@ async function run() {
389415
}
390416
break;
391417
}
418+
case "repo": {
419+
const repoCommandGroup = commands.repo;
420+
const currentSubCommandName = subCommandName as keyof typeof repoCommandGroup.subcommands | undefined;
421+
422+
if (cliArgs[0] === "--help" || cliArgs[0] === "-h") {
423+
if (currentSubCommandName && repoCommandGroup.subcommands[currentSubCommandName]) {
424+
console.log(detailedUsageForSubcommand("repo", currentSubCommandName));
425+
} else {
426+
console.log(listSubcommands("repo", repoCommandGroup));
427+
}
428+
break;
429+
}
430+
431+
if (!currentSubCommandName || !repoCommandGroup.subcommands[currentSubCommandName]) {
432+
console.error(`Error: Missing or invalid subcommand for 'repo'.`);
433+
console.log(listSubcommands("repo", repoCommandGroup));
434+
process.exitCode = 1;
435+
break;
436+
}
437+
438+
const subCmdDef = repoCommandGroup.subcommands[currentSubCommandName];
439+
440+
switch (currentSubCommandName) {
441+
case "delete": {
442+
const parsedArgs = advParseArgs(cliArgs, subCmdDef.args, `repo ${currentSubCommandName}`);
443+
const { repoName, repoType, token } = parsedArgs;
444+
445+
const repoDesignation: Parameters<typeof deleteRepo>[0]["repo"] = repoType
446+
? { type: repoType as "model" | "dataset" | "space", name: repoName }
447+
: repoName;
448+
449+
await deleteRepo({
450+
repo: repoDesignation,
451+
accessToken: token,
452+
hubUrl: process.env.HF_ENDPOINT ?? HUB_URL,
453+
});
454+
console.log(`Repository '${repoName}' deleted successfully.`);
455+
break;
456+
}
457+
default:
458+
// This case should ideally be caught by the check above
459+
console.error(`Error: Unknown subcommand '${currentSubCommandName}' for 'repo'.`);
460+
console.log(listSubcommands("repo", repoCommandGroup));
461+
process.exitCode = 1;
462+
break;
463+
}
464+
break;
465+
}
392466
case "version": {
393467
if (cliArgs[0] === "--help" || cliArgs[0] === "-h") {
394468
console.log(detailedUsageForCommand("version"));

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",

0 commit comments

Comments
 (0)