Skip to content

feat(hub): adding revision property to modelInfo, datasetInfo, spaceInfo #999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

axel7083
Copy link
Contributor

When getting modelInfo, datasetInfo, spaceInfo, we might need to get the details for a specific revision.

This PR adds an optional revision property to those methods

@axel7083 axel7083 requested a review from coyotte508 as a code owner October 30, 2024 12:17
Copy link
Member

@coyotte508 coyotte508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

My only change request is to use encodeURLComponent on the revision, eg if it's a branch name with a / in it

@coyotte508
Copy link
Member

Thanks!

@coyotte508 coyotte508 merged commit d623bbd into huggingface:main Oct 30, 2024
4 checks passed
coyotte508 added a commit that referenced this pull request Nov 19, 2024
## Description

We can now create a `snapshotDownload` method similator to the
`snapshot_download` of the PY lib[^1], clone to the cache (only cache
supported for now) a repository (either model, space or dataset)

[^1]:
https://huggingface.co/docs/huggingface_hub/en/guides/download#download-an-entire-repository

## Related issues/PR

With the amazing help of @coyotte508 we were able to merge the following
changes

- #1034
- #1031
- #999

Which allow this PR to provide a python compliant clone of a hugging
face repository to the cache directory.

## Testing

- [x] unit tests are covering the new feature

**Manually**

```ts
await snapshotDownload({
	repo: {
		name: 'OuteAI/OuteTTS-0.1-350M',
		type: 'model',
	},
});
```

assert using the `huggingface-cli` tool (python)
```
$: huggingface-cli scan-cache
REPO ID                             REPO TYPE SIZE ON DISK NB FILES LAST_ACCESSED     LAST_MODIFIED     REFS LOCAL PATH                                                                         
----------------------------------- --------- ------------ -------- ----------------- ----------------- ---- ---------------------------------------------------------------------------------- 
OuteAI/OuteTTS-0.1-350M             model           731.6M       14 5 minutes ago     5 minutes ago     main /home/axel7083/.cache/huggingface/hub/models--OuteAI--OuteTTS-0.1-350M
```

---------

Co-authored-by: Eliott C. <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants