CoolFace
Apppublic

Mnttnt21/tokenizer-bench

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
DEPLOY.md78 linesDownload Raw Back to root
1# Deploying the bench (to show colleagues)2 3The app is a single Docker image. It reads `$PORT` (default 80), so it runs on any4container host without changes.5 6## Reality check: resources7 8- Image size: **~2.4 GB** (MeCab + PyThaiNLP corpus + Kiwi model + Sudachi dict).9- Peak RAM during a **Korean** render (Kiwi model load): **~600 MB**.10- zh pages load Jieba's "big" dictionary (~150-200 MB per PHP worker).11 12So a **512 MB** free instance (Koyeb nano, Render free) will likely **OOM on the Korean13tab** and load models slowly on a 0.1 vCPU. For a smooth demo use **≥ 1 GB RAM and ≥ 1 vCPU**.14 15## Recommended: Hugging Face Spaces (free, no credit card, 16 GB RAM)16 17The free **CPU basic** hardware is 2 vCPU / 16 GB RAM — plenty for this stack, and no card18required. The repo already carries the Space front-matter (top of `README.md`, `app_port: 7860`).19 201. Create a Hugging Face account at huggingface.co (free).212. **New → Space**: name e.g. `tokenizer-bench`, **SDK = Docker**, hardware **CPU basic (free)**,22   visibility Public (or Private — a private Space is still shareable with logged-in colleagues).233. Push this repo to the Space's git remote. From this folder:24   ```bash25   git remote add hf https://huggingface.co/spaces/<your-username>/tokenizer-bench26   git push hf main27   ```28   When git asks for a password, paste a **Hugging Face access token** (Settings → Access Tokens,29   role *write*) — not your account password.304. The Space builds the Dockerfile (~5-10 min the first time) and serves at31   `https://<your-username>-tokenizer-bench.hf.space`. Share that URL.32 33To update later: `git push hf main` again — the Space rebuilds automatically.34 35## Alternative: Google Cloud Run (needs a billing account / card)36 37Scales to zero, gives a full vCPU during requests (fast model loads), and the monthly free38allowance easily covers a demo. Needs a GCP account (`gcloud` CLI installed, card on file —39won't be charged for demo traffic).40 41```bash42gcloud run deploy tokenizer-bench \43  --source . \44  --region europe-west1 \45  --memory 1Gi --cpu 1 \46  --allow-unauthenticated \47  --timeout 12048```49 50Cloud Run builds the Dockerfile, deploys, and prints a public `https://…run.app` URL.51`--timeout 120` gives the first (cold) model load room to finish.52 53## Koyeb (simple, but mind the 512 MB free cap)54 551. Push this repo to GitHub (already at `Montiwork/tokenizer-bench`).562. koyeb.com → **Create Service → GitHub** → pick the repo (install the Koyeb GitHub app for57   a private repo, or make the repo public).583. Builder: **Dockerfile**. Port: **80** (or leave default — `$PORT` is honored).594. Instance: the free **Nano** is 512 MB / 0.1 vCPU → expect the Korean tab to be slow or to60   OOM. If you can, pick a paid **Small** (1 GB+) for the demo, then scale back down.61 62## Fly.io (free allowance, scales to zero)63 64```bash65fly launch --no-deploy        # detects the Dockerfile, writes fly.toml66fly deploy --vm-memory 1024   # 1 GB67```68 69Set `internal_port = 8080` (or any) in `fly.toml`; the app honors `$PORT`.70 71## Notes72 73- Translation glosses call Google's unofficial `gtx` endpoint from the server. On a shared74  host this may be rate-limited or blocked; the UI degrades gracefully (shows `—`). Turn the75  🇬🇧 toggle off for a dependency-free demo.76- First request per language pays a one-time model/dictionary load; the progress overlay covers77  it. Subsequent requests reuse warm PHP workers.78