AndrewRqy commited on
Commit
f669e5b
ยท
1 Parent(s): 555c51c

README: demo video link, loading-time note, lean/full guidance, point to apprentice field notes

Browse files
Files changed (1) hide show
  1. README.md +43 -40
README.md CHANGED
@@ -32,73 +32,76 @@ models:
32
 
33
  # The Apprentice โ€” Build Small Hackathon
34
 
35
- > A pixel-art branching fairy-tale game. You inscribe five short oracles before the journey begins; an apprentice has to make every one of them save his life across five trials in a branching graph that converges on one of five distinct endings.
36
 
37
- **Track**: Thousand Token Wood
38
- **Stack**: Gradio + Modal-hosted vLLM + Qwen2.5-14B + custom humor LoRA
39
- **Languages**: English + Simplified Chinese
40
- **Demo video**: _(to be added by submitter)_
41
- **Social post**: _(to be added by submitter)_
 
42
 
43
- ---
44
 
45
- ## What's in the box
46
 
47
- | Component | Detail |
48
- |---|---|
49
- | **Frontend** | Single-file Gradio app (~5000 lines) with a hand-authored pixel-art aesthetic โ€” Press Start 2P + VT323 fonts, NES-style sharp corners, layered animated scene composition, custom theme that suppresses every visible piece of Gradio chrome. |
50
- | **Backend** | Qwen2.5-14B-Instruct + custom humor LoRA (`AndrewRqy/oracles-wizard-14b-lora`) served via vLLM on Modal. OpenAI-compatible API; the frontend talks to it through the OpenAI SDK. |
51
- | **Tiny Titan path** | Qwen2.5-1.5B-Instruct + LoRA, also trained on the same 23k humor corpus (`AndrewRqy/oracles-wizard-1.5b-lora`). Eligible for the โ‰ค4B prize. |
52
- | **Branching narrative** | Hand-authored 15-node story graph with 5 distinct endings. Each fork at trials 2โ€“4 is picked by an LLM call seeded with the player's inscribed oracle, so the path the apprentice walks is shaped by what wisdom was inscribed. |
53
- | **6 themes ร— 2 languages** | Fantasy, Space-Cowboy, Galactic-Light, Black-Land, Mistgate, Quiet-Years โ€” each with its own sprite set, finale boss, themed obstacle scenes (finale / arena / passage / trap), localized banner + oracle artifact + apprentice role title. All authored for both English and Chinese. |
54
- | **Klein-4B sprites** | All in-game art (~105 pixel-art sprites + 4 environment backdrops per theme) was generated locally via Klein-4B on a Modal H100, then chroma-keyed offline. No FLUX, no commercial generators. |
55
 
56
  ## How to play
57
 
58
- 1. **Inscribe** โ€” pick a language, then a theme, then write five short oracles (any words, gibberish, emoji โ€” whatever you want).
59
- 2. **Send-off** โ€” the mentor seals the parchments and the apprentice leaves.
60
- 3. **Five trials** โ€” at each obstacle, the apprentice draws ONE oracle. The model takes the obstacle + the oracle and writes a 200-word resolution in one of three humor modes (wild imagination / accidental trip / last-minute revelation).
61
- 4. **Boss** โ€” trial 5 is the world's finale (the dragon for fantasy; the warlord-king for space-cowboy; etc.). Different paths through the tree lead to different bosses.
62
- 5. **Ending** โ€” one of 5 distinct endings plays, each with its own preset framing (Why the boss behaved as it did + What the apprentice carried home) and an LLM-expanded 3-paragraph epilogue.
63
- 6. **Summary** โ€” clicking through reveals the story tree with the path you took lit gold and the four endings you didn't reach blurred behind "???" for replay motivation.
64
 
65
  ## Badge claims
66
 
67
  | Badge | Why we claim it |
68
  |---|---|
69
- | **๐ŸŽฏ Well-Tuned** | Qwen2.5-14B + a hand-distilled 23k-example humor LoRA (rank 16, ~6.5 h on H100). The fine-tune visibly steers all three humor modes; the field-notes write-up below details the distillation pipeline. |
70
- | **๐ŸŽจ Off-Brand** | ~2000 lines of bespoke CSS, Press Start 2P + VT323 fonts, hand-painted pixel-art sprites, sharp-corner theme that overrides every visible Gradio token, custom story-tree visualization, custom ending banner with five-pip "endings discovered" strip. No stock Gradio chrome reaches the rendered page. |
71
- | **๐Ÿ““ Field Notes** | See `docs/FIELD_NOTES_distillation.md` โ€” a ~950-word blog post on the schema-locked Claude-Sonnet-4.5 โ†’ Qwen distillation pipeline, the three humor modes, the JSON enforcement layers, and what 98.4% reject-sampling acceptance got us. |
72
- | **โšก Tiny Titan (prize)** | Same 23k corpus also trained into a Qwen2.5-1.5B LoRA on H100 (~$5.50, ~1.5 h). Eligible for the โ‰ค4B prize. |
73
 
