trainfabric 0.1.41 → 0.1.43
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 +45 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8925,6 +8925,7 @@ var idPatterns = {
|
|
|
8925
8925
|
supplier: /^[A-Za-z][A-Za-z0-9_-]*$/
|
|
8926
8926
|
};
|
|
8927
8927
|
var allowedBillingUnits = /* @__PURE__ */ new Set(["normalized_tflop_seconds", "reserved_gpu_seconds", "usd"]);
|
|
8928
|
+
var allowedApiKeyOwnerTypes = /* @__PURE__ */ new Set(["user", "service_account"]);
|
|
8928
8929
|
function collectRuntimeFiles(repoPath) {
|
|
8929
8930
|
const manifestFiles = /* @__PURE__ */ new Set([
|
|
8930
8931
|
"training.yaml",
|
|
@@ -9162,6 +9163,13 @@ function normalizeOptionalBillingUnit(value) {
|
|
|
9162
9163
|
}
|
|
9163
9164
|
return unit;
|
|
9164
9165
|
}
|
|
9166
|
+
function normalizeApiKeyOwnerType(value) {
|
|
9167
|
+
const ownerType = String(value ?? "").trim();
|
|
9168
|
+
if (!allowedApiKeyOwnerTypes.has(ownerType)) {
|
|
9169
|
+
throw new Error("Owner type is invalid. Use user or service_account.");
|
|
9170
|
+
}
|
|
9171
|
+
return ownerType;
|
|
9172
|
+
}
|
|
9165
9173
|
|
|
9166
9174
|
// src/run_input.ts
|
|
9167
9175
|
var BASE_MODEL_ALIASES = {
|
|
@@ -9283,7 +9291,7 @@ function buildComputeSpec(options) {
|
|
|
9283
9291
|
|
|
9284
9292
|
// src/index.ts
|
|
9285
9293
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
9286
|
-
var CLI_VERSION = "0.1.
|
|
9294
|
+
var CLI_VERSION = "0.1.43";
|
|
9287
9295
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
9288
9296
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
9289
9297
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9659,6 +9667,39 @@ function requireProjectId(options, config) {
|
|
|
9659
9667
|
}
|
|
9660
9668
|
return projectId;
|
|
9661
9669
|
}
|
|
9670
|
+
function optionWasProvided(command, optionName) {
|
|
9671
|
+
return command.getOptionValueSource(optionName) === "cli";
|
|
9672
|
+
}
|
|
9673
|
+
function assertQuoteCreateHasNoLaunchOverrides(options, command) {
|
|
9674
|
+
if (!options.quote) {
|
|
9675
|
+
return;
|
|
9676
|
+
}
|
|
9677
|
+
const launchShapingOptions = [
|
|
9678
|
+
["dataset", "--dataset"],
|
|
9679
|
+
["model", "--model"],
|
|
9680
|
+
["eval", "--eval"],
|
|
9681
|
+
["epochs", "--epochs"],
|
|
9682
|
+
["lr", "--lr"],
|
|
9683
|
+
["gpus", "--gpus"],
|
|
9684
|
+
["nodes", "--nodes"],
|
|
9685
|
+
["accelerator", "--accelerator"],
|
|
9686
|
+
["minMemory", "--min-memory"],
|
|
9687
|
+
["precision", "--precision"],
|
|
9688
|
+
["interconnect", "--interconnect"],
|
|
9689
|
+
["mode", "--mode"],
|
|
9690
|
+
["repo", "--repo"],
|
|
9691
|
+
["git", "--git"],
|
|
9692
|
+
["branch", "--branch"]
|
|
9693
|
+
];
|
|
9694
|
+
const provided = launchShapingOptions.filter(([name]) => optionWasProvided(command, name)).map(([, flag]) => flag);
|
|
9695
|
+
if (provided.length > 0) {
|
|
9696
|
+
throw new Error(
|
|
9697
|
+
`Do not combine --quote with launch-shaping flags (${provided.join(
|
|
9698
|
+
", "
|
|
9699
|
+
)}). The accepted quote already locks dataset, model, compute, mode, source, and hyperparameters. Request a new quote for different launch settings.`
|
|
9700
|
+
);
|
|
9701
|
+
}
|
|
9702
|
+
}
|
|
9662
9703
|
function buildRunInput(options, config = loadConfig()) {
|
|
9663
9704
|
const sourceOptions = buildSourceOptions(options);
|
|
9664
9705
|
const quoteId = options.quote === void 0 ? void 0 : normalizeId(options.quote, "quote", "Pricing quote ID");
|
|
@@ -10011,8 +10052,9 @@ program2.command("datasets:upload").argument("<file>").option("--project <projec
|
|
|
10011
10052
|
});
|
|
10012
10053
|
printJson(dataset);
|
|
10013
10054
|
});
|
|
10014
|
-
program2.command("runs:create").option("--project <projectId>").option("--dataset <datasetId>").option("--model <baseModel>").option("--eval <evalDatasetId>").option("--epochs <epochs>", "number of epochs", "3").option("--lr <lr>", "learning rate", "0.0002").option("--gpus <gpuCount>", "gpu count", "1").option("--nodes <nodeCount>", "node count", "1").option("--accelerator <acceleratorClass>", "optional hard accelerator constraint (for example: a10g, a100, h100)").option("--min-memory <gigabytes>", "minimum GPU memory in GB").option("--precision <precision>", "fp16_bf16, fp8, or fp32").option("--interconnect <interconnect>", "pcie or nvlink").option("--mode <mode>", "efficient, balanced, or power").option("--quote <pricingQuoteId>", "launch the exact accepted quote id from runs:quote").option("--repo <path>", "local repo path for runtime autodetect").option("--git <url>", "git repo URL for runtime metadata").option("--branch <branch>", "git branch for runtime metadata").option("--yes", "confirm that you reviewed pricing with runs:quote --summary and accept fluctuating realized usage").description("Create a training run").action(async (options) => {
|
|
10055
|
+
program2.command("runs:create").option("--project <projectId>").option("--dataset <datasetId>").option("--model <baseModel>").option("--eval <evalDatasetId>").option("--epochs <epochs>", "number of epochs", "3").option("--lr <lr>", "learning rate", "0.0002").option("--gpus <gpuCount>", "gpu count", "1").option("--nodes <nodeCount>", "node count", "1").option("--accelerator <acceleratorClass>", "optional hard accelerator constraint (for example: a10g, a100, h100)").option("--min-memory <gigabytes>", "minimum GPU memory in GB").option("--precision <precision>", "fp16_bf16, fp8, or fp32").option("--interconnect <interconnect>", "pcie or nvlink").option("--mode <mode>", "efficient, balanced, or power").option("--quote <pricingQuoteId>", "launch the exact accepted quote id from runs:quote").option("--repo <path>", "local repo path for runtime autodetect").option("--git <url>", "git repo URL for runtime metadata").option("--branch <branch>", "git branch for runtime metadata").option("--yes", "confirm that you reviewed pricing with runs:quote --summary and accept fluctuating realized usage").description("Create a training run").action(async (options, command) => {
|
|
10015
10056
|
const config = loadConfig();
|
|
10057
|
+
assertQuoteCreateHasNoLaunchOverrides(options, command);
|
|
10016
10058
|
const runInput = buildRunInput(options, config);
|
|
10017
10059
|
if (!options.yes) {
|
|
10018
10060
|
throw new Error("Refusing to launch without explicit cost acceptance. Run `trainfabric runs:quote --summary ...` first, then rerun `runs:create` with --yes.");
|
|
@@ -10204,7 +10246,7 @@ program2.command("api-keys:create").requiredOption("--name <name>").option("--ow
|
|
|
10204
10246
|
const session = await createClient(config).auth.me();
|
|
10205
10247
|
const apiKey = await createClient(config).apiKeys.create({
|
|
10206
10248
|
name: normalizeHumanName(options.name, "API key name"),
|
|
10207
|
-
ownerType: options.ownerType,
|
|
10249
|
+
ownerType: normalizeApiKeyOwnerType(options.ownerType),
|
|
10208
10250
|
ownerId: options.ownerId ?? session.user.id,
|
|
10209
10251
|
scopes: parseApiKeyScopes(String(options.scopes))
|
|
10210
10252
|
});
|