Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/python-api-latent-image-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: latent-to-image-docker-cd
on:
push:
branches:
- main
paths:
- "docker_images/latent-to-image/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install dependencies
run: |
pip install --upgrade pip
pip install awscli
- uses: huggingface/tailscale-action@v1
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Update upstream
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
DEFAULT_HOSTNAME: ${{ secrets.DEFAULT_HOSTNAME }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: |
python build_docker.py latent-to-image --out out.txt
- name: Deploy on API
run: |
# Load the tags into the env
cat out.txt >> $GITHUB_ENV
export $(xargs < out.txt)
echo ${LATENT_TO_IMAGE_CPU_TAG}
# Weird single quote escape mechanism because string interpolation does
# not work on single quote in bash
curl -H "Authorization: Bearer ${{ secrets.API_GITHUB_TOKEN }}" https://api.github.com/repos/huggingface/api-inference/actions/workflows/update_community.yaml/dispatches -d '{"ref":"main","inputs":{"framework":"LATENT_TO_IMAGE","tag": "'"${LATENT_TO_IMAGE_CPU_TAG}"'"}}'

27 changes: 27 additions & 0 deletions .github/workflows/python-api-latent-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# TODO: Merge this with allenNLP to have a single workflow for all docker images.
name: latent-to-image-docker

on:
pull_request:
paths:
- "docker_images/latent-to-image/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install dependencies
run: |
pip install --upgrade pip
pip install pytest pillow httpx
pip install -e .
- run: RUN_DOCKER_TESTS=1 pytest -sv tests/test_dockers.py::DockerImageTests::test_latent_to_image
2 changes: 1 addition & 1 deletion docker_images/latent-to-image/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
starlette
api-inference-community
api-inference-community>=0.0.37
diffusers
transformers
accelerate
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="api_inference_community",
version="0.0.36",
version="0.0.37",
description="A package with helper tools to build an API Inference docker app for Hugging Face API inference using huggingface_hub",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
4 changes: 4 additions & 0 deletions tests/test_dockers.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def test_sentence_transformers(self):
)
self.framework_invalid_test("sentence_transformers")

def test_latent_to_image(self):
# TODO add working examples.
self.framework_invalid_test("latent-to-image")

def test_adapter_transformers(self):
self.framework_docker_test(
"adapter_transformers",
Expand Down
Loading