-
Notifications
You must be signed in to change notification settings - Fork 26
[CI] Enable model revisions in GHA test #523
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
Changes from 7 commits
e8794ed
d8e6a87
492a627
148741f
ca5ba09
b0aa69c
7c9d12f
89c4f46
91f2c11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env python3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this tool required if you can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using it for the GitHub Action workflow to download models with revisions (unless they are already cached in a GHA cache blob). I recall being told and seeing it in comments, that the HuggingFace CLI is not reliable during Github action runs, though I have never put that to the test myself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth a shot? I also seem to remember that the HF CLI was downloading something weird at one point, but I don't see that lately. Maybe something got fixed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I tried using the hf download action and it failed in 3 of 10 test jobs: https://github.com/ckadner/vllm-spyre/actions/runs/18510700226/job/52750674898?pr=20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, [EDIT] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. Just reverted. All downloads went through fine: https://github.com/ckadner/vllm-spyre/actions/runs/18510991794/job/52751608834?pr=20 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more time with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could probably figure out how the space gets used, which files to exclude and/or how to make more space on the GHA runner. But we already have the download script and the code in it has been running fine for several months. So, I vote for keeping the existing custom download code, albeit in a separate script now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, often repositories have extra files such as model weights in other formats. I think the script only downloads the required files, so that would explain that it doesn't run out of disk space. I would prefer less code to maintain, but since we have these space restrictions I guess for now it's better to keep the script. |
||
"""Download a model from HuggingFace with revision. | ||
> python3 tools/download_model.py -m <HF-model-id> [-r <git-tag-or-hash>] | ||
""" | ||
|
||
import argparse | ||
import logging | ||
|
||
|
||
def download_granite_or_llama(model: str, revision: str = "main"): | ||
from transformers import pipeline | ||
pipeline('text-generation', model=model, revision=revision) | ||
|
||
|
||
def download_roberta(model: str, revision: str = "main"): | ||
from sentence_transformers import SentenceTransformer | ||
SentenceTransformer(model, revision=revision) | ||
|
||
|
||
download_methods = { | ||
"ibm-ai-platform/micro-g3.3-8b-instruct-1b": download_granite_or_llama, | ||
"ibm-ai-platform/micro-g3.3-8b-instruct-1b-FP8": download_granite_or_llama, | ||
"JackFram/llama-160m": download_granite_or_llama, | ||
"cross-encoder/stsb-roberta-large": download_roberta, | ||
"sentence-transformers/all-roberta-large-v1": download_roberta, | ||
} | ||
|
||
|
||
def download_model_with_revision(model: str, revision: str = "main"): | ||
if model in download_methods: | ||
download_method = download_methods.get(model) | ||
logging.info("Downloading model '%s' with revision '%s' ...", model, | ||
revision) | ||
download_method(model, revision) | ||
logging.info("Model '%s' with revision '%s' downloaded.", model, | ||
revision) | ||
else: | ||
logging.error( | ||
"No `download_method` found for model '%s'." | ||
" Supported models: %s", model, str(list(download_methods.keys()))) | ||
exit(1) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-m", dest="model", help="HuggingFace model ID") | ||
parser.add_argument("-r", | ||
dest="revision", | ||
default="main", | ||
help="Git hash, tag, or branch (default='main')") | ||
args, _extra_args = parser.parse_known_args() | ||
|
||
if args.model: | ||
download_model_with_revision(args.model, args.revision) | ||
else: | ||
logging.error("Need to provide a HuggingFace model ID.") | ||
exit(1) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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.
A comment on how this looks like would be nice, like what was it earlier and what it looks like after replacing