74
- ## Running it (locally or on Space)
75
 
76
- Three environment variables need to be set as **secrets** (HF Space Settings โ†’ Variables and secrets):
77
 
78
  ```
79
- MODAL_URL = https://<modal-workspace>--<app-name>-serve.modal.run
80
  MODAL_KEY = wk-โ€ฆ (Modal proxy auth key)
81
  MODAL_SECRET = ws-โ€ฆ (Modal proxy auth secret)
82
  ```
83
 
84
- Once those are set, the Space spins up the Gradio app and the player can immediately walk a trial. No GPU is needed on the Space side โ€” the LLM call streams in from Modal over HTTPS.
 
 
 
 
 
85
 
86
- If `MODAL_URL` is unset OR `ORACLES_FORCE_MOCK=1`, the app runs in **mock mode** โ€” every LLM call returns a hand-written placeholder, the visuals still play, but the humor is dead. Useful for offline demos.
87
 
88
- ## Repository layout
89
 
90
  ```
91
  oracles_app/
92
- โ”œโ”€โ”€ app.py main Gradio file (~5000 lines)
93
- โ”œโ”€โ”€ README.md this file (HF Space metadata + write-up)
94
- โ”œโ”€โ”€ requirements.txt gradio + openai + Pillow
95
- โ”œโ”€โ”€ .gitignore excludes dev artifacts from the Space upload
96
- โ”œโ”€โ”€ oracles/ pure-Python package (state, LLM client, story graph, themes, i18n)
97
- โ”œโ”€โ”€ prompts/ LLM prompt templates (resolution / epilogue / interludes / obstacles)
98
- โ””โ”€โ”€ assets/sprites/ ~105 chroma-keyed pixel-art PNGs
99
  ```
100
 
101
- The dev-only directories (`modal_backend/`, `scripts/`, `training/`, `tests/`, `lora-out/`, `*_raw.png`) live in this folder on local disk but are excluded from the HF Space upload by `.gitignore`.
102
 
103
  ## Credits
104
 
 
32
 
33
  # The Apprentice โ€” Build Small Hackathon
34
 
35
+ > A pixel-art branching fairy-tale. You inscribe five short oracles before the journey begins; an apprentice has to make every one of them save his life across five trials in a tree that converges on one of five distinct endings.
36
 
37
+ - **Track**: Thousand Token Wood
38
+ - **Stack**: Docker + Gradio + Modal-hosted vLLM + Qwen2.5-14B + custom humor LoRA
39
+ - **Languages**: English + ็ฎ€ไฝ“ไธญๆ–‡
40
+ - **Demo video**: https://youtu.be/Ica9BgX5ZDk
41
+ - **Social post**: _(to be added by submitter)_
42
+ - **Field notes**: [`docs/FIELD_NOTES_apprentice.md`](../docs/FIELD_NOTES_apprentice.md)
43
 
44
+ > **โฑ Note on loading time**: this Space ships ~100 pixel-art sprites + theme backdrops. HF Space's free CPU tier has slow egress bandwidth, so first paint of a fresh container can take a minute or two; subsequent page transitions are faster as the browser caches assets. The front-page dropdown lets you flip between **Lean** (small payload, fast loading, default on the Space) and **Full** (parallax banner, scene landscapes, all decorative PNGs โ€” recommended only on a fast connection or once the Space is warm).
45
 
46
+ ## What's inside
47
 
