question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature request] Allow specifying `save_dir` in `snapshot_download`

See original GitHub issue

This will make it easier to load without relying on cache_dir. IMO it also matches the function name snapshot_download better. (The current functionality of snapshot_download feels more like cached_download.)

snapshot_download('bert-base-uncased', save_dir='local_dir')
AutoModel.from_pretrained('local_dir')

Currently it’s like this: https://github.com/huggingface/huggingface_hub/blob/eed85ca66fd29618870d630a067ec641e0e98085/src/huggingface_hub/snapshot_download.py#L47-L49

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
osansevierocommented, Jul 16, 2021

Hi @cccntu,

snapshot_download already returns the path to where the repo was saved, so you can do this

local_repo_path = snapshot_download('bert-base-uncased')
model = AutoModel.from_pretrained(local_repo_path)

No need of building the path yourself 😃 Let us know if this works for you

0reactions
cccntucommented, Jul 16, 2021

For context, my use case is first downloading a snapshot, then COPY to docker image at build time. So when the docker images starts, it won’t need to download the model, or even call the api, it can immediately load the local copy.

But I guess I don’t really care about the storage used by cache, copying (instead of moving) the snapshot sounds better. And copying doesn’t feel like something that should be supported. Closing the issue. Thanks for the comments! @LysandreJik @osanseviero

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request - Allow Product and Services Selection when ...
Solved: Hello, I'm currently working on syncing up our CoConstruct page with our QuickBooks transactions. CoConstruct leverages the Product ...
Read more >
How to download SNAPSHOT version from maven ...
Just add this to your ~/.m2/settings.xml: <profiles> <profile> <id>allow-snapshots</id> <activation><activeByDefault>true</activeByDefault></activation> ...
Read more >
Level Snapshot - Unreal Engine Documentation
Level Snapshots enable you to save a particular configuration of the Actors in the World Outliner of your Level and instantly restore your...
Read more >
LDView Help - GitHub Pages
After this, LDView will automatically download the latest version of the LDraw ... LDraw Dir: Allows you to specify a new location for...
Read more >
Flag a Job with a "Warning" when an Orphaned Snapshot is ...
Veeam Community discussions and solutions for: Feature Request: Flag a Job with a "Warning" when an Orphaned Snapshot is detected. of Veeam ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found