Spaces:
Running on Zero
Running on Zero
File size: 4,341 Bytes
44c946d 520334e 44c946d 520334e 5dac213 520334e 5dac213 d849d03 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | # Hugging Face Space SSH Runbook
This runbook records how to connect to the running Hugging Face Space container
for debugging.
## Space
```text
https://huggingface.co/spaces/build-small-hackathon/VoiceGate
```
SSH target:
```text
build-small-hackathon-voicegate@ssh.hf.space
```
## Local SSH Key
The local private key generated for this Space is:
```text
C:\Users\yantianlong\.ssh\codex_space_voicegate
```
The public key is:
```text
C:\Users\yantianlong\.ssh\codex_space_voicegate.pub
```
Only the `.pub` file content should be added to Hugging Face. Never upload or
share the private key file.
## Connect
From PowerShell:
```powershell
ssh -i "$env:USERPROFILE\.ssh\codex_space_voicegate" build-small-hackathon-voicegate@ssh.hf.space
```
Non-interactive smoke test:
```powershell
ssh -i "$env:USERPROFILE\.ssh\codex_space_voicegate" `
-o BatchMode=yes `
-o StrictHostKeyChecking=accept-new `
-o ConnectTimeout=20 `
build-small-hackathon-voicegate@ssh.hf.space `
"pwd && git rev-parse HEAD && ls -la"
```
Expected working directory:
```text
/home/user/app
```
## Important Runtime Caveat
SSH connects to the currently running Space container. That container may be
stale after a git push.
On 2026-06-05, SSH connected successfully, but the running container was still
at the original template commit:
```text
a94117f35a42cb17f654ae70cbe619c15345d057
```
The Space git remote had already advanced to:
```text
7acf781e730d4b84d40cf3c688a1575b11bd90aa
```
Before debugging runtime behavior through SSH, always verify the container
commit:
```bash
git rev-parse HEAD
```
If the container commit does not match the latest Space commit, use the
Hugging Face Space page to restart/rebuild/factory reboot the Space, then SSH
again and re-check.
## What SSH Is Good For
- Inspect the running app files.
- Check build/runtime environment differences.
- Run small diagnostic commands.
- Inspect installed packages and model cache paths.
- Debug ComfyUI startup logs once Phase 3 is implemented.
- Run ComfyUI in CPU mode to verify the local API can start:
```bash
cd /home/user/app
python scripts/bootstrap_comfy.py
python scripts/run_comfy.py --cpu
```
In another SSH command, check:
```bash
curl http://127.0.0.1:8188/system_stats
```
## What SSH Is Not For
Do not rely on SSH edits for persistent code changes. Files changed inside the
running container can be lost after rebuild or restart.
Persistent changes should be made locally, committed, and pushed to the Space
git repository.
SSH also does not expose the ZeroGPU CUDA device in the normal shell. On
2026-06-05, starting ComfyUI without `--cpu` through SSH failed with:
```text
RuntimeError: No CUDA GPUs are available
```
GPU-backed inference should be triggered from the Gradio app through a
`@spaces.GPU` function. SSH remains useful for CPU startup and API diagnostics.
## Runtime Findings
On 2026-06-05, `python scripts/bootstrap_comfy.py` completed successfully in
the Space container. CPU-mode ComfyUI reached `/system_stats`, but
`ComfyUI_AudioTools` required additional dependencies:
- system package `sox`
- system package `libportaudio2`
- system package `portaudio19-dev`
- Python package `sounddevice`
- Python package `easydict`
- Python package `pytorch-lightning`
These are now recorded in `packages.txt` and `requirements.txt`; a Space rebuild
is required before the system packages are available in the container.
After adding these dependencies, CPU-mode ComfyUI reached `/system_stats` and
the custom node import log showed:
```text
0.4 seconds: /home/user/app/ComfyUI/custom_nodes/ComfyUI_AudioTools
```
with no `IMPORT FAILED` entry for `ComfyUI_AudioTools`.
On 2026-06-05, the ComfyUI API smoke test passed in Dev Mode using a local MP3
uploaded to `/tmp/voicegate_test_audio.mp3`:
- `/upload/image` accepted the MP3 and returned `voicegate_test_audio.mp3`.
- A minimal `LoadAudio -> SaveAudioMP3` workflow submitted through `/prompt`
returned no `node_errors`.
- `/history/{prompt_id}` returned `status_str: success`.
- The output was reported as `audio/api_smoke_voicegate_00001.mp3`.
When uploading local binary files through SSH, avoid plain PowerShell byte
pipelines because they can corrupt binary data. Use a binary-safe method such as
base64 from Python and verify `sha256sum` on the remote file.
|