💬 Commit message: Update 2026-02-15 17:50:28, 6 files, 110 lines

📁 Files changed: 6
📝 Lines changed: 110

  • deploy.md
  • Dockerfile
  • Dockerfile.rocm
  • README.md
  • deploy.sh
  • cli.py
This commit is contained in:
Adam Ladachowski
2026-02-15 17:50:28 +01:00
parent 6fe4c11683
commit 0ce7744324
6 changed files with 89 additions and 35 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ Run the deploy script:
| Install path | `/opt/tensors/app` | | Install path | `/opt/tensors/app` |
| Venv | `/opt/tensors/venv` | | Venv | `/opt/tensors/venv` |
| Service | `tensors.service` | | Service | `tensors.service` |
| Port | 8081 | | Port | 51200 |
## API Endpoints ## API Endpoints
+2 -2
View File
@@ -44,11 +44,11 @@ done
echo "ComfyUI ready" echo "ComfyUI ready"
# Start tensors API (exposed) # Start tensors API (exposed)
exec tsr serve --host 0.0.0.0 --port 8080 exec tsr serve --host 0.0.0.0 --port 51200
EOF EOF
RUN chmod +x /workspace/start.sh RUN chmod +x /workspace/start.sh
# Only expose tensors API # Only expose tensors API
EXPOSE 8080 EXPOSE 51200
CMD ["/workspace/start.sh"] CMD ["/workspace/start.sh"]
+80 -26
View File
@@ -1,28 +1,78 @@
# Tensors + ComfyUI for AMD ROCm (local testing) # Tensors + ComfyUI for AMD ROCm (gfx1030 only - slimmed)
# tensors API exposed, ComfyUI internal only # Multi-stage build, strips unused GPU architectures
# ============================================================================
# STAGE 1: Builder - install everything
# ============================================================================
FROM saiden/sd-rocm AS builder
WORKDIR /workspace
# Install build deps
RUN apt-get update && apt-get install -y --no-install-recommends git curl && \
rm -rf /var/lib/apt/lists/*
# Install ComfyUI (skip torch - use base image's ROCm torch)
# Filter out torch ecosystem, install deps without pulling CUDA
RUN git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git && \
cd ComfyUI && \
grep -v "^torch" requirements.txt | \
grep -v "^torchvision" | \
grep -v "^torchaudio" | \
grep -v "^torchsde" | \
grep -v "^nvidia" | \
grep -v "^triton" > requirements-no-torch.txt && \
pip install --break-system-packages --no-cache-dir -r requirements-no-torch.txt && \
pip install --break-system-packages --no-cache-dir --no-deps torchsde && \
pip install --break-system-packages --no-cache-dir trampoline scipy && \
# Remove any nvidia packages that snuck in
pip uninstall -y nvidia-cublas-cu12 nvidia-cuda-runtime-cu12 nvidia-cudnn-cu12 \
nvidia-cufft-cu12 nvidia-curand-cu12 nvidia-cusolver-cu12 nvidia-cusparse-cu12 \
nvidia-nccl-cu12 nvidia-nvjitlink-cu12 nvidia-nvtx-cu12 nvidia-nvshmem-cu12 \
triton 2>/dev/null || true && \
rm -rf .git .github tests* notebooks *.md
# Install ComfyUI Manager
RUN cd /workspace/ComfyUI/custom_nodes && \
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager.git && \
cd ComfyUI-Manager && \
pip install --break-system-packages --no-cache-dir -r requirements.txt && \
rm -rf .git .github tests *.md
# Install tensors
COPY . /tmp/tensors
RUN pip install --break-system-packages --no-cache-dir /tmp/tensors'[server]' && \
rm -rf /tmp/tensors
# ============================================================================
# STAGE 2: Runtime - slim ROCm for gfx1030 only
# ============================================================================
FROM saiden/sd-rocm FROM saiden/sd-rocm
WORKDIR /workspace WORKDIR /workspace
# Install git and curl # Strip unused GPU architectures (keep only gfx1030)
RUN apt-get update && apt-get install -y --no-install-recommends git curl && \ # hipblaslt has NO gfx1030 support - remove entirely (saves 11GB)
rm -rf /var/lib/apt/lists/* # rocblas - keep only gfx1030 kernels (saves 3.5GB)
RUN rm -rf /opt/rocm*/lib/hipblaslt/library/* && \
find /opt/rocm*/lib/rocblas/library/ -type f \
! -name '*gfx1030*' \
! -name 'TensileLibrary.dat' \
! -name 'TensileLibrary_lazy_gfx1030.dat' \
-delete && \
rm -rf /opt/rocm*/share/doc /opt/rocm*/share/html
# Install ComfyUI # Install only runtime deps
RUN git clone https://github.com/comfyanonymous/ComfyUI.git && \ RUN apt-get update && apt-get install -y --no-install-recommends curl && \
cd ComfyUI && \ rm -rf /var/lib/apt/lists/* && \
pip install --break-system-packages -r requirements.txt apt-get clean
# Install ComfyUI Manager # Copy Python packages from builder
RUN cd /workspace/ComfyUI/custom_nodes && \ COPY --from=builder /usr/local/lib/python3.12/dist-packages /usr/local/lib/python3.12/dist-packages
git clone https://github.com/ltdrdata/ComfyUI-Manager.git && \ COPY --from=builder /usr/local/bin/tsr /usr/local/bin/tsr
cd ComfyUI-Manager && \
pip install --break-system-packages -r requirements.txt
# Install tensors with server dependencies # Copy ComfyUI
COPY . /tmp/tensors COPY --from=builder /workspace/ComfyUI /workspace/ComfyUI
RUN pip install --break-system-packages /tmp/tensors'[server]' && \
rm -rf /tmp/tensors
# Configure tensors # Configure tensors
RUN mkdir -p /root/.config/tensors && \ RUN mkdir -p /root/.config/tensors && \
@@ -38,13 +88,15 @@ embeddings = "/workspace/ComfyUI/models/embeddings"
url = "http://127.0.0.1:8188" url = "http://127.0.0.1:8188"
EOF EOF
# Startup script: ComfyUI internal + tensors API exposed # Startup script
RUN cat > /workspace/start.sh << 'EOF' RUN cat > /workspace/start.sh << 'EOF'
#!/bin/bash #!/bin/bash
# Start ComfyUI in background (internal only, localhost) export HSA_OVERRIDE_GFX_VERSION=10.3.0
python /workspace/ComfyUI/main.py --listen 127.0.0.1 --port 8188 &
# Wait for ComfyUI to be ready # Start ComfyUI in background (internal only)
python3 /workspace/ComfyUI/main.py --listen 127.0.0.1 --port 8188 &
# Wait for ComfyUI
echo "Waiting for ComfyUI..." echo "Waiting for ComfyUI..."
until curl -s http://127.0.0.1:8188/system_stats > /dev/null 2>&1; do until curl -s http://127.0.0.1:8188/system_stats > /dev/null 2>&1; do
sleep 1 sleep 1
@@ -52,11 +104,13 @@ done
echo "ComfyUI ready" echo "ComfyUI ready"
# Start tensors API (exposed) # Start tensors API (exposed)
exec tsr serve --host 0.0.0.0 --port 8080 exec tsr serve --host 0.0.0.0 --port 51200
EOF EOF
RUN chmod +x /workspace/start.sh RUN chmod +x /workspace/start.sh
# Only expose tensors API ENV HSA_OVERRIDE_GFX_VERSION=10.3.0
EXPOSE 8080
CMD ["/workspace/start.sh"] EXPOSE 51200
ENTRYPOINT []
CMD ["/bin/bash", "/workspace/start.sh"]
+4 -4
View File
@@ -117,7 +117,7 @@ Manage sd-server process via a REST API. Requires `pip install tensors[server]`.
tsr serve --model /path/to/model.safetensors tsr serve --model /path/to/model.safetensors
# Custom host and port # Custom host and port
tsr serve --model /path/to/model.safetensors --host 0.0.0.0 --port 8080 tsr serve --model /path/to/model.safetensors --host 0.0.0.0 --port 51200
# Check server status # Check server status
tsr status tsr status
@@ -196,7 +196,7 @@ Control a remote tsr server instead of local operations.
```bash ```bash
# Configure a remote server # Configure a remote server
tsr remote add junkpile http://junkpile:8080 tsr remote add junkpile http://junkpile:51200
# Set default remote # Set default remote
tsr remote default junkpile tsr remote default junkpile
@@ -233,8 +233,8 @@ Config file: `~/.config/tensors/config.toml`
civitai_key = "your-api-key" civitai_key = "your-api-key"
[remotes] [remotes]
junkpile = "http://junkpile:8080" junkpile = "http://junkpile:51200"
local = "http://localhost:8080" local = "http://localhost:51200"
# Optional: set default remote for all commands # Optional: set default remote for all commands
default_remote = "junkpile" default_remote = "junkpile"
+1 -1
View File
@@ -46,4 +46,4 @@ fi
echo "" echo ""
echo "==> Deploy complete!" echo "==> Deploy complete!"
echo " API: http://junkpile:8081" echo " API: http://junkpile:51200"
+1 -1
View File
@@ -401,7 +401,7 @@ def config(
@app.command() @app.command()
def serve( def serve(
host: Annotated[str, typer.Option(help="Listen address.")] = "127.0.0.1", host: Annotated[str, typer.Option(help="Listen address.")] = "127.0.0.1",
port: Annotated[int, typer.Option(help="Listen port.")] = 8080, port: Annotated[int, typer.Option(help="Listen port.")] = 51200,
log_level: Annotated[str, typer.Option(help="Log level.")] = "info", log_level: Annotated[str, typer.Option(help="Log level.")] = "info",
) -> None: ) -> None:
"""Start the tensors server (gallery and CivitAI management).""" """Start the tensors server (gallery and CivitAI management)."""