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

Dockerized #99

Merged
merged 2 commits into from
Oct 2, 2024
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ cargo run --bin moshi-cli -r -- tui --host localhost
python -m moshi.client
```

### Docker Compose (CUDA only)

```bash
docker compose up
```

* Requires [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)

### WebUI

The web UI can be built from this repo via the
Expand Down
21 changes: 21 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:20

WORKDIR /app

COPY . /app

RUN npm install

RUN npm run build

# Install OpenSSL
RUN apt-get update && apt-get install -y openssl

# Generate self-signed SSL certificate
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /app/key.pem -out /app/cert.pem \
-subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"

EXPOSE 5173

CMD ["npm", "run", "dev"]
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: "3.8"
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like it's been removed and it's ignored now.

https://docs.docker.com/reference/compose-file/version-and-name/


name: moshi

services:

moshi:
build:
context: ./moshi
expose:
- 8998/tcp
restart: unless-stopped
volumes:
- hf-cache:/root/.cache/huggingface
environment:
#- HF_REPO=kyutai/moshika-pytorch-bf16
- HF_REPO=kyutai/moshiko-pytorch-bf16
deploy:
resources:
reservations:
devices:
- driver: nvidia
capabilities: [gpu]
count: all

tunnel:
image: cloudflare/cloudflared:latest
pull_policy: always
restart: unless-stopped
expose:
- 43337/tcp
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm not sure how the tunneling is supposed to work, is it on top of the gradio tunnel ? In that case I would remove the gradio flag in the other docker file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not on top of, but next to. I use this for all of my deployments. If you add a token then you can have a static URL on your own domain. I left it so people can have options and learn about cloudflare tunnels.

environment:
TUNNEL_URL: http://moshi:8998
TUNNEL_METRICS: 0.0.0.0:43337
command: tunnel --no-autoupdate
depends_on:
- moshi

volumes:
hf-cache:
24 changes: 24 additions & 0 deletions moshi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use an official Python runtime as a parent image
FROM python:3.10

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
# Assuming you have a requirements.txt file in the moshi directory
RUN pip install --no-cache-dir -r requirements.txt

# Install Moshi and gradio
RUN pip install --no-cache-dir moshi gradio

# Expose the port used by the server
EXPOSE 8998

# Set environment variable for the model (with a default value)
ENV HF_REPO=kyutai/moshiko-pytorch-bf16

# Run the server when the container launches
CMD python -m moshi.server --gradio-tunnel --hf-repo $HF_REPO
Loading