@omnichar/contracts 0.19.4 → 0.21.0
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/v1/builds.d.ts +144 -0
- package/dist/v1/builds.d.ts.map +1 -0
- package/dist/v1/builds.js +80 -0
- package/dist/v1/builds.js.map +1 -0
- package/dist/v1/charInspection.d.ts +50 -0
- package/dist/v1/charInspection.d.ts.map +1 -0
- package/dist/v1/charInspection.js +35 -0
- package/dist/v1/charInspection.js.map +1 -0
- package/dist/v1/datasets.d.ts +63 -0
- package/dist/v1/datasets.d.ts.map +1 -1
- package/dist/v1/datasets.js +34 -0
- package/dist/v1/datasets.js.map +1 -1
- package/dist/v1/index.d.ts +3 -0
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +3 -0
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/mcp.d.ts +109 -0
- package/dist/v1/mcp.d.ts.map +1 -0
- package/dist/v1/mcp.js +128 -0
- package/dist/v1/mcp.js.map +1 -0
- package/dist/v1/runs.d.ts +12 -0
- package/dist/v1/runs.d.ts.map +1 -1
- package/dist/v1/sessions.d.ts +8 -0
- package/dist/v1/sessions.d.ts.map +1 -1
- package/dist/v1/studio.d.ts +29 -0
- package/dist/v1/studio.d.ts.map +1 -1
- package/dist/v1/studio.js +18 -1
- package/dist/v1/studio.js.map +1 -1
- package/dist/v1/training.d.ts +254 -0
- package/dist/v1/training.d.ts.map +1 -0
- package/dist/v1/training.js +120 -0
- package/dist/v1/training.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TRAINING_PRESETS: readonly ["fast", "balanced", "quality"];
|
|
3
|
+
export declare const trainingPresetSchema: z.ZodEnum<{
|
|
4
|
+
fast: "fast";
|
|
5
|
+
balanced: "balanced";
|
|
6
|
+
quality: "quality";
|
|
7
|
+
}>;
|
|
8
|
+
export type TrainingPreset = z.infer<typeof trainingPresetSchema>;
|
|
9
|
+
export declare const PRESET_STEPS: Record<TrainingPreset, number>;
|
|
10
|
+
export declare const MAX_MODELS_PER_BATCH = 4;
|
|
11
|
+
export declare const trainingSettingsSchema: z.ZodObject<{
|
|
12
|
+
steps: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
resolution: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
learningRate: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
saveEvery: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
captionDropout: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
flipAugment: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
loraScope: z.ZodOptional<z.ZodEnum<{
|
|
22
|
+
full: "full";
|
|
23
|
+
attention: "attention";
|
|
24
|
+
}>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type TrainingSettings = z.infer<typeof trainingSettingsSchema>;
|
|
27
|
+
export declare const trainingEstimateBodySchema: z.ZodObject<{
|
|
28
|
+
models: z.ZodArray<z.ZodString>;
|
|
29
|
+
preset: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
fast: "fast";
|
|
31
|
+
balanced: "balanced";
|
|
32
|
+
quality: "quality";
|
|
33
|
+
}>>;
|
|
34
|
+
settings: z.ZodDefault<z.ZodObject<{
|
|
35
|
+
steps: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
resolution: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
learningRate: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
saveEvery: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
captionDropout: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
flipAugment: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
loraScope: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
full: "full";
|
|
46
|
+
attention: "attention";
|
|
47
|
+
}>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type TrainingEstimateBody = z.input<typeof trainingEstimateBodySchema>;
|
|
51
|
+
export declare const estimateLineSchema: z.ZodObject<{
|
|
52
|
+
label: z.ZodString;
|
|
53
|
+
etaMin: z.ZodNumber;
|
|
54
|
+
credits: z.ZodNumber;
|
|
55
|
+
parallel: z.ZodBoolean;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export declare const estimateSchema: z.ZodObject<{
|
|
58
|
+
etaMin: z.ZodNumber;
|
|
59
|
+
credits: z.ZodNumber;
|
|
60
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
61
|
+
label: z.ZodString;
|
|
62
|
+
etaMin: z.ZodNumber;
|
|
63
|
+
credits: z.ZodNumber;
|
|
64
|
+
parallel: z.ZodBoolean;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
export type Estimate = z.infer<typeof estimateSchema>;
|
|
68
|
+
export declare const startTrainingBodySchema: z.ZodObject<{
|
|
69
|
+
models: z.ZodArray<z.ZodString>;
|
|
70
|
+
preset: z.ZodDefault<z.ZodEnum<{
|
|
71
|
+
fast: "fast";
|
|
72
|
+
balanced: "balanced";
|
|
73
|
+
quality: "quality";
|
|
74
|
+
}>>;
|
|
75
|
+
settings: z.ZodDefault<z.ZodObject<{
|
|
76
|
+
steps: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
resolution: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
rank: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
learningRate: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
saveEvery: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
captionDropout: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
flipAugment: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
loraScope: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
full: "full";
|
|
87
|
+
attention: "attention";
|
|
88
|
+
}>>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
datasetId: z.ZodUUID;
|
|
91
|
+
characterId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
92
|
+
name: z.ZodOptional<z.ZodString>;
|
|
93
|
+
notifyEmail: z.ZodDefault<z.ZodBoolean>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export type StartTrainingBody = z.input<typeof startTrainingBodySchema>;
|
|
96
|
+
export declare const startTrainingResponseSchema: z.ZodObject<{
|
|
97
|
+
batchId: z.ZodUUID;
|
|
98
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
99
|
+
runId: z.ZodUUID;
|
|
100
|
+
model: z.ZodString;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
refused: z.ZodArray<z.ZodObject<{
|
|
103
|
+
model: z.ZodString;
|
|
104
|
+
message: z.ZodString;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
estimate: z.ZodObject<{
|
|
107
|
+
etaMin: z.ZodNumber;
|
|
108
|
+
credits: z.ZodNumber;
|
|
109
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
110
|
+
label: z.ZodString;
|
|
111
|
+
etaMin: z.ZodNumber;
|
|
112
|
+
credits: z.ZodNumber;
|
|
113
|
+
parallel: z.ZodBoolean;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
export type StartTrainingResponse = z.infer<typeof startTrainingResponseSchema>;
|
|
118
|
+
export declare const TRAINING_STATUSES: readonly ["queued", "training", "completed", "failed", "canceled"];
|
|
119
|
+
export declare const trainingStatusSchema: z.ZodEnum<{
|
|
120
|
+
training: "training";
|
|
121
|
+
queued: "queued";
|
|
122
|
+
failed: "failed";
|
|
123
|
+
canceled: "canceled";
|
|
124
|
+
completed: "completed";
|
|
125
|
+
}>;
|
|
126
|
+
export declare const trainingHistoryQuerySchema: z.ZodObject<{
|
|
127
|
+
characterId: z.ZodOptional<z.ZodUUID>;
|
|
128
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
129
|
+
training: "training";
|
|
130
|
+
queued: "queued";
|
|
131
|
+
failed: "failed";
|
|
132
|
+
canceled: "canceled";
|
|
133
|
+
completed: "completed";
|
|
134
|
+
}>>;
|
|
135
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
export type TrainingHistoryQuery = z.input<typeof trainingHistoryQuerySchema>;
|
|
138
|
+
export declare const trainingRunSchema: z.ZodObject<{
|
|
139
|
+
runId: z.ZodUUID;
|
|
140
|
+
batchId: z.ZodNullable<z.ZodUUID>;
|
|
141
|
+
model: z.ZodObject<{
|
|
142
|
+
slug: z.ZodString;
|
|
143
|
+
label: z.ZodString;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
character: z.ZodNullable<z.ZodObject<{
|
|
146
|
+
id: z.ZodUUID;
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
name: z.ZodString;
|
|
150
|
+
dataset: z.ZodNullable<z.ZodObject<{
|
|
151
|
+
id: z.ZodUUID;
|
|
152
|
+
name: z.ZodString;
|
|
153
|
+
items: z.ZodNumber;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
preset: z.ZodNullable<z.ZodEnum<{
|
|
156
|
+
fast: "fast";
|
|
157
|
+
balanced: "balanced";
|
|
158
|
+
quality: "quality";
|
|
159
|
+
}>>;
|
|
160
|
+
steps: z.ZodNullable<z.ZodNumber>;
|
|
161
|
+
status: z.ZodEnum<{
|
|
162
|
+
training: "training";
|
|
163
|
+
queued: "queued";
|
|
164
|
+
failed: "failed";
|
|
165
|
+
canceled: "canceled";
|
|
166
|
+
completed: "completed";
|
|
167
|
+
}>;
|
|
168
|
+
fraction: z.ZodNullable<z.ZodNumber>;
|
|
169
|
+
error: z.ZodNullable<z.ZodString>;
|
|
170
|
+
credits: z.ZodNumber;
|
|
171
|
+
refunded: z.ZodBoolean;
|
|
172
|
+
createdAt: z.ZodISODateTime;
|
|
173
|
+
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
174
|
+
durationMin: z.ZodNullable<z.ZodNumber>;
|
|
175
|
+
hasLora: z.ZodBoolean;
|
|
176
|
+
testable: z.ZodBoolean;
|
|
177
|
+
triggerWord: z.ZodNullable<z.ZodString>;
|
|
178
|
+
outdated: z.ZodBoolean;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
export type TrainingRun = z.infer<typeof trainingRunSchema>;
|
|
181
|
+
export declare const trainingStatsSchema: z.ZodObject<{
|
|
182
|
+
active: z.ZodNumber;
|
|
183
|
+
training: z.ZodNumber;
|
|
184
|
+
queued: z.ZodNumber;
|
|
185
|
+
trained: z.ZodNumber;
|
|
186
|
+
characters: z.ZodNumber;
|
|
187
|
+
credits14d: z.ZodNumber;
|
|
188
|
+
avgRunMin: z.ZodNullable<z.ZodNumber>;
|
|
189
|
+
completed: z.ZodNumber;
|
|
190
|
+
failed: z.ZodNumber;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type TrainingStats = z.infer<typeof trainingStatsSchema>;
|
|
193
|
+
export declare const trainingHistorySchema: z.ZodObject<{
|
|
194
|
+
items: z.ZodArray<z.ZodObject<{
|
|
195
|
+
runId: z.ZodUUID;
|
|
196
|
+
batchId: z.ZodNullable<z.ZodUUID>;
|
|
197
|
+
model: z.ZodObject<{
|
|
198
|
+
slug: z.ZodString;
|
|
199
|
+
label: z.ZodString;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
character: z.ZodNullable<z.ZodObject<{
|
|
202
|
+
id: z.ZodUUID;
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
dataset: z.ZodNullable<z.ZodObject<{
|
|
207
|
+
id: z.ZodUUID;
|
|
208
|
+
name: z.ZodString;
|
|
209
|
+
items: z.ZodNumber;
|
|
210
|
+
}, z.core.$strip>>;
|
|
211
|
+
preset: z.ZodNullable<z.ZodEnum<{
|
|
212
|
+
fast: "fast";
|
|
213
|
+
balanced: "balanced";
|
|
214
|
+
quality: "quality";
|
|
215
|
+
}>>;
|
|
216
|
+
steps: z.ZodNullable<z.ZodNumber>;
|
|
217
|
+
status: z.ZodEnum<{
|
|
218
|
+
training: "training";
|
|
219
|
+
queued: "queued";
|
|
220
|
+
failed: "failed";
|
|
221
|
+
canceled: "canceled";
|
|
222
|
+
completed: "completed";
|
|
223
|
+
}>;
|
|
224
|
+
fraction: z.ZodNullable<z.ZodNumber>;
|
|
225
|
+
error: z.ZodNullable<z.ZodString>;
|
|
226
|
+
credits: z.ZodNumber;
|
|
227
|
+
refunded: z.ZodBoolean;
|
|
228
|
+
createdAt: z.ZodISODateTime;
|
|
229
|
+
finishedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
230
|
+
durationMin: z.ZodNullable<z.ZodNumber>;
|
|
231
|
+
hasLora: z.ZodBoolean;
|
|
232
|
+
testable: z.ZodBoolean;
|
|
233
|
+
triggerWord: z.ZodNullable<z.ZodString>;
|
|
234
|
+
outdated: z.ZodBoolean;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
stats: z.ZodObject<{
|
|
237
|
+
active: z.ZodNumber;
|
|
238
|
+
training: z.ZodNumber;
|
|
239
|
+
queued: z.ZodNumber;
|
|
240
|
+
trained: z.ZodNumber;
|
|
241
|
+
characters: z.ZodNumber;
|
|
242
|
+
credits14d: z.ZodNumber;
|
|
243
|
+
avgRunMin: z.ZodNullable<z.ZodNumber>;
|
|
244
|
+
completed: z.ZodNumber;
|
|
245
|
+
failed: z.ZodNumber;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
export type TrainingHistory = z.infer<typeof trainingHistorySchema>;
|
|
249
|
+
export declare const loraTestBodySchema: z.ZodObject<{
|
|
250
|
+
prompt: z.ZodString;
|
|
251
|
+
strength: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
export type LoraTestBody = z.input<typeof loraTestBodySchema>;
|
|
254
|
+
//# sourceMappingURL=training.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"training.d.ts","sourceRoot":"","sources":["../../src/v1/training.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,gBAAgB,0CAA2C,CAAA;AACxE,eAAO,MAAM,oBAAoB;;;;EAA2B,CAAA;AAC5D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAIvD,CAAA;AAGD,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAIrC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;iBAavB,CAAA;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAQrE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;iBAIrC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,eAAO,MAAM,kBAAkB;;;;;iBAM7B,CAAA;AAGF,eAAO,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AkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Presets set the step count only; every other setting keeps the model's own default.
|
|
3
|
+
export const TRAINING_PRESETS = ['fast', 'balanced', 'quality'];
|
|
4
|
+
export const trainingPresetSchema = z.enum(TRAINING_PRESETS);
|
|
5
|
+
export const PRESET_STEPS = {
|
|
6
|
+
fast: 1000,
|
|
7
|
+
balanced: 1500,
|
|
8
|
+
quality: 2500,
|
|
9
|
+
};
|
|
10
|
+
// One pod per model, so a batch is capped at what a person would plausibly compare side by side.
|
|
11
|
+
export const MAX_MODELS_PER_BATCH = 4;
|
|
12
|
+
// Only the trainer settings Core reads. Optimizer, scheduler and warmup are not offered because the
|
|
13
|
+
// trainer has no such knobs; showing them would promise a change the run never makes.
|
|
14
|
+
export const trainingSettingsSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
steps: z.number().int().min(100).max(10_000),
|
|
17
|
+
resolution: z.number().int().min(256).max(2048).multipleOf(64),
|
|
18
|
+
rank: z.number().int().min(1).max(256),
|
|
19
|
+
alpha: z.number().int().min(1).max(256),
|
|
20
|
+
learningRate: z.number().positive().max(0.01),
|
|
21
|
+
batchSize: z.number().int().min(1).max(16),
|
|
22
|
+
saveEvery: z.number().int().min(1).max(10_000),
|
|
23
|
+
captionDropout: z.number().min(0).max(1),
|
|
24
|
+
flipAugment: z.boolean(),
|
|
25
|
+
loraScope: z.enum(['full', 'attention']),
|
|
26
|
+
})
|
|
27
|
+
.partial();
|
|
28
|
+
const modelSlugsSchema = z
|
|
29
|
+
.array(z.string().regex(/^train-lora-[a-z0-9-]+$/))
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(MAX_MODELS_PER_BATCH)
|
|
32
|
+
.refine((slugs) => new Set(slugs).size === slugs.length, { message: 'A model is listed twice.' });
|
|
33
|
+
export const trainingEstimateBodySchema = z.object({
|
|
34
|
+
models: modelSlugsSchema,
|
|
35
|
+
preset: trainingPresetSchema.default('balanced'),
|
|
36
|
+
settings: trainingSettingsSchema.default({}),
|
|
37
|
+
});
|
|
38
|
+
export const estimateLineSchema = z.object({
|
|
39
|
+
label: z.string(),
|
|
40
|
+
etaMin: z.number().int().nonnegative(),
|
|
41
|
+
credits: z.number().nonnegative(),
|
|
42
|
+
// True for a line that runs beside the others, so the total takes its time once, not in sum.
|
|
43
|
+
parallel: z.boolean(),
|
|
44
|
+
});
|
|
45
|
+
// The server's price and time. A form shows this and never adds anything up itself.
|
|
46
|
+
export const estimateSchema = z.object({
|
|
47
|
+
etaMin: z.number().int().nonnegative(),
|
|
48
|
+
credits: z.number().nonnegative(),
|
|
49
|
+
lines: z.array(estimateLineSchema),
|
|
50
|
+
});
|
|
51
|
+
export const startTrainingBodySchema = trainingEstimateBodySchema.extend({
|
|
52
|
+
datasetId: z.uuid(),
|
|
53
|
+
// A character's LoRA, or a standalone one named here (a style, an object, a look).
|
|
54
|
+
characterId: z.uuid().nullable().default(null),
|
|
55
|
+
name: z.string().trim().min(1).max(80).optional(),
|
|
56
|
+
notifyEmail: z.boolean().default(true),
|
|
57
|
+
});
|
|
58
|
+
export const startTrainingResponseSchema = z.object({
|
|
59
|
+
batchId: z.uuid(),
|
|
60
|
+
runs: z.array(z.object({ runId: z.uuid(), model: z.string() })),
|
|
61
|
+
// A model whose run could not start, such as no free GPU, while the others in the batch did.
|
|
62
|
+
refused: z.array(z.object({ model: z.string(), message: z.string() })),
|
|
63
|
+
estimate: estimateSchema,
|
|
64
|
+
});
|
|
65
|
+
export const TRAINING_STATUSES = ['queued', 'training', 'completed', 'failed', 'canceled'];
|
|
66
|
+
export const trainingStatusSchema = z.enum(TRAINING_STATUSES);
|
|
67
|
+
export const trainingHistoryQuerySchema = z.object({
|
|
68
|
+
characterId: z.uuid().optional(),
|
|
69
|
+
status: trainingStatusSchema.optional(),
|
|
70
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
71
|
+
});
|
|
72
|
+
export const trainingRunSchema = z.object({
|
|
73
|
+
runId: z.uuid(),
|
|
74
|
+
batchId: z.uuid().nullable(),
|
|
75
|
+
model: z.object({ slug: z.string(), label: z.string() }),
|
|
76
|
+
// Null for a standalone LoRA, which then carries its own name.
|
|
77
|
+
character: z.object({ id: z.uuid(), name: z.string() }).nullable(),
|
|
78
|
+
name: z.string(),
|
|
79
|
+
dataset: z.object({ id: z.uuid(), name: z.string(), items: z.number().int() }).nullable(),
|
|
80
|
+
preset: trainingPresetSchema.nullable(),
|
|
81
|
+
steps: z.number().int().nullable(),
|
|
82
|
+
status: trainingStatusSchema,
|
|
83
|
+
fraction: z.number().min(0).max(1).nullable(),
|
|
84
|
+
error: z.string().nullable(),
|
|
85
|
+
credits: z.number().nonnegative(),
|
|
86
|
+
// A failed run gives its hold back, so the row says so rather than showing a charge.
|
|
87
|
+
refunded: z.boolean(),
|
|
88
|
+
createdAt: z.iso.datetime(),
|
|
89
|
+
finishedAt: z.iso.datetime().nullable(),
|
|
90
|
+
durationMin: z.number().int().nullable(),
|
|
91
|
+
// The LoRA is on GET /runs/:id as a signed artifact; this only says whether there is one.
|
|
92
|
+
hasLora: z.boolean(),
|
|
93
|
+
// Whether this LoRA can be tested in the cloud: finished, stored, and an image model.
|
|
94
|
+
testable: z.boolean(),
|
|
95
|
+
// The word the dataset trained on, which a test prompt has to contain.
|
|
96
|
+
triggerWord: z.string().nullable(),
|
|
97
|
+
// The character's references changed since this LoRA trained, so it no longer matches them.
|
|
98
|
+
outdated: z.boolean(),
|
|
99
|
+
});
|
|
100
|
+
export const trainingStatsSchema = z.object({
|
|
101
|
+
active: z.number().int(),
|
|
102
|
+
training: z.number().int(),
|
|
103
|
+
queued: z.number().int(),
|
|
104
|
+
trained: z.number().int(),
|
|
105
|
+
characters: z.number().int(),
|
|
106
|
+
credits14d: z.number(),
|
|
107
|
+
avgRunMin: z.number().int().nullable(),
|
|
108
|
+
completed: z.number().int(),
|
|
109
|
+
failed: z.number().int(),
|
|
110
|
+
});
|
|
111
|
+
export const trainingHistorySchema = z.object({
|
|
112
|
+
items: z.array(trainingRunSchema),
|
|
113
|
+
stats: trainingStatsSchema,
|
|
114
|
+
});
|
|
115
|
+
// One image from a finished LoRA, with no character wired in, so the take shows the LoRA alone.
|
|
116
|
+
export const loraTestBodySchema = z.object({
|
|
117
|
+
prompt: z.string().trim().min(1).max(2000),
|
|
118
|
+
strength: z.number().min(0).max(2).optional(),
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=training.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"training.js","sourceRoot":"","sources":["../../src/v1/training.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,sFAAsF;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAU,CAAA;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;AAE5D,MAAM,CAAC,MAAM,YAAY,GAAmC;IAC1D,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;CACd,CAAA;AAED,iGAAiG;AACjG,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAErC,oGAAoG;AACpG,sFAAsF;AACtF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;IAC9D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EA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GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnichar/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "The wire contract between Cloud-Studio and Cloud-Control-Plane. Zod schemas and the types inferred from them.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsc -p tsconfig.json",
|
|
23
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"clean": "rm -rf dist"
|
|
26
|
-
},
|
|
27
21
|
"dependencies": {
|
|
28
22
|
"zod": "4.5.4"
|
|
29
23
|
},
|
|
30
24
|
"devDependencies": {
|
|
31
25
|
"typescript": "6.0.3",
|
|
32
26
|
"vitest": "5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc -p tsconfig.json",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"clean": "rm -rf dist"
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|