Skip to content
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

Push to ghcr #2

Merged
merged 29 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9da2749
push to ghcr
gorkemgoknar Oct 30, 2023
7f82fe2
typing-extensions>=4.8.0, use legacy
gorkemgoknar Oct 30, 2023
0de2626
pr should try to build it too
gorkemgoknar Oct 30, 2023
c183844
pr should try to build it too
gorkemgoknar Oct 30, 2023
4d48b9c
pr should try to build it too
gorkemgoknar Oct 30, 2023
ed7a886
only push main builds
gorkemgoknar Oct 30, 2023
eca923e
only push main builds
gorkemgoknar Oct 30, 2023
f025f8f
only push main builds
gorkemgoknar Oct 30, 2023
0e0b077
only push main builds
gorkemgoknar Oct 30, 2023
91972c6
only push main builds
gorkemgoknar Oct 30, 2023
254bdd4
use workdir
gorkemgoknar Oct 30, 2023
9ac25f8
use workdir
gorkemgoknar Oct 30, 2023
7ff4673
use workdir
gorkemgoknar Oct 30, 2023
ca43243
use workdir
gorkemgoknar Oct 30, 2023
8cfe661
use workdir
gorkemgoknar Oct 30, 2023
80417fa
use workdir
gorkemgoknar Oct 30, 2023
b7f217f
use workdir
gorkemgoknar Oct 30, 2023
0e4ab43
use workdir
gorkemgoknar Oct 30, 2023
996ea36
fixes for comments
gorkemgoknar Oct 30, 2023
a90c1a8
fixes main build cache ref
gorkemgoknar Oct 30, 2023
8dfdbd6
add some logs
gorkemgoknar Oct 30, 2023
41384d5
use numpy 1.24.3 (works locally)
gorkemgoknar Oct 30, 2023
5e3fb8d
pr caching
gorkemgoknar Oct 30, 2023
efff6a6
pr caching
gorkemgoknar Oct 30, 2023
7b7fee2
pr number as cache, remove tags on pr
gorkemgoknar Oct 30, 2023
53e18e7
multiple cache
gorkemgoknar Oct 30, 2023
baa491c
multiple cache
gorkemgoknar Oct 30, 2023
953b404
multiple cache
gorkemgoknar Oct 30, 2023
84cc96b
NUM_THREADS env var
gorkemgoknar Oct 30, 2023
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/build-and-push-to-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and push to GHCR
on:
push:
branches: [main]
pull_request:
env:
GHCR_URL: ghcr.io/coqui-ai/xtts-streaming-server
jobs:
build-and-push-to-ghcr:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v3

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: 'Login to GitHub Container Registry'
run: |
set -xe
docker login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io

- name: Build only for PR
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile
push: false # Do not push image for PR
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }}
gorkemgoknar marked this conversation as resolved.
Show resolved Hide resolved
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }}
tags: coqui-ai/xtts-streaming-server:pr-${{ github.event.pull_request.head.sha }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove the tags: input here (since we're not pushing) and use the PR number instead of HEAD commit hash in the cache lines above, as it changes on every push, breaking the caching.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually it is getting pr.head so always first one but ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HEAD is the latest, not the first

#build-args:

- name: Build and Push image
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:server"
file: Dockerfile
push: true # Push if merged
cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest
cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest
tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }}
#build-args:

4 changes: 4 additions & 0 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
device = torch.device("cuda")

model_name = "tts_models/multilingual/multi-dataset/xtts_v1.1"
print("Downloading XTTS Model:",model_name)
ModelManager().download_model(model_name)
model_path = os.path.join(get_user_data_dir("tts"), model_name.replace("/", "--"))
print("XTTS Model downloaded")

print("Loading XTTS")
config = XttsConfig()
config.load_json(os.path.join(model_path, "config.json"))
model = Xtts.init_from_config(config)
model.load_checkpoint(config, checkpoint_dir=model_path, eval=True, use_deepspeed=True)
model.to(device)
print("XTTS Loaded.")

##### Run fastapi #####
app = FastAPI(
Expand Down
8 changes: 5 additions & 3 deletions server/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
TTS==0.18.2
TTS==0.19.1
uvicorn[standard]==0.23.2
fastapi==0.104.0
deepspeed==0.8.3
fastapi==0.95.2
deepspeed==0.10.3
pydantic==1.10.13
python-multipart==0.0.6
typing-extensions>=4.8.0
numpy==1.24.3