48
+ - **Frontend** โ€” Single-file Gradio app with a hand-authored pixel-art aesthetic. Press Start 2P + VT323 fonts, NES-style sharp corners, custom theme suppressing all default Gradio chrome.
49
+ - **Backend** โ€” Qwen2.5-14B + custom humor LoRA (`AndrewRqy/oracles-wizard-14b-lora`) served via vLLM on Modal. Frontend talks to it through the OpenAI SDK.
50
+ - **Tiny Titan path** โ€” Same 23k humor corpus trained into a Qwen2.5-1.5B LoRA (`AndrewRqy/oracles-wizard-1.5b-lora`). Eligible for the โ‰ค4B prize.
51
+ - **Branching narrative** โ€” Hand-authored 15-node story tree with 5 endings. Each fork at trials 2โ€“4 is decided by an LLM call seeded with one of the player's oracles, so the path the apprentice walks is shaped by what was inscribed.
52
+ - **6 themes ร— 2 languages** โ€” Fantasy, Space-Cowboy, Galactic-Light, Black-Land, Mistgate, Quiet-Years. Theme-neutral story nodes + per-theme vocabulary expansion at runtime.
53
+ - **All art generated locally** โ€” ~105 pixel-art sprites via Klein-4B on a Modal H100, chroma-keyed offline. No FLUX, no commercial generators.
 
 
54
 
55
  ## How to play
56
 
57
+ 1. **Inscribe** โ€” pick a language, theme, visual mode, and narration length. Then write five short oracles. Any words; gibberish counts, emoji counts.
58
+ 2. **Send-off** โ€” the mentor seals the parchments. The apprentice leaves.
59
+ 3. **Five trials** โ€” at each obstacle, the apprentice draws ONE oracle. The model takes the obstacle + oracle and writes a ~200-word resolution in one of three humor modes (wild imagination / accidental trip / last-minute revelation).
60
+ 4. **Boss** โ€” trial 5 is the world's finale (dragon, warlord-king, etc.). Different paths through the tree lead to different bosses.
61
+ 5. **Ending** โ€” one of 5 distinct endings plays, each with a hand-authored framing (why the boss behaved as it did + what the apprentice carried home), expanded by the LLM into a 3-paragraph epilogue.
62
+ 6. **Summary** โ€” the story tree shows the path you walked lit gold; the four endings you didn't reach blur behind "???" for replay.
63
 
64
  ## Badge claims
65
 
66
  | Badge | Why we claim it |
67
  |---|---|
68
+ | ๐ŸŽฏ **Well-Tuned** | Qwen2.5-14B + a hand-distilled 23k-example humor LoRA (rank 16, ~6.5h on H100). Visibly steers all three humor modes; details in field notes. |
69
+ | ๐ŸŽจ **Off-Brand** | ~2000 lines of bespoke CSS, Press Start 2P + VT323 fonts, hand-painted pixel-art sprites, custom story-tree visualization, custom ending banner. No stock Gradio chrome reaches the page. |
70
+ | ๐Ÿ““ **Field Notes** | [`docs/FIELD_NOTES_apprentice.md`](../docs/FIELD_NOTES_apprentice.md) โ€” a build diary covering what we designed and what broke. |
71
+ | โšก **Tiny Titan** | Same 23k corpus trained into a Qwen2.5-1.5B LoRA (~$5.50, ~1.5h on H100). Eligible for the โ‰ค4B prize. |
72
 
73
+ ## Running it
74
 
75
+ Three environment variables go in HF Space โ†’ **Settings โ†’ Variables and secrets** (or `.env.local` for local runs):
76
 
77
  ```
78
+ MODAL_URL = https://<workspace>--<app>-serve.modal.run
79
  MODAL_KEY = wk-โ€ฆ (Modal proxy auth key)
80
  MODAL_SECRET = ws-โ€ฆ (Modal proxy auth secret)
81
  ```
82
 
83
+ Locally:
84
+
85
+ ```bash
86
+ ./run.sh # lean mode, default
87
+ ./run.sh --full # all visual assets enabled (recommended on fast connections)
88
+ ```
89
 
90
+ If `MODAL_URL` is unset OR `ORACLES_FORCE_MOCK=1`, the app runs in **mock mode** โ€” the UI still works, but narrations are hand-written placeholders.
91
 
92
+ ## Repo layout
93
 
94
  ```
95
  oracles_app/
96
+ โ”œโ”€โ”€ app.py # main Gradio file
97
+ โ”œโ”€โ”€ Dockerfile # HF Space Docker SDK entry
98
+ โ”œโ”€โ”€ requirements.txt
99
+ โ”œโ”€โ”€ oracles/ # state, LLM client, story graph, themes, i18n
100
+ โ”œโ”€โ”€ prompts/ # LLM prompt templates
101
+ โ””โ”€โ”€ assets/sprites/ # ~105 chroma-keyed pixel-art PNGs
 
102
  ```
103
 
104
+ Dev-only dirs (`modal_backend/`, `scripts/`, `training/`, `tests/`, `lora-out/`) live on local disk but are `.gitignore`d from the Space upload.
105
 
106
  ## Credits
107