-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: aws sagemaker compatible image #147
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
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ce09fd3
sagemaker support
OlivierDehaene 7bea9a1
change env var names
philschmid 3219927
update docker image
philschmid 930842a
hack
OlivierDehaene 00d5ade
add new target in dockerfile
OlivierDehaene a49599f
remove cache to in sagemaker build
OlivierDehaene File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,48 @@ jobs: | |
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=registry.internal.huggingface.tech/api-inference/community/text-generation-inference:cache,mode=max | ||
cache-to: type=registry,ref=registry.internal.huggingface.tech/api-inference/community/text-generation-inference:cache,mode=max | ||
cache-to: type=registry,ref=registry.internal.huggingface.tech/api-inference/community/text-generation-inference:cache,mode=max | ||
|
||
build-and-push-sagemaker-image: | ||
needs: | ||
- build-and-push-image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Initialize Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
install: true | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
- name: Login to internal Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.TAILSCALE_DOCKER_USERNAME }} | ||
password: ${{ secrets.TAILSCALE_DOCKER_PASSWORD }} | ||
registry: registry.internal.huggingface.tech | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
flavor: | | ||
latest=auto | ||
images: | | ||
registry.internal.huggingface.tech/api-inference/community/text-generation-inference/sagemaker | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | ||
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
platforms: 'linux/amd64' | ||
target: sagemaker | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=registry.internal.huggingface.tech/api-inference/community/text-generation-inference:cache,mode=max |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z "${HF_MODEL_ID}" ]]; then | ||
echo "HF_MODEL_ID must be set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -n "${HF_MODEL_REVISION}" ]]; then | ||
export REVISION="${HF_MODEL_REVISION}" | ||
fi | ||
|
||
if [[ -n "${SM_NUM_GPUS}" ]]; then | ||
export NUM_SHARD="${SM_NUM_GPUS}" | ||
fi | ||
|
||
if [[ -n "${HF_MODEL_QUANTIZE}" ]]; then | ||
export QUANTIZE="${HF_MODEL_QUANTIZE}" | ||
fi | ||
|
||
text-generation-launcher --port 8080 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could we an a
cfg
for that?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 it would complexify things for no real gains. Maybe the runtime RAM would be a bit lower but I don't think it matters too much compared to the python servers used RAM.
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 was more thinking about the future, what if add routes for X and Y. But feel free to keep it as it is :)