laya-cli 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: laya-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Ergonomic CLI for Laya — typed decisions for humans and AI agents (predict, batch, presets, shortlist, router)
5
5
  Project-URL: Homepage, https://github.com/MIt9/laya-cli
6
6
  Project-URL: Repository, https://github.com/MIt9/laya-cli.git
@@ -158,6 +158,35 @@ laya-cli info # python/torch/cuda/mps + cache
158
158
  laya-cli evaluate --questions questions.json --labeled labeled.jsonl --label-field label --threshold 0.5
159
159
  ```
160
160
 
161
+ ### 4. Resident Daemon Mode (optional, speeds up repeated calls)
162
+
163
+ Measured: `laya.load()` 10–35s (MPS) + ~120ms × 82 candidates. For one pipeline run it's fine; for iterative tuning of `questions.json` each `predict` pays 10–35s again. `serve` keeps the model in RAM — subsequent calls skip the load and hit `127.0.0.1` (<1ms overhead).
164
+
165
+ ```bash
166
+ # Start daemon in background (one daemon per model/device/router config)
167
+ laya-cli serve --model convaiinnovations/laya --device mps
168
+ laya-cli serve --model convaiinnovations/laya --subfolder multilingual --device cpu --idle-timeout 60 # short idle for test
169
+ laya-cli serve --router --foreground --idle-timeout 0 # foreground, no auto-exit, for logs
170
+
171
+ # Check status (also shows port, pid, idle_seconds, requests_served)
172
+ laya-cli serve status
173
+ laya-cli serve status --model convaiinnovations/laya --subfolder multilingual
174
+
175
+ # Use it — predict/classify/evaluate automatically hit the daemon if live for that config
176
+ laya-cli predict "hello" --preset guard --format json # -> via daemon, no 10s load
177
+ laya-cli predict "hello" --preset guard --no-daemon --format json # force in-process, ignore daemon
178
+
179
+ # Batch also benefits (each line -> POST /predict on loopback, serialized with lock)
180
+ cat candidates.jsonl | laya-cli classify --questions q.json | laya-cli filter --where "on_topic>=0.4" --sort -on_topic
181
+
182
+ # Stop
183
+ laya-cli serve stop # stop daemon for default config
184
+ laya-cli serve stop --all # stop all daemons
185
+ curl http://127.0.0.1:<port>/status # GET /status, POST /predict, POST /shutdown also work directly
186
+ ```
187
+
188
+ **Details:** HTTP on `127.0.0.1` only (SKILL.md: "Bind to 127.0.0.1"), `POST /predict {"state":..., "questions":{...}}` → same as `agent.predict()`, `GET /status` → `{model, device, loaded_at, idle_seconds, requests_served}`, `POST /shutdown` (localhost only). One daemon = one checkpoint hash(`model|subfolder|device|router|lang`) → pid+port in `~/.cache/laya-cli/daemons/<hash>.json`, pid file removed on exit. Idle timeout 1800s default, `0` disables. If daemon not running, `predict`/`classify`/`evaluate` silently fall back to in-process load — no new step for scripts. `--no-daemon` forces fallback. Requests are serialized with a `threading.Lock` (one GPU = one forward pass).
189
+
161
190
  ---
162
191
 
163
192
  ## 🛠 Development
@@ -123,6 +123,35 @@ laya-cli info # python/torch/cuda/mps + cache
123
123
  laya-cli evaluate --questions questions.json --labeled labeled.jsonl --label-field label --threshold 0.5
124
124
  ```
125
125
 
126
+ ### 4. Resident Daemon Mode (optional, speeds up repeated calls)
127
+
128
+ Measured: `laya.load()` 10–35s (MPS) + ~120ms × 82 candidates. For one pipeline run it's fine; for iterative tuning of `questions.json` each `predict` pays 10–35s again. `serve` keeps the model in RAM — subsequent calls skip the load and hit `127.0.0.1` (<1ms overhead).
129
+
130
+ ```bash
131
+ # Start daemon in background (one daemon per model/device/router config)
132
+ laya-cli serve --model convaiinnovations/laya --device mps
133
+ laya-cli serve --model convaiinnovations/laya --subfolder multilingual --device cpu --idle-timeout 60 # short idle for test
134
+ laya-cli serve --router --foreground --idle-timeout 0 # foreground, no auto-exit, for logs
135
+
136
+ # Check status (also shows port, pid, idle_seconds, requests_served)
137
+ laya-cli serve status
138
+ laya-cli serve status --model convaiinnovations/laya --subfolder multilingual
139
+
140
+ # Use it — predict/classify/evaluate automatically hit the daemon if live for that config
141
+ laya-cli predict "hello" --preset guard --format json # -> via daemon, no 10s load
142
+ laya-cli predict "hello" --preset guard --no-daemon --format json # force in-process, ignore daemon
143
+
144
+ # Batch also benefits (each line -> POST /predict on loopback, serialized with lock)
145
+ cat candidates.jsonl | laya-cli classify --questions q.json | laya-cli filter --where "on_topic>=0.4" --sort -on_topic
146
+
147
+ # Stop
148
+ laya-cli serve stop # stop daemon for default config
149
+ laya-cli serve stop --all # stop all daemons
150
+ curl http://127.0.0.1:<port>/status # GET /status, POST /predict, POST /shutdown also work directly
151
+ ```
152
+
153
+ **Details:** HTTP on `127.0.0.1` only (SKILL.md: "Bind to 127.0.0.1"), `POST /predict {"state":..., "questions":{...}}` → same as `agent.predict()`, `GET /status` → `{model, device, loaded_at, idle_seconds, requests_served}`, `POST /shutdown` (localhost only). One daemon = one checkpoint hash(`model|subfolder|device|router|lang`) → pid+port in `~/.cache/laya-cli/daemons/<hash>.json`, pid file removed on exit. Idle timeout 1800s default, `0` disables. If daemon not running, `predict`/`classify`/`evaluate` silently fall back to in-process load — no new step for scripts. `--no-daemon` forces fallback. Requests are serialized with a `threading.Lock` (one GPU = one forward pass).
154
+
126
155
  ---
127
156
 
128
157
  ## 🛠 Development
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "laya-cli"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Ergonomic CLI for Laya — typed decisions for humans and AI agents (predict, batch, presets, shortlist, router)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,3 +1,3 @@
1
1
  """laya-cli — streaming JSONL classifier over Laya."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"