mlboydaisuke commited on
Commit
0058789
Β·
verified Β·
1 Parent(s): d6d1a6f

gen-cards: regenerate Use-it block

Browse files
Files changed (1) hide show
  1. README.md +41 -0
README.md CHANGED
@@ -25,6 +25,47 @@ paradigm, running on-device on Apple Silicon.
25
  - **Runtime:** Apple Core AI (`coreai-core`), GPU
26
 
27
  <!-- gen-cards:use-it begin id=llada-8b (managed by scripts/gen-cards β€” edit cards.json / QuickStart.swift, not this block) -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <!-- gen-cards:use-it end -->
29
 
30
  ## What it looks like
 
25
  - **Runtime:** Apple Core AI (`coreai-core`), GPU
26
 
27
  <!-- gen-cards:use-it begin id=llada-8b (managed by scripts/gen-cards β€” edit cards.json / QuickStart.swift, not this block) -->
28
+ ## Use it
29
+
30
+ ▢️ **Run it (source)** β€” the [DiffuseChat runner](https://github.com/john-rocky/coreai-kit/tree/main/Examples/DiffuseChat)
31
+ (GUI + CLI, one app for every diffusion LM in the catalog):
32
+
33
+ ```bash
34
+ git clone https://github.com/john-rocky/coreai-kit
35
+ open coreai-kit/Examples/DiffuseChat/DiffuseChat.xcodeproj
36
+ # β†’ Run, then pick "LLaDA-8B (diffusion)" in the model picker
37
+
38
+ # agents / headless (macOS):
39
+ cd coreai-kit/Examples/DiffuseChat
40
+ swift run diffuse-cli --model llada-8b --prompt "What is the capital of France?"
41
+ ```
42
+
43
+ πŸ’» **Build with it** β€” complete; the glue is kit API, copy-paste runs:
44
+
45
+ ```swift
46
+ import CoreAIKit
47
+
48
+ let dlm = try await KitDiffusionLM(catalog: "llada-8b")
49
+ let reply = try await dlm.reply(to: prompt)
50
+ // reply: the denoised answer. onStep streamed the live canvas per forward
51
+ // (still-masked positions as β–‘) β€” parallel fill-in, not left-to-right
52
+ ```
53
+
54
+ The take-home is [`Examples/DiffuseChat/Sources/QuickStart.swift`](https://github.com/john-rocky/coreai-kit/blob/main/Examples/DiffuseChat/Sources/QuickStart.swift)
55
+ β€” this exact code as one typed function, no UI; the CLI is an argument shell over it, and
56
+ the GUI renders the same live canvas.
57
+ The canvas is fixed (S=256 β‰ˆ 210 generated tokens) and the whole history must fit β€” no
58
+ KV cache. `reply(messages:)` takes role/content turns and drops the oldest first.
59
+ Pass `onStep: nil` if you only want the final text.
60
+
61
+ **Integration checklist**
62
+
63
+ - SPM: `https://github.com/john-rocky/coreai-kit` β†’ product **CoreAIKit**
64
+ - Info.plist: none needed
65
+ - Entitlements: none needed
66
+ - First run downloads the model β€” 5.3 GB (Mac) β€” then it loads from the
67
+ local cache (Application Support; progress via the `downloadProgress` callback)
68
+ - Measure in Release β€” Debug is ~3Γ— slower on per-token host work
69
  <!-- gen-cards:use-it end -->
70
 
71
  ## What it looks like