trainfabric 0.1.48 → 0.1.50
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/dist/index.cjs +91 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7951,6 +7951,7 @@ function validateChatJsonl(text) {
|
|
|
7951
7951
|
valid: false,
|
|
7952
7952
|
format: "chat_jsonl",
|
|
7953
7953
|
rowCount: 0,
|
|
7954
|
+
lineCount: 0,
|
|
7954
7955
|
duplicateCount: 0,
|
|
7955
7956
|
tokenEstimate: 0,
|
|
7956
7957
|
schemaVersion,
|
|
@@ -7958,7 +7959,6 @@ function validateChatJsonl(text) {
|
|
|
7958
7959
|
};
|
|
7959
7960
|
}
|
|
7960
7961
|
for (const [index, line] of lines.entries()) {
|
|
7961
|
-
rowCount += 1;
|
|
7962
7962
|
let parsed;
|
|
7963
7963
|
try {
|
|
7964
7964
|
parsed = JSON.parse(line);
|
|
@@ -7979,6 +7979,7 @@ function validateChatJsonl(text) {
|
|
|
7979
7979
|
});
|
|
7980
7980
|
continue;
|
|
7981
7981
|
}
|
|
7982
|
+
rowCount += 1;
|
|
7982
7983
|
const assistantMessages = result.data.messages.filter((message) => message.role === "assistant");
|
|
7983
7984
|
if (assistantMessages.length === 0) {
|
|
7984
7985
|
warnings.push({
|
|
@@ -8027,6 +8028,7 @@ function validateChatJsonl(text) {
|
|
|
8027
8028
|
valid: isValid2,
|
|
8028
8029
|
format: "chat_jsonl",
|
|
8029
8030
|
rowCount,
|
|
8031
|
+
lineCount: lines.length,
|
|
8030
8032
|
duplicateCount,
|
|
8031
8033
|
tokenEstimate,
|
|
8032
8034
|
schemaVersion,
|
|
@@ -9362,7 +9364,7 @@ function buildComputeSpec(options) {
|
|
|
9362
9364
|
|
|
9363
9365
|
// src/index.ts
|
|
9364
9366
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
9365
|
-
var CLI_VERSION = "0.1.
|
|
9367
|
+
var CLI_VERSION = "0.1.50";
|
|
9366
9368
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
9367
9369
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
9368
9370
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9673,6 +9675,12 @@ function printQuoteSummary(bundle) {
|
|
|
9673
9675
|
console.log(` data path: ${quote.dataPath ?? "auto"}`);
|
|
9674
9676
|
console.log(` GPUs: ${gpuCount}`);
|
|
9675
9677
|
console.log(` pool: ${quote.selectedPoolId}`);
|
|
9678
|
+
if (quote.fallbackPolicy) {
|
|
9679
|
+
console.log(` fallback: ${quote.fallbackPolicy.acceptedQuoteFallbackAllowed ? "allowed" : "disabled"} for accepted quote`);
|
|
9680
|
+
if (quote.fallbackPolicy.fallbackPoolId) {
|
|
9681
|
+
console.log(` fallback candidate: ${quote.fallbackPolicy.fallbackPoolId}`);
|
|
9682
|
+
}
|
|
9683
|
+
}
|
|
9676
9684
|
console.log(` launch with: --quote ${quote.id}`);
|
|
9677
9685
|
}
|
|
9678
9686
|
console.log("");
|
|
@@ -10034,6 +10042,73 @@ async function login(config) {
|
|
|
10034
10042
|
}
|
|
10035
10043
|
var program2 = new Command();
|
|
10036
10044
|
program2.name("trainfabric").description("Trainfabric CLI for launching and monitoring GPU training jobs").version(CLI_VERSION);
|
|
10045
|
+
program2.command("runs").description("Show run command group help").addHelpText(
|
|
10046
|
+
"after",
|
|
10047
|
+
`
|
|
10048
|
+
Run commands:
|
|
10049
|
+
trainfabric runs:quote Preview Efficient, Balanced, and Power launch options
|
|
10050
|
+
trainfabric runs:create Launch a run from an accepted quote
|
|
10051
|
+
trainfabric runs:list List runs
|
|
10052
|
+
trainfabric runs:status Fetch full run detail
|
|
10053
|
+
trainfabric runs:logs Fetch run logs
|
|
10054
|
+
trainfabric runs:wait Wait for a terminal state
|
|
10055
|
+
trainfabric runs:watch Stream run events
|
|
10056
|
+
trainfabric runs:usage Show run usage and charges
|
|
10057
|
+
trainfabric runs:cancel Cancel a queued or active run
|
|
10058
|
+
trainfabric runs:terminate Terminate an active run
|
|
10059
|
+
|
|
10060
|
+
Use --help on any command for options.`
|
|
10061
|
+
).action(() => {
|
|
10062
|
+
console.log(`Run commands:
|
|
10063
|
+
trainfabric runs:quote Preview Efficient, Balanced, and Power launch options
|
|
10064
|
+
trainfabric runs:create Launch a run from an accepted quote
|
|
10065
|
+
trainfabric runs:list List runs
|
|
10066
|
+
trainfabric runs:status Fetch full run detail
|
|
10067
|
+
trainfabric runs:logs Fetch run logs
|
|
10068
|
+
trainfabric runs:wait Wait for a terminal state
|
|
10069
|
+
trainfabric runs:watch Stream run events
|
|
10070
|
+
trainfabric runs:usage Show run usage and charges
|
|
10071
|
+
trainfabric runs:cancel Cancel a queued or active run
|
|
10072
|
+
trainfabric runs:terminate Terminate an active run
|
|
10073
|
+
|
|
10074
|
+
Use --help on any command for options.`);
|
|
10075
|
+
});
|
|
10076
|
+
program2.command("datasets").description("Show dataset command group help").addHelpText(
|
|
10077
|
+
"after",
|
|
10078
|
+
`
|
|
10079
|
+
Dataset commands:
|
|
10080
|
+
trainfabric datasets:validate Validate a JSONL dataset file
|
|
10081
|
+
trainfabric datasets:upload Upload a dataset
|
|
10082
|
+
trainfabric datasets:list List datasets
|
|
10083
|
+
trainfabric datasets:get Fetch dataset detail
|
|
10084
|
+
trainfabric datasets:delete Delete a dataset
|
|
10085
|
+
|
|
10086
|
+
Use --help on any command for options.`
|
|
10087
|
+
).action(() => {
|
|
10088
|
+
console.log(`Dataset commands:
|
|
10089
|
+
trainfabric datasets:validate Validate a JSONL dataset file
|
|
10090
|
+
trainfabric datasets:upload Upload a dataset
|
|
10091
|
+
trainfabric datasets:list List datasets
|
|
10092
|
+
trainfabric datasets:get Fetch dataset detail
|
|
10093
|
+
trainfabric datasets:delete Delete a dataset
|
|
10094
|
+
|
|
10095
|
+
Use --help on any command for options.`);
|
|
10096
|
+
});
|
|
10097
|
+
program2.command("models").description("Show model command group help").addHelpText(
|
|
10098
|
+
"after",
|
|
10099
|
+
`
|
|
10100
|
+
Model commands:
|
|
10101
|
+
trainfabric models:list List ready/exported models
|
|
10102
|
+
trainfabric models:export Fetch the export package path for a model
|
|
10103
|
+
|
|
10104
|
+
Use --help on any command for options.`
|
|
10105
|
+
).action(() => {
|
|
10106
|
+
console.log(`Model commands:
|
|
10107
|
+
trainfabric models:list List ready/exported models
|
|
10108
|
+
trainfabric models:export Fetch the export package path for a model
|
|
10109
|
+
|
|
10110
|
+
Use --help on any command for options.`);
|
|
10111
|
+
});
|
|
10037
10112
|
program2.command("login").description("Paste and store a TrainFabric API key").action(async () => {
|
|
10038
10113
|
await login(loadConfig());
|
|
10039
10114
|
});
|
|
@@ -10131,10 +10206,10 @@ program2.command("datasets:validate").argument("<file>").description("Validate a
|
|
|
10131
10206
|
process.exitCode = 1;
|
|
10132
10207
|
}
|
|
10133
10208
|
});
|
|
10134
|
-
program2.command("datasets:list").option("--project <projectId>").description("List datasets").action(async (options) => {
|
|
10209
|
+
program2.command("datasets:list").option("--project <projectId>").option("--json", "print raw JSON output; this is the default").description("List datasets").action(async (options) => {
|
|
10135
10210
|
printJson(await createClient(loadConfig()).datasets.list(normalizeOptionalId(options.project, "project", "Project ID")));
|
|
10136
10211
|
});
|
|
10137
|
-
program2.command("datasets:get").argument("<datasetId>").description("Fetch dataset detail").action(async (datasetId) => {
|
|
10212
|
+
program2.command("datasets:get").argument("<datasetId>").option("--json", "print raw JSON output; this is the default").description("Fetch dataset detail").action(async (datasetId) => {
|
|
10138
10213
|
printJson(await createClient(loadConfig()).datasets.get(normalizeId(datasetId, "dataset", "Dataset ID")));
|
|
10139
10214
|
});
|
|
10140
10215
|
program2.command("datasets:delete").argument("<datasetId>").description("Delete a dataset").action(async (datasetId) => {
|
|
@@ -10173,7 +10248,7 @@ program2.command("runs:create").option("--project <projectId>").option("--datase
|
|
|
10173
10248
|
const run = await client.runs.create(runInput);
|
|
10174
10249
|
printJson(run.snapshot);
|
|
10175
10250
|
});
|
|
10176
|
-
program2.command("runtime:detect").option("--project <projectId>").option("--repo <path>").option("--git <url>").option("--branch <branch>").description("Detect a supported runtime from a local repo snapshot or git metadata").action(async (options) => {
|
|
10251
|
+
program2.command("runtime:detect").option("--project <projectId>").option("--repo <path>").option("--git <url>").option("--branch <branch>").option("--json", "print raw JSON output; this is the default").description("Detect a supported runtime from a local repo snapshot or git metadata").action(async (options) => {
|
|
10177
10252
|
const sourceOptions = buildSourceOptions(options);
|
|
10178
10253
|
if (!sourceOptions.source) {
|
|
10179
10254
|
throw new Error("Provide --repo or --git.");
|
|
@@ -10231,7 +10306,7 @@ program2.command("runs:status").argument("<runId>").description("Fetch full run
|
|
|
10231
10306
|
const detail = await createClient(loadConfig()).runs.get(normalizeId(runId, "run", "Run ID"));
|
|
10232
10307
|
printJson({ ...detail, ...detail.run });
|
|
10233
10308
|
});
|
|
10234
|
-
program2.command("runs:logs").argument("<runId>").description("Fetch run logs").action(async (runId) => {
|
|
10309
|
+
program2.command("runs:logs").argument("<runId>").option("--json", "print raw JSON output; this is the default").description("Fetch run logs").action(async (runId) => {
|
|
10235
10310
|
printJson(await createClient(loadConfig()).runs.logs(normalizeId(runId, "run", "Run ID")));
|
|
10236
10311
|
});
|
|
10237
10312
|
program2.command("runs:wait").argument("<runId>").option("--timeout <duration>", "maximum wait duration, for example 30s, 10m, or 1h").option("--poll <duration>", "poll interval, for example 1s or 500ms").option("--summary", "print a compact terminal run summary").description("Wait for a run to reach a terminal state").action(async (runId, options) => {
|
|
@@ -10245,7 +10320,7 @@ program2.command("runs:wait").argument("<runId>").option("--timeout <duration>",
|
|
|
10245
10320
|
program2.command("runs:watch").argument("<runId>").option("--json", "emit event output as JSON").option("--timeout <duration>", "maximum watch duration, for example 30s, 10m, or 1h").option("--poll <duration>", "poll interval, for example 1s or 500ms").description("Stream a run until it completes").action(async (runId, options) => {
|
|
10246
10321
|
await watchRun(normalizeId(runId, "run", "Run ID"), Boolean(options.json), parseDurationMs(options.timeout), parsePositiveMs(options.poll, 1e3));
|
|
10247
10322
|
});
|
|
10248
|
-
program2.command("runs:usage").argument("<runId>").option("--summary", "print a human-readable cost summary instead of raw JSON").description("Fetch run usage summary").action(async (runId, options) => {
|
|
10323
|
+
program2.command("runs:usage").argument("<runId>").option("--json", "print raw JSON output; this is the default unless --summary is used").option("--summary", "print a human-readable cost summary instead of raw JSON").description("Fetch run usage summary").action(async (runId, options) => {
|
|
10249
10324
|
const usage = await createClient(loadConfig()).runs.usage(normalizeId(runId, "run", "Run ID"));
|
|
10250
10325
|
if (options.summary) {
|
|
10251
10326
|
printUsageSummary(usage);
|
|
@@ -10253,7 +10328,7 @@ program2.command("runs:usage").argument("<runId>").option("--summary", "print a
|
|
|
10253
10328
|
printJson(usage);
|
|
10254
10329
|
}
|
|
10255
10330
|
});
|
|
10256
|
-
program2.command("runs:cost-breakdown").argument("<runId>").option("--summary", "print a human-readable cost summary instead of raw JSON").description("Fetch realized run cost and profitability").action(async (runId, options) => {
|
|
10331
|
+
program2.command("runs:cost-breakdown").argument("<runId>").option("--json", "print raw JSON output; this is the default unless --summary is used").option("--summary", "print a human-readable cost summary instead of raw JSON").description("Fetch realized run cost and profitability").action(async (runId, options) => {
|
|
10257
10332
|
const breakdown = await createClient(loadConfig()).runs.costBreakdown(normalizeId(runId, "run", "Run ID"));
|
|
10258
10333
|
if (options.summary) {
|
|
10259
10334
|
printUsageSummary(breakdown);
|
|
@@ -10285,7 +10360,7 @@ program2.command("cluster:capacity").description("Fetch cluster capacity view").
|
|
|
10285
10360
|
program2.command("cluster:pools").description("List inventory pools").action(async () => {
|
|
10286
10361
|
printJson(await createClient(loadConfig()).cluster.listInventoryPools());
|
|
10287
10362
|
});
|
|
10288
|
-
program2.command("models:list").description("List exported models").action(async () => {
|
|
10363
|
+
program2.command("models:list").option("--json", "print raw JSON output; this is the default").description("List exported models").action(async () => {
|
|
10289
10364
|
printJson(await createClient(loadConfig()).models.list());
|
|
10290
10365
|
});
|
|
10291
10366
|
program2.command("models:export").argument("<modelId>").description("Fetch the export package path for a model").action(async (modelId) => {
|
|
@@ -10324,7 +10399,12 @@ program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seco
|
|
|
10324
10399
|
const runId = normalizeOptionalId(options.run, "run", "Run ID");
|
|
10325
10400
|
const unit = normalizeOptionalBillingUnit(options.unit);
|
|
10326
10401
|
const client = createClient(loadConfig());
|
|
10327
|
-
|
|
10402
|
+
if (runId) {
|
|
10403
|
+
const summary = await client.billing.getRunUsage(runId);
|
|
10404
|
+
printJson(unit ? { ...summary, unit, usage: summary.usage.filter((entry) => entry.unit === unit) } : summary);
|
|
10405
|
+
return;
|
|
10406
|
+
}
|
|
10407
|
+
printJson(await client.billing.getUsage(unit));
|
|
10328
10408
|
});
|
|
10329
10409
|
program2.command("billing:invoices").description("List invoices").action(async () => {
|
|
10330
10410
|
printJson(await createClient(loadConfig()).billing.listInvoices());
|
|
@@ -10364,7 +10444,7 @@ program2.command("api-keys:create").requiredOption("--name <name>").option("--ow
|
|
|
10364
10444
|
});
|
|
10365
10445
|
printJson(apiKey);
|
|
10366
10446
|
});
|
|
10367
|
-
program2.command("api-keys:list").description("List API keys").action(async () => {
|
|
10447
|
+
program2.command("api-keys:list").option("--json", "print raw JSON output; this is the default").description("List API keys").action(async () => {
|
|
10368
10448
|
printJson(await createClient(loadConfig()).apiKeys.list());
|
|
10369
10449
|
});
|
|
10370
10450
|
program2.command("api-keys:revoke").argument("<apiKeyId>").description("Revoke an API key").action(async (apiKeyId) => {
|