@infernetprotocol/cli 0.1.79 → 0.1.80
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.
- package/commands/model-temporal.js +4 -2
- package/commands/model-text.js +31 -0
- package/package.json +9 -9
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
setupRuntime,
|
|
22
22
|
verifyBundle
|
|
23
23
|
} from "@infernetprotocol/liquid-agent";
|
|
24
|
-
import { cmdTextRuntime, cmdTextTrain, isTextJob, TEXT_HELP } from "./model-text.js";
|
|
24
|
+
import { cmdTextGenerate, cmdTextRuntime, cmdTextTrain, isTextJob, TEXT_HELP } from "./model-text.js";
|
|
25
25
|
|
|
26
|
-
export const TEMPORAL_SUBCOMMANDS = new Set(["train", "evaluate", "eval", "predict", "serve", "capabilities", "runtime", "synth"]);
|
|
26
|
+
export const TEMPORAL_SUBCOMMANDS = new Set(["train", "evaluate", "eval", "predict", "serve", "capabilities", "runtime", "synth", "generate"]);
|
|
27
27
|
|
|
28
28
|
export const TEMPORAL_HELP = `${TEXT_HELP}
|
|
29
29
|
Temporal policies (workloads ${WORKLOADS.TRAIN}, ${WORKLOADS.INFER}):
|
|
@@ -306,6 +306,8 @@ export async function runTemporal(sub, args) {
|
|
|
306
306
|
return cmdServe(args);
|
|
307
307
|
case "synth":
|
|
308
308
|
return cmdSynth(args);
|
|
309
|
+
case "generate":
|
|
310
|
+
return cmdTextGenerate(args);
|
|
309
311
|
default:
|
|
310
312
|
throw new Error(`not a temporal subcommand: ${sub}`);
|
|
311
313
|
}
|
package/commands/model-text.js
CHANGED
|
@@ -17,6 +17,7 @@ import { readFile } from "node:fs/promises";
|
|
|
17
17
|
import {
|
|
18
18
|
createPeftBackend,
|
|
19
19
|
PEFT_KINDS,
|
|
20
|
+
peftGenerate,
|
|
20
21
|
peftRuntimeStatus,
|
|
21
22
|
setupPeftRuntime
|
|
22
23
|
} from "@infernetprotocol/training";
|
|
@@ -30,8 +31,38 @@ Text fine-tunes (workload infernet.text.train):
|
|
|
30
31
|
infernet model train --job <job.json> [--json]
|
|
31
32
|
LoRA-tune job.base_model on job.dataset (jsonl of
|
|
32
33
|
{title, text}); --json streams v1 events.
|
|
34
|
+
infernet model generate --adapter <dir> (--prompt "..." | --input <request.json>) [--json]
|
|
35
|
+
Answer with the base model + that LoRA adapter
|
|
36
|
+
(workload infernet.text.infer).
|
|
33
37
|
`;
|
|
34
38
|
|
|
39
|
+
export async function cmdTextGenerate(args) {
|
|
40
|
+
let request;
|
|
41
|
+
let requestPath = null;
|
|
42
|
+
if (args.has("input")) {
|
|
43
|
+
requestPath = path.resolve(args.get("input"));
|
|
44
|
+
request = JSON.parse(await readFile(requestPath, "utf8"));
|
|
45
|
+
} else {
|
|
46
|
+
const adapter = args.has("adapter") ? path.resolve(args.get("adapter")) : null;
|
|
47
|
+
const prompt = args.has("prompt") ? args.get("prompt") : null;
|
|
48
|
+
if (!adapter || !prompt) {
|
|
49
|
+
process.stderr.write("error: --adapter <dir> and --prompt <text> (or --input <request.json>) are required\n");
|
|
50
|
+
return 2;
|
|
51
|
+
}
|
|
52
|
+
request = { adapter_dir: adapter, messages: [{ role: "user", content: String(prompt) }] };
|
|
53
|
+
if (args.has("max-new-tokens")) request.max_new_tokens = Number(args.get("max-new-tokens"));
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const res = await peftGenerate({ request, requestPath });
|
|
57
|
+
process.stdout.write(args.has("json") ? `${JSON.stringify(res)}\n` : `${res.text}\n`);
|
|
58
|
+
return 0;
|
|
59
|
+
} catch (err) {
|
|
60
|
+
if (args.has("json")) process.stdout.write(`${JSON.stringify({ v: 1, type: "error", message: err.message })}\n`);
|
|
61
|
+
else process.stderr.write(`error: ${err.message}\n`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
35
66
|
export function isTextJob(job) {
|
|
36
67
|
return Boolean(job && PEFT_KINDS.includes(job.kind));
|
|
37
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infernetprotocol/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.80",
|
|
4
4
|
"description": "GPU-node CLI / daemon for the Infernet Protocol — register a GPU server with a Supabase control plane and start earning.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"ora": "^9.4.1",
|
|
33
33
|
"react": "^17.0.2",
|
|
34
34
|
"react-blessed": "^0.7.2",
|
|
35
|
-
"@infernetprotocol/auth": "0.1.
|
|
36
|
-
"@infernetprotocol/config": "0.1.
|
|
37
|
-
"@infernetprotocol/deploy-providers": "0.1.
|
|
38
|
-
"@infernetprotocol/engine": "0.1.
|
|
39
|
-
"@infernetprotocol/gpu": "0.1.
|
|
40
|
-
"@infernetprotocol/liquid-agent": "0.1.
|
|
41
|
-
"@infernetprotocol/rpc-adapter": "0.1.
|
|
42
|
-
"@infernetprotocol/training": "0.1.
|
|
35
|
+
"@infernetprotocol/auth": "0.1.80",
|
|
36
|
+
"@infernetprotocol/config": "0.1.80",
|
|
37
|
+
"@infernetprotocol/deploy-providers": "0.1.80",
|
|
38
|
+
"@infernetprotocol/engine": "0.1.80",
|
|
39
|
+
"@infernetprotocol/gpu": "0.1.80",
|
|
40
|
+
"@infernetprotocol/liquid-agent": "0.1.80",
|
|
41
|
+
"@infernetprotocol/rpc-adapter": "0.1.80",
|
|
42
|
+
"@infernetprotocol/training": "0.1.80"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|