-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[change]: Support huggingface hub model_id for DJL Models #3753
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
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
src/sagemaker/djl_inference/model.py
Outdated
my_env["GIT_TERMINAL_PROMPT"] = "0" | ||
model_config = None | ||
with TemporaryDirectory() as tmp_dir: | ||
subprocess.check_call(["git", "clone", git_lfs_model_repo, tmp_dir], env=my_env) |
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.
will this clone the full model artifacts?
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.
No, the GIT_LFS_SKIP_SMUDGE=1 will cause git to download pointers to the large files. This is still a bit overkill since it will download all the json/txt files.
I don't see any built in utils to just download a single file from git, but another option could be
curl https://huggingface.co/<repo/model>/raw/main/config.json > config.json
I chose the git option (though likely not the optimal choice) for 2 reasons.
- This sdk already assumes that the user has git installed wherever they are running the code. curl or wget is more efficient to just get the single file, but i'm not sure whether we should assume user has that installed wherever they are running this from.
- will the default branch for all model repos be
main
? This might be a fair assumption to make, I haven't seen other names for the primary branch yet.
Thoughts?
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
914a656
to
ad9fd7a
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
ad9fd7a
to
4a3df39
Compare
Codecov Report
@@ Coverage Diff @@
## master #3753 +/- ##
==========================================
- Coverage 89.84% 89.08% -0.77%
==========================================
Files 984 231 -753
Lines 92360 22873 -69487
==========================================
- Hits 82984 20377 -62607
+ Misses 9376 2496 -6880
... and 1212 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
4a3df39
to
310ac7f
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
tests/unit/test_djl_inference.py
Outdated
) | ||
assert model.engine == DJLServingEngineEntryPointDefaults.DEEPSPEED | ||
expected_git_url = f"https://huggingface.co/{HF_MODEL_ID}/raw/main/config.json" | ||
subprocess_run.assert_any_call(["curl", expected_git_url], capture_output=True, check=True) |
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.
use urllib or urllib3
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.
updated
tests/unit/test_djl_inference.py
Outdated
) | ||
assert str(invalid_s3_data.value).startswith("DJLModel only supports loading model artifacts") | ||
subprocess_run.assert_any_call(["curl", expected_git_url], capture_output=True, check=True) |
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.
same here
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.
updated
310ac7f
to
6ad4b69
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
6ad4b69
to
f8c83ab
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
LGTM!
@claytonparnell the slow tests are failing - is this still a known issue with the tests? Looking at the logs the errors are unrelated to the changes here. If so, are we ok to merge this PR? |
Hi @claytonparnell, can we merge this PR? |
Issue #, if available:
N/A
Description of changes:
This changes adds support for deploying models via DJL using the HuggingFace Hub model_id. Users can either supply a valid model_id, or an s3 url pointing to model artifacts in order to deploy DJLModels on SageMaker.
Testing done:
Endpoint testing done for gpt-j-6b, stable-diffusion-2-base, opt-2.7b using both hf hub model id, and s3 model artifacts (both engines as well).
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
unique_name_from_base
to create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.