@civitai/client 0.2.0-beta.11 → 0.2.0-beta.14

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.
@@ -23,6 +23,9 @@ import type {
23
23
  InvokeImageResourceTrainingStepTemplateData,
24
24
  InvokeImageResourceTrainingStepTemplateResponses,
25
25
  InvokeImageResourceTrainingStepTemplateErrors,
26
+ InvokeTrainingStepTemplateData,
27
+ InvokeTrainingStepTemplateResponses,
28
+ InvokeTrainingStepTemplateErrors,
26
29
  InvokeImageUploadStepTemplateData,
27
30
  InvokeImageUploadStepTemplateResponses,
28
31
  InvokeImageUploadStepTemplateErrors,
@@ -180,6 +183,18 @@ export declare const invokeImageResourceTrainingStepTemplate: <
180
183
  ThrowOnError,
181
184
  'fields'
182
185
  >;
186
+ /**
187
+ * AI Toolkit Training
188
+ * Train models using AI Toolkit engine
189
+ */
190
+ export declare const invokeTrainingStepTemplate: <ThrowOnError extends boolean = false>(
191
+ options?: Options<InvokeTrainingStepTemplateData, ThrowOnError>
192
+ ) => import('./client').RequestResult<
193
+ InvokeTrainingStepTemplateResponses,
194
+ InvokeTrainingStepTemplateErrors,
195
+ ThrowOnError,
196
+ 'fields'
197
+ >;
183
198
  /**
184
199
  * Image upload
185
200
  * Uploads an image to be used in a workflow
@@ -154,6 +154,27 @@ export const invokeImageResourceTrainingStepTemplate = (options) => {
154
154
  },
155
155
  });
156
156
  };
157
+ /**
158
+ * AI Toolkit Training
159
+ * Train models using AI Toolkit engine
160
+ */
161
+ export const invokeTrainingStepTemplate = (options) => {
162
+ var _a;
163
+ return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : _heyApiClient).post({
164
+ security: [
165
+ {
166
+ scheme: 'bearer',
167
+ type: 'http',
168
+ },
169
+ ],
170
+ url: '/v2/consumer/recipes/training',
171
+ ...options,
172
+ headers: {
173
+ 'Content-Type': 'application/json',
174
+ ...options === null || options === void 0 ? void 0 : options.headers,
175
+ },
176
+ });
177
+ };
157
178
  /**
158
179
  * Image upload
159
180
  * Uploads an image to be used in a workflow
@@ -628,6 +628,195 @@ export type ImageResourceTrainingStepTemplate = WorkflowStepTemplate & {
628
628
  } & {
629
629
  $type: 'imageResourceTraining';
630
630
  };
631
+ /**
632
+ * Input for a training step.
633
+ */
634
+ export type TrainingInput = {
635
+ /**
636
+ * The training engine to use
637
+ */
638
+ engine: 'ai-toolkit';
639
+ /**
640
+ * The model ecosystem
641
+ */
642
+ ecosystem: 'sd1' | 'sdxl' | 'sd3' | 'flux1' | 'wan';
643
+ /**
644
+ * The model URN to train upon
645
+ */
646
+ model: string;
647
+ /**
648
+ * Model variant. Required for: sd3 ('large'), flux1 ('dev' or 'schnell'), wan ('2.1' or '2.2'). Not used for sd1 or sdxl.
649
+ */
650
+ modelVariant?: string | null;
651
+ /**
652
+ * Training data specification
653
+ */
654
+ trainingData: {
655
+ /**
656
+ * Type of training data (e.g., 'zip')
657
+ */
658
+ type: string;
659
+ /**
660
+ * URN/URL to training data
661
+ */
662
+ sourceUrl: string;
663
+ /**
664
+ * Number of training items
665
+ */
666
+ count: number;
667
+ };
668
+ /**
669
+ * Sample generation configuration
670
+ */
671
+ samples: {
672
+ /**
673
+ * Sample generation prompts
674
+ */
675
+ prompts: Array<string>;
676
+ };
677
+ /**
678
+ * Number of training epochs
679
+ */
680
+ epochs?: number;
681
+ /**
682
+ * Training resolution (512, 1024, etc.)
683
+ */
684
+ resolution?: number | null;
685
+ /**
686
+ * Learning rate
687
+ */
688
+ lr?: number;
689
+ /**
690
+ * Text encoder learning rate
691
+ */
692
+ textEncoderLr?: number | null;
693
+ /**
694
+ * Whether to train text encoder
695
+ */
696
+ trainTextEncoder?: boolean;
697
+ /**
698
+ * Learning rate scheduler type
699
+ */
700
+ lrScheduler?: string;
701
+ /**
702
+ * Optimizer type
703
+ */
704
+ optimizerType?: string;
705
+ /**
706
+ * LoRA network dimension
707
+ */
708
+ networkDim?: number;
709
+ /**
710
+ * LoRA network alpha
711
+ */
712
+ networkAlpha?: number;
713
+ /**
714
+ * Noise offset for training
715
+ */
716
+ noiseOffset?: number;
717
+ /**
718
+ * Min SNR gamma value
719
+ */
720
+ minSnrGamma?: number | null;
721
+ /**
722
+ * Enable horizontal flip augmentation
723
+ */
724
+ flipAugmentation?: boolean;
725
+ /**
726
+ * Shuffle tokens during training
727
+ */
728
+ shuffleTokens?: boolean;
729
+ /**
730
+ * Number of tokens to keep at start
731
+ */
732
+ keepTokens?: number;
733
+ };
734
+ /**
735
+ * An epoch result for training output.
736
+ */
737
+ export type TrainingEpochResult = {
738
+ /**
739
+ * The epoch number
740
+ */
741
+ epochNumber?: number;
742
+ /**
743
+ * The trained model blob for this epoch
744
+ */
745
+ model: {
746
+ /**
747
+ * The blob id of the trained model file
748
+ */
749
+ id: string;
750
+ /**
751
+ * Whether the model blob is available
752
+ */
753
+ available: boolean;
754
+ /**
755
+ * Presigned URL to download the model
756
+ */
757
+ url?: string | null;
758
+ /**
759
+ * When the presigned URL expires
760
+ */
761
+ urlExpiresAt?: string | null;
762
+ };
763
+ /**
764
+ * Generated sample images for this epoch
765
+ */
766
+ samples: Array<{
767
+ /**
768
+ * The blob id of the sample image
769
+ */
770
+ id: string;
771
+ /**
772
+ * Whether the sample image is available
773
+ */
774
+ available: boolean;
775
+ /**
776
+ * Presigned URL to view the sample image
777
+ */
778
+ url?: string | null;
779
+ /**
780
+ * When the presigned URL expires
781
+ */
782
+ urlExpiresAt?: string | null;
783
+ /**
784
+ * NSFW level of the sample image
785
+ */
786
+ nsfwLevel?: string | null;
787
+ }>;
788
+ };
789
+ export type TrainingOutput = {
790
+ /**
791
+ * Moderation status of the training output
792
+ */
793
+ moderationStatus: string;
794
+ /**
795
+ * Training epoch results
796
+ */
797
+ epochs?: Array<TrainingEpochResult> | null;
798
+ };
799
+ /**
800
+ * AI Toolkit Training Step
801
+ */
802
+ export type TrainingStep = WorkflowStep & {
803
+ $type: 'training';
804
+ } & {
805
+ input: TrainingInput;
806
+ output?: TrainingOutput;
807
+ } & {
808
+ $type: 'training';
809
+ };
810
+ /**
811
+ * AI Toolkit Training Step Template
812
+ */
813
+ export type TrainingStepTemplate = WorkflowStepTemplate & {
814
+ $type: 'training';
815
+ } & {
816
+ input: TrainingInput;
817
+ } & {
818
+ $type: 'training';
819
+ };
631
820
  /**
632
821
  * Available image transformers.
633
822
  */
