-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
✨ support local cache for models #4374
✨ support local cache for models #4374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty reasonable to me. Another place we use snapshot_download
is when loading the tokenizer and other config. It would be useful to search for snapshot download
or .from_pretrained
call.
Any suggestion on how to test this?
What I can do is create another function that does For the |
Or better yet, I can do this
? |
ca4ab24
to
ef75382
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @prashantgupta24 (and to @tjohnson31415 for the original PR).
Not sure whether you tested this, but in theory the local_files_only=HF_HUB_OFFLINE
shouldn't be necessary with HF's snapshot_download
since it already honors this env var.
But it also doesn't harm I guess, and looks like it might still need to be passed like this to modelscope's snapshot_download
.
There's another instance of that in loader.py which should be similarly updated I think?
ef75382
to
a9b729b
Compare
@njhill whoops forgot that one, updated it, thanks! And yeah I added |
Will add a test case for this tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should test it? why don't we download the model -> remove instance -> restart the instance with a local file?
Yes I am planning to add that |
Co-authored-by: Travis Johnson <tjohnson31415@gmail.com> Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com>
Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com> ♻️ use HF_HUB_OFFLINE directly Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com>
Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com>
a9b729b
to
0d1a7f7
Compare
Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @prashantgupta24 and @tjohnson31415!
Is there any documentation on how to use the offline option for downloading Huggingface model? |
@saivarunk if offline mode is enabled, no networking calls are made and models are not downloaded from HF, instead vllm will try to look for that model in the local cache. |
Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com> Co-authored-by: Travis Johnson <tjohnson31415@gmail.com>
@prashantgupta24 maybe we can update this to the doc (model section) https://docs.vllm.ai/en/latest/? |
Signed-off-by: Prashant Gupta <prashantgupta@us.ibm.com> Co-authored-by: Travis Johnson <tjohnson31415@gmail.com>
Updates how files are pulled from HF Hub to support offline usage with cached files and a fallback in case of networking issues or if HF Hub is down.
(Without this change, you have to pass the explicit path to the model in your local HF cache as the model name.)
Taken bits from #3125
BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
PR Checklist (Click to Expand)
Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]
for bug fixes.[CI/Build]
for build or continuous integration improvements.[Doc]
for documentation fixes and improvements.[Model]
for adding a new model or improving an existing model. Model name should appear in the title.[Frontend]
For changes on the vLLM frontend (e.g., OpenAI API server,LLM
class, etc.)[Kernel]
for changes affecting CUDA kernels or other compute kernels.[Core]
for changes in the core vLLM logic (e.g.,LLMEngine
,AsyncLLMEngine
,Scheduler
, etc.)[Hardware][Vendor]
for hardware-specific changes. Vendor name should appear in the prefix (e.g.,[Hardware][AMD]
).[Misc]
for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
format.sh
to format your code.docs/source/
if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.Notes for Large Changes
Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with
rfc-required
and might not go through the PR.What to Expect for the Reviews
The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:
action-required
label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.Thank You
Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!