Skip to content

Commit 04342ed

Browse files
authored
Merge branch 'main' into add-kimi-audio-snippet
2 parents b95e9dd + e55e687 commit 04342ed

Some content is hidden

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

56 files changed

+2782
-312
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Tiny Agents - Version and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
newversion:
7+
type: choice
8+
description: "Semantic Version Bump Type"
9+
default: patch
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
bypass_deps_check:
15+
type: boolean
16+
description: "Bypass dependency checking"
17+
default: false
18+
19+
concurrency:
20+
group: "push-to-main" # Consider changing this if tiny-agents has its own release concurrency group
21+
22+
defaults:
23+
run:
24+
working-directory: packages/tiny-agents
25+
26+
jobs:
27+
version_and_release:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
with:
32+
token: ${{ secrets.BOT_ACCESS_TOKEN }}
33+
- run: npm install -g corepack@latest && corepack enable
34+
- uses: actions/setup-node@v3
35+
with:
36+
node-version: "20"
37+
cache: "pnpm"
38+
cache-dependency-path: |
39+
packages/tiny-agents/pnpm-lock.yaml
40+
packages/doc-internal/pnpm-lock.yaml
41+
registry-url: "https://registry.npmjs.org"
42+
- run: pnpm install
43+
- run: git config --global user.name machineuser
44+
- run: git config --global user.email [email protected]
45+
- run: |
46+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
47+
BUMPED_VERSION=$(node -p "require('semver').inc('$PACKAGE_VERSION', '${{ github.event.inputs.newversion }}')")
48+
# Update package.json with the new version
49+
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '$BUMPED_VERSION'; fs.writeFileSync('./package.json', JSON.stringify(package, null, '\t') + '\n');"
50+
pnpm --filter doc-internal run fix-cdn-versions
51+
git add ../..
52+
git commit -m "🔖 @huggingface/tiny-agents $BUMPED_VERSION"
53+
git tag "tiny-agents-v$BUMPED_VERSION"
54+
55+
# Add checks for dependencies if needed, similar to hub-publish.yml
56+
- if: ${{ !github.event.inputs.bypass_deps_check }}
57+
name: "Check Deps are published before publishing this package"
58+
run: pnpm -w check-deps inference && pnpm -w check-deps tasks # Review if these specific deps apply to tiny-agents
59+
60+
- run: pnpm publish --no-git-checks .
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
- run: (git pull --rebase && git push --follow-tags) || (git pull --rebase && git push --follow-tags)
64+
# hack - reuse actions/setup-node@v3 just to set a new registry
65+
- uses: actions/setup-node@v3
66+
with:
67+
node-version: "20"
68+
registry-url: "https://npm.pkg.github.com"
69+
# Disable for now, until github supports PATs for writing github packages (https://github.com/github/roadmap/issues/558)
70+
# - run: pnpm publish --no-git-checks .
71+
# env:
72+
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
- name: "Update Doc"
74+
uses: peter-evans/repository-dispatch@v2
75+
with:
76+
event-type: doc-build
77+
token: ${{ secrets.BOT_ACCESS_TOKEN }}

README.md

Lines changed: 3 additions & 3 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/[email protected].0/+esm';
101-
import { createRepo, commit, deleteRepo, listFiles } from "https://cdn.jsdelivr.net/npm/@huggingface/hub@2.0.1/+esm";
100+
import { InferenceClient } from 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected].2/+esm';
101+
import { createRepo, commit, deleteRepo, listFiles } from "https://cdn.jsdelivr.net/npm/@huggingface/hub@2.1.0/+esm";
102102
</script>
103103
```
104104

@@ -241,8 +241,8 @@ const agent = new Agent({
241241
],
242242
});
243243

244-
245244
await agent.loadTools();
245+
246246
for await (const chunk of agent.run("What are the top 5 trending models on Hugging Face?")) {
247247
if ("choices" in chunk) {
248248
const delta = chunk.choices[0]?.delta;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"tshy": "^3.0.2",
2727
"tsup": "^6.7.0",
2828
"tsx": "^4.7.0",
29-
"typescript": "^5.4.2",
29+
"typescript": "^5.8.3",
3030
"vite": "^5.0.2",
3131
"vitest": "^0.34.6",
3232
"webdriverio": "^8.6.7"

packages/doc-internal/pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/hub/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,35 @@ for await (const fileInfo of hub.listFiles({repo})) {
9393
await hub.deleteRepo({ repo, accessToken: "hf_..." });
9494
```
9595

96+
## CLI usage
97+
98+
You can use `@huggingface/hub` in CLI mode to upload files and folders to your repo.
99+
100+
```console
101+
npx @huggingface/hub upload coyotte508/test-model .
102+
npx @huggingface/hub upload datasets/coyotte508/test-dataset .
103+
# Same thing
104+
npx @huggingface/hub upload --repo-type dataset coyotte508/test-dataset .
105+
# Upload new data with 0 history in a separate branch
106+
npx @huggingface/hub branch create coyotte508/test-model release --empty
107+
npx @huggingface/hub upload coyotte508/test-model . --revision release
108+
109+
npx @huggingface/hub --help
110+
npx @huggingface/hub upload --help
111+
```
112+
113+
You can also instal globally with `npm install -g @huggingface/hub`. Then you can do:
114+
115+
```console
116+
hfjs upload coyotte508/test-model .
117+
118+
hfjs branch create --repo-type dataset coyotte508/test-dataset release --empty
119+
hfjs upload --repo-type dataset coyotte508/test-dataset . --revision release
120+
121+
hfjs --help
122+
hfjs upload --help
123+
```
124+
96125
## OAuth Login
97126

98127
It's possible to login using OAuth (["Sign in with HF"](https://huggingface.co/docs/hub/oauth)).

0 commit comments

Comments
 (0)