@@ -2489,6 +2678,35 @@ export type InvokeImageResourceTrainingStepTemplateResponses = {
2489
2678
  };
2490
2679
  export type InvokeImageResourceTrainingStepTemplateResponse =
2491
2680
  InvokeImageResourceTrainingStepTemplateResponses[keyof InvokeImageResourceTrainingStepTemplateResponses];
2681
+ export type InvokeTrainingStepTemplateData = {
2682
+ body?: TrainingInput;
2683
+ path?: never;
2684
+ query?: {
2685
+ experimental?: boolean;
2686
+ allowMatureContent?: boolean;
2687
+ };
2688
+ url: '/v2/consumer/recipes/training';
2689
+ };
2690
+ export type InvokeTrainingStepTemplateErrors = {
2691
+ /**
2692
+ * Bad Request
2693
+ */
2694
+ 400: ProblemDetails;
2695
+ /**
2696
+ * Unauthorized
2697
+ */
2698
+ 401: ProblemDetails;
2699
+ };
2700
+ export type InvokeTrainingStepTemplateError =
2701
+ InvokeTrainingStepTemplateErrors[keyof InvokeTrainingStepTemplateErrors];
2702
+ export type InvokeTrainingStepTemplateResponses = {
2703
+ /**
2704
+ * OK
2705
+ */
2706
+ 200: TrainingOutput;
2707
+ };
2708
+ export type InvokeTrainingStepTemplateResponse =
2709
+ InvokeTrainingStepTemplateResponses[keyof InvokeTrainingStepTemplateResponses];
2492
2710
  export type InvokeImageUploadStepTemplateData = {
2493
2711
  body?: string;
2494
2712
  path?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/client",
3
- "version": "0.2.0-beta.11",
3
+ "version": "0.2.0-beta.14",
4
4
  "description": "Civitai's javascript client for generating ai content",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -54,4 +54,4 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  }
57
- }
57
+ }