@huggingface/transformers 3.0.0-alpha.20 → 3.0.0-alpha.21
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/README.md +3 -2
- package/dist/ort-wasm-simd-threaded.jsep.wasm +0 -0
- package/dist/transformers.cjs +129 -467
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +526 -861
- package/dist/transformers.js.map +1 -1
- package/dist/transformers.min.cjs +11 -11
- package/dist/transformers.min.cjs.map +1 -1
- package/dist/transformers.min.js +10 -10
- package/dist/transformers.min.js.map +1 -1
- package/dist/transformers.min.mjs +5 -5
- package/dist/transformers.min.mjs.map +1 -1
- package/dist/transformers.mjs +133 -468
- package/dist/transformers.mjs.map +1 -1
- package/package.json +2 -2
- package/src/configs.js +1 -0
- package/src/env.js +1 -1
- package/src/models.js +84 -453
- package/src/utils/tensor.js +37 -13
- package/types/configs.d.ts.map +1 -1
- package/types/models.d.ts +15 -294
- package/types/models.d.ts.map +1 -1
- package/types/pipelines.d.ts +1 -2
- package/types/pipelines.d.ts.map +1 -1
- package/types/utils/tensor.d.ts +14 -0
- package/types/utils/tensor.d.ts.map +1 -1
package/src/models.js
CHANGED
|
@@ -280,6 +280,23 @@ async function constructSessions(pretrained_model_name_or_path, names, options)
|
|
|
280
280
|
));
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Helper function to load multiple optional configuration files
|
|
285
|
+
* @param {string} pretrained_model_name_or_path The path to the directory containing the config file.
|
|
286
|
+
* @param {Record<string, string>} names The names of the config files to load.
|
|
287
|
+
* @param {import('./utils/hub.js').PretrainedModelOptions} options Additional options for loading the configs.
|
|
288
|
+
* @returns {Promise<Record<string, any>>} A Promise that resolves to a dictionary of configuration objects.
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
async function getOptionalConfigs(pretrained_model_name_or_path, names, options) {
|
|
292
|
+
return Object.fromEntries(await Promise.all(
|
|
293
|
+
Object.keys(names).map(async (name) => {
|
|
294
|
+
const config = await getModelJSON(pretrained_model_name_or_path, names[name], false, options);
|
|
295
|
+
return [name, config];
|
|
296
|
+
})
|
|
297
|
+
));
|
|
298
|
+
}
|
|
299
|
+
|
|
283
300
|
/**
|
|
284
301
|
* Validate model inputs
|
|
285
302
|
* @param {Object} session The InferenceSession object that will be run.
|
|
@@ -691,12 +708,14 @@ export class PreTrainedModel extends Callable {
|
|
|
691
708
|
* Creates a new instance of the `PreTrainedModel` class.
|
|
692
709
|
* @param {import('./configs.js').PretrainedConfig} config The model configuration.
|
|
693
710
|
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
711
|
+
* @param {Record<string, Object>} configs Additional configuration files (e.g., generation_config.json).
|
|
694
712
|
*/
|
|
695
|
-
constructor(config, sessions) {
|
|
713
|
+
constructor(config, sessions, configs) {
|
|
696
714
|
super();
|
|
697
715
|
|
|
698
716
|
this.config = config;
|
|
699
717
|
this.sessions = sessions;
|
|
718
|
+
this.configs = configs;
|
|
700
719
|
|
|
701
720
|
const modelName = MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor);
|
|
702
721
|
const modelType = MODEL_TYPE_MAPPING.get(modelName);
|
|
@@ -812,7 +831,9 @@ export class PreTrainedModel extends Callable {
|
|
|
812
831
|
constructSessions(pretrained_model_name_or_path, {
|
|
813
832
|
model: options.model_file_name ?? 'model',
|
|
814
833
|
}, options),
|
|
815
|
-
|
|
834
|
+
getOptionalConfigs(pretrained_model_name_or_path, {
|
|
835
|
+
generation_config: 'generation_config.json',
|
|
836
|
+
}, options),
|
|
816
837
|
]);
|
|
817
838
|
|
|
818
839
|
} else if (modelType === MODEL_TYPES.Seq2Seq || modelType === MODEL_TYPES.Vision2Seq) {
|
|
@@ -821,7 +842,9 @@ export class PreTrainedModel extends Callable {
|
|
|
821
842
|
model: 'encoder_model',
|
|
822
843
|
decoder_model_merged: 'decoder_model_merged',
|
|
823
844
|
}, options),
|
|
824
|
-
|
|
845
|
+
getOptionalConfigs(pretrained_model_name_or_path, {
|
|
846
|
+
generation_config: 'generation_config.json',
|
|
847
|
+
}, options),
|
|
825
848
|
]);
|
|
826
849
|
|
|
827
850
|
} else if (modelType === MODEL_TYPES.MaskGeneration) {
|
|
@@ -851,7 +874,9 @@ export class PreTrainedModel extends Callable {
|
|
|
851
874
|
}
|
|
852
875
|
info = await Promise.all([
|
|
853
876
|
constructSessions(pretrained_model_name_or_path, sessions, options),
|
|
854
|
-
|
|
877
|
+
getOptionalConfigs(pretrained_model_name_or_path, {
|
|
878
|
+
generation_config: 'generation_config.json',
|
|
879
|
+
}, options),
|
|
855
880
|
]);
|
|
856
881
|
|
|
857
882
|
} else if (modelType === MODEL_TYPES.Musicgen) {
|
|
@@ -861,7 +886,9 @@ export class PreTrainedModel extends Callable {
|
|
|
861
886
|
decoder_model_merged: 'decoder_model_merged',
|
|
862
887
|
encodec_decode: 'encodec_decode',
|
|
863
888
|
}, options),
|
|
864
|
-
|
|
889
|
+
getOptionalConfigs(pretrained_model_name_or_path, {
|
|
890
|
+
generation_config: 'generation_config.json',
|
|
891
|
+
}, options),
|
|
865
892
|
]);
|
|
866
893
|
|
|
867
894
|
} else { // should be MODEL_TYPES.EncoderOnly
|
|
@@ -899,6 +926,14 @@ export class PreTrainedModel extends Callable {
|
|
|
899
926
|
return await this._forward(this, model_inputs);
|
|
900
927
|
}
|
|
901
928
|
|
|
929
|
+
/**
|
|
930
|
+
* Get the model's generation config, if it exists.
|
|
931
|
+
* @returns {GenerationConfig|null} The model's generation config if it exists, otherwise `null`.
|
|
932
|
+
*/
|
|
933
|
+
get generation_config() {
|
|
934
|
+
return this.configs?.generation_config ?? null;
|
|
935
|
+
}
|
|
936
|
+
|
|
902
937
|
/**
|
|
903
938
|
* This function returns a [`LogitsProcessorList`] list object that contains all relevant [`LogitsWarper`]
|
|
904
939
|
* instances used for multinomial sampling.
|
|
@@ -1078,9 +1113,7 @@ export class PreTrainedModel extends Callable {
|
|
|
1078
1113
|
const gen_config = new cls(config);
|
|
1079
1114
|
|
|
1080
1115
|
// Apply model's generation config, if it exists
|
|
1081
|
-
|
|
1082
|
-
Object.assign(gen_config, this.generation_config);
|
|
1083
|
-
}
|
|
1116
|
+
Object.assign(gen_config, this.generation_config ?? {});
|
|
1084
1117
|
|
|
1085
1118
|
// Next, use any generation config specified by the user
|
|
1086
1119
|
// when calling `generate`
|
|
@@ -2493,17 +2526,6 @@ export class T5PreTrainedModel extends PreTrainedModel {
|
|
|
2493
2526
|
'decoder_attention_mask',
|
|
2494
2527
|
'past_key_values',
|
|
2495
2528
|
];
|
|
2496
|
-
|
|
2497
|
-
/**
|
|
2498
|
-
* Creates a new instance of the `T5PreTrainedModel` class.
|
|
2499
|
-
* @param {Object} config The model configuration.
|
|
2500
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2501
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2502
|
-
*/
|
|
2503
|
-
constructor(config, sessions, generation_config) {
|
|
2504
|
-
super(config, sessions);
|
|
2505
|
-
this.generation_config = generation_config;
|
|
2506
|
-
}
|
|
2507
2529
|
};
|
|
2508
2530
|
|
|
2509
2531
|
export class T5Model extends T5PreTrainedModel { }
|
|
@@ -2520,18 +2542,7 @@ export class T5ForConditionalGeneration extends T5PreTrainedModel { }
|
|
|
2520
2542
|
/**
|
|
2521
2543
|
* An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
|
|
2522
2544
|
*/
|
|
2523
|
-
export class LongT5PreTrainedModel extends PreTrainedModel {
|
|
2524
|
-
/**
|
|
2525
|
-
* Creates a new instance of the `LongT5ForConditionalGeneration` class.
|
|
2526
|
-
* @param {Object} config The model configuration.
|
|
2527
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2528
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2529
|
-
*/
|
|
2530
|
-
constructor(config, sessions, generation_config) {
|
|
2531
|
-
super(config, sessions);
|
|
2532
|
-
this.generation_config = generation_config;
|
|
2533
|
-
}
|
|
2534
|
-
};
|
|
2545
|
+
export class LongT5PreTrainedModel extends PreTrainedModel { };
|
|
2535
2546
|
|
|
2536
2547
|
/**
|
|
2537
2548
|
* The bare LONGT5 Model transformer outputting raw hidden-states without any specific head on top.
|
|
@@ -2547,19 +2558,7 @@ export class LongT5ForConditionalGeneration extends LongT5PreTrainedModel { }
|
|
|
2547
2558
|
|
|
2548
2559
|
//////////////////////////////////////////////////
|
|
2549
2560
|
// MT5 models
|
|
2550
|
-
export class MT5PreTrainedModel extends PreTrainedModel {
|
|
2551
|
-
|
|
2552
|
-
/**
|
|
2553
|
-
* Creates a new instance of the `MT5ForConditionalGeneration` class.
|
|
2554
|
-
* @param {Object} config The model configuration.
|
|
2555
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2556
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2557
|
-
*/
|
|
2558
|
-
constructor(config, sessions, generation_config) {
|
|
2559
|
-
super(config, sessions);
|
|
2560
|
-
this.generation_config = generation_config;
|
|
2561
|
-
}
|
|
2562
|
-
};
|
|
2561
|
+
export class MT5PreTrainedModel extends PreTrainedModel { };
|
|
2563
2562
|
|
|
2564
2563
|
export class MT5Model extends MT5PreTrainedModel { }
|
|
2565
2564
|
|
|
@@ -2571,19 +2570,7 @@ export class MT5ForConditionalGeneration extends MT5PreTrainedModel { }
|
|
|
2571
2570
|
|
|
2572
2571
|
//////////////////////////////////////////////////
|
|
2573
2572
|
// Bart models
|
|
2574
|
-
export class BartPretrainedModel extends PreTrainedModel {
|
|
2575
|
-
|
|
2576
|
-
/**
|
|
2577
|
-
* Creates a new instance of the `BartForConditionalGeneration` class.
|
|
2578
|
-
* @param {Object} config The model configuration.
|
|
2579
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2580
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2581
|
-
*/
|
|
2582
|
-
constructor(config, sessions, generation_config) {
|
|
2583
|
-
super(config, sessions);
|
|
2584
|
-
this.generation_config = generation_config;
|
|
2585
|
-
}
|
|
2586
|
-
};
|
|
2573
|
+
export class BartPretrainedModel extends PreTrainedModel { };
|
|
2587
2574
|
|
|
2588
2575
|
/**
|
|
2589
2576
|
* The bare BART Model outputting raw hidden-states without any specific head on top.
|
|
@@ -2614,19 +2601,7 @@ export class BartForSequenceClassification extends BartPretrainedModel {
|
|
|
2614
2601
|
|
|
2615
2602
|
//////////////////////////////////////////////////
|
|
2616
2603
|
// MBart models
|
|
2617
|
-
export class MBartPreTrainedModel extends PreTrainedModel {
|
|
2618
|
-
|
|
2619
|
-
/**
|
|
2620
|
-
* Creates a new instance of the `MBartForConditionalGeneration` class.
|
|
2621
|
-
* @param {Object} config The model configuration.
|
|
2622
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2623
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2624
|
-
*/
|
|
2625
|
-
constructor(config, sessions, generation_config) {
|
|
2626
|
-
super(config, sessions);
|
|
2627
|
-
this.generation_config = generation_config;
|
|
2628
|
-
}
|
|
2629
|
-
};
|
|
2604
|
+
export class MBartPreTrainedModel extends PreTrainedModel { };
|
|
2630
2605
|
|
|
2631
2606
|
/**
|
|
2632
2607
|
* The bare MBART Model outputting raw hidden-states without any specific head on top.
|
|
@@ -2660,19 +2635,7 @@ export class MBartForCausalLM extends MBartPreTrainedModel { }
|
|
|
2660
2635
|
|
|
2661
2636
|
//////////////////////////////////////////////////
|
|
2662
2637
|
// Blenderbot models
|
|
2663
|
-
export class BlenderbotPreTrainedModel extends PreTrainedModel {
|
|
2664
|
-
|
|
2665
|
-
/**
|
|
2666
|
-
* Creates a new instance of the `BlenderbotForConditionalGeneration` class.
|
|
2667
|
-
* @param {Object} config The model configuration.
|
|
2668
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2669
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2670
|
-
*/
|
|
2671
|
-
constructor(config, sessions, generation_config) {
|
|
2672
|
-
super(config, sessions);
|
|
2673
|
-
this.generation_config = generation_config;
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2638
|
+
export class BlenderbotPreTrainedModel extends PreTrainedModel { };
|
|
2676
2639
|
|
|
2677
2640
|
/**
|
|
2678
2641
|
* The bare Blenderbot Model outputting raw hidden-states without any specific head on top.
|
|
@@ -2688,19 +2651,7 @@ export class BlenderbotForConditionalGeneration extends BlenderbotPreTrainedMode
|
|
|
2688
2651
|
|
|
2689
2652
|
//////////////////////////////////////////////////
|
|
2690
2653
|
// Blenderbot models
|
|
2691
|
-
export class BlenderbotSmallPreTrainedModel extends PreTrainedModel {
|
|
2692
|
-
|
|
2693
|
-
/**
|
|
2694
|
-
* Creates a new instance of the `BlenderbotForConditionalGeneration` class.
|
|
2695
|
-
* @param {Object} config The model configuration.
|
|
2696
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2697
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2698
|
-
*/
|
|
2699
|
-
constructor(config, sessions, generation_config) {
|
|
2700
|
-
super(config, sessions);
|
|
2701
|
-
this.generation_config = generation_config;
|
|
2702
|
-
}
|
|
2703
|
-
};
|
|
2654
|
+
export class BlenderbotSmallPreTrainedModel extends PreTrainedModel { };
|
|
2704
2655
|
|
|
2705
2656
|
/**
|
|
2706
2657
|
* The bare BlenderbotSmall Model outputting raw hidden-states without any specific head on top.
|
|
@@ -2949,17 +2900,6 @@ export class WhisperPreTrainedModel extends PreTrainedModel {
|
|
|
2949
2900
|
'decoder_attention_mask',
|
|
2950
2901
|
'past_key_values',
|
|
2951
2902
|
];
|
|
2952
|
-
|
|
2953
|
-
/**
|
|
2954
|
-
* Creates a new instance of the `WhisperPreTrainedModel` class.
|
|
2955
|
-
* @param {Object} config The model configuration.
|
|
2956
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
2957
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
2958
|
-
*/
|
|
2959
|
-
constructor(config, sessions, generation_config) {
|
|
2960
|
-
super(config, sessions);
|
|
2961
|
-
this.generation_config = generation_config;
|
|
2962
|
-
}
|
|
2963
2903
|
};
|
|
2964
2904
|
|
|
2965
2905
|
/**
|
|
@@ -3230,16 +3170,6 @@ export class VisionEncoderDecoderModel extends PreTrainedModel {
|
|
|
3230
3170
|
'encoder_hidden_states',
|
|
3231
3171
|
'past_key_values',
|
|
3232
3172
|
];
|
|
3233
|
-
/**
|
|
3234
|
-
* Creates a new instance of the `VisionEncoderDecoderModel` class.
|
|
3235
|
-
* @param {Object} config The model configuration.
|
|
3236
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3237
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3238
|
-
*/
|
|
3239
|
-
constructor(config, sessions, generation_config) {
|
|
3240
|
-
super(config, sessions);
|
|
3241
|
-
this.generation_config = generation_config;
|
|
3242
|
-
}
|
|
3243
3173
|
}
|
|
3244
3174
|
//////////////////////////////////////////////////
|
|
3245
3175
|
|
|
@@ -3254,11 +3184,6 @@ export class LlavaPreTrainedModel extends PreTrainedModel {
|
|
|
3254
3184
|
'position_ids',
|
|
3255
3185
|
'past_key_values',
|
|
3256
3186
|
];
|
|
3257
|
-
|
|
3258
|
-
constructor(config, sessions, generation_config) {
|
|
3259
|
-
super(config, sessions);
|
|
3260
|
-
this.generation_config = generation_config;
|
|
3261
|
-
}
|
|
3262
3187
|
}
|
|
3263
3188
|
|
|
3264
3189
|
/**
|
|
@@ -3345,11 +3270,6 @@ export class Florence2PreTrainedModel extends PreTrainedModel {
|
|
|
3345
3270
|
'past_key_values',
|
|
3346
3271
|
];
|
|
3347
3272
|
main_input_name = 'inputs_embeds';
|
|
3348
|
-
|
|
3349
|
-
constructor(config, sessions, generation_config) {
|
|
3350
|
-
super(config, sessions);
|
|
3351
|
-
this.generation_config = generation_config;
|
|
3352
|
-
}
|
|
3353
3273
|
}
|
|
3354
3274
|
|
|
3355
3275
|
export class Florence2ForConditionalGeneration extends Florence2PreTrainedModel {
|
|
@@ -3769,18 +3689,7 @@ export class CLIPSegForImageSegmentation extends CLIPSegPreTrainedModel { }
|
|
|
3769
3689
|
|
|
3770
3690
|
//////////////////////////////////////////////////
|
|
3771
3691
|
// GPT2 models
|
|
3772
|
-
export class GPT2PreTrainedModel extends PreTrainedModel {
|
|
3773
|
-
/**
|
|
3774
|
-
* Creates a new instance of the `GPT2PreTrainedModel` class.
|
|
3775
|
-
* @param {Object} config The model configuration.
|
|
3776
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3777
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3778
|
-
*/
|
|
3779
|
-
constructor(config, sessions, generation_config) {
|
|
3780
|
-
super(config, sessions);
|
|
3781
|
-
this.generation_config = generation_config;
|
|
3782
|
-
}
|
|
3783
|
-
}
|
|
3692
|
+
export class GPT2PreTrainedModel extends PreTrainedModel { }
|
|
3784
3693
|
|
|
3785
3694
|
export class GPT2Model extends GPT2PreTrainedModel { }
|
|
3786
3695
|
|
|
@@ -3795,18 +3704,7 @@ export class GPT2LMHeadModel extends GPT2PreTrainedModel { }
|
|
|
3795
3704
|
|
|
3796
3705
|
//////////////////////////////////////////////////
|
|
3797
3706
|
// JAIS models
|
|
3798
|
-
export class JAISPreTrainedModel extends PreTrainedModel {
|
|
3799
|
-
/**
|
|
3800
|
-
* Creates a new instance of the `JAISPreTrainedModel` class.
|
|
3801
|
-
* @param {Object} config The model configuration.
|
|
3802
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3803
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3804
|
-
*/
|
|
3805
|
-
constructor(config, sessions, generation_config) {
|
|
3806
|
-
super(config, sessions);
|
|
3807
|
-
this.generation_config = generation_config;
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3707
|
+
export class JAISPreTrainedModel extends PreTrainedModel { }
|
|
3810
3708
|
|
|
3811
3709
|
/**
|
|
3812
3710
|
* The bare JAIS Model transformer outputting raw hidden-states without any specific head on top.
|
|
@@ -3822,18 +3720,7 @@ export class JAISLMHeadModel extends JAISPreTrainedModel { }
|
|
|
3822
3720
|
|
|
3823
3721
|
//////////////////////////////////////////////////
|
|
3824
3722
|
// GPTNeo models
|
|
3825
|
-
export class GPTNeoPreTrainedModel extends PreTrainedModel {
|
|
3826
|
-
/**
|
|
3827
|
-
* Creates a new instance of the `GPTNeoPreTrainedModel` class.
|
|
3828
|
-
* @param {Object} config The model configuration.
|
|
3829
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3830
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3831
|
-
*/
|
|
3832
|
-
constructor(config, sessions, generation_config) {
|
|
3833
|
-
super(config, sessions);
|
|
3834
|
-
this.generation_config = generation_config;
|
|
3835
|
-
}
|
|
3836
|
-
}
|
|
3723
|
+
export class GPTNeoPreTrainedModel extends PreTrainedModel { }
|
|
3837
3724
|
export class GPTNeoModel extends GPTNeoPreTrainedModel { }
|
|
3838
3725
|
|
|
3839
3726
|
export class GPTNeoForCausalLM extends GPTNeoPreTrainedModel { }
|
|
@@ -3841,18 +3728,7 @@ export class GPTNeoForCausalLM extends GPTNeoPreTrainedModel { }
|
|
|
3841
3728
|
|
|
3842
3729
|
//////////////////////////////////////////////////
|
|
3843
3730
|
// GPTNeoX models
|
|
3844
|
-
export class GPTNeoXPreTrainedModel extends PreTrainedModel {
|
|
3845
|
-
/**
|
|
3846
|
-
* Creates a new instance of the `GPTNeoXPreTrainedModel` class.
|
|
3847
|
-
* @param {Object} config The model configuration.
|
|
3848
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3849
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3850
|
-
*/
|
|
3851
|
-
constructor(config, sessions, generation_config) {
|
|
3852
|
-
super(config, sessions);
|
|
3853
|
-
this.generation_config = generation_config;
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3731
|
+
export class GPTNeoXPreTrainedModel extends PreTrainedModel { }
|
|
3856
3732
|
export class GPTNeoXModel extends GPTNeoXPreTrainedModel { }
|
|
3857
3733
|
|
|
3858
3734
|
export class GPTNeoXForCausalLM extends GPTNeoXPreTrainedModel { }
|
|
@@ -3861,18 +3737,7 @@ export class GPTNeoXForCausalLM extends GPTNeoXPreTrainedModel { }
|
|
|
3861
3737
|
|
|
3862
3738
|
//////////////////////////////////////////////////
|
|
3863
3739
|
// GPT-J models
|
|
3864
|
-
export class GPTJPreTrainedModel extends PreTrainedModel {
|
|
3865
|
-
/**
|
|
3866
|
-
* Creates a new instance of the `GPTJPreTrainedModel` class.
|
|
3867
|
-
* @param {Object} config The model configuration.
|
|
3868
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3869
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3870
|
-
*/
|
|
3871
|
-
constructor(config, sessions, generation_config) {
|
|
3872
|
-
super(config, sessions);
|
|
3873
|
-
this.generation_config = generation_config;
|
|
3874
|
-
}
|
|
3875
|
-
}
|
|
3740
|
+
export class GPTJPreTrainedModel extends PreTrainedModel { }
|
|
3876
3741
|
|
|
3877
3742
|
export class GPTJModel extends GPTJPreTrainedModel { }
|
|
3878
3743
|
|
|
@@ -3882,18 +3747,7 @@ export class GPTJForCausalLM extends GPTJPreTrainedModel { }
|
|
|
3882
3747
|
|
|
3883
3748
|
//////////////////////////////////////////////////
|
|
3884
3749
|
// GPTBigCode models
|
|
3885
|
-
export class GPTBigCodePreTrainedModel extends PreTrainedModel {
|
|
3886
|
-
/**
|
|
3887
|
-
* Creates a new instance of the `GPTBigCodePreTrainedModel` class.
|
|
3888
|
-
* @param {Object} config The model configuration.
|
|
3889
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3890
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3891
|
-
*/
|
|
3892
|
-
constructor(config, sessions, generation_config) {
|
|
3893
|
-
super(config, sessions);
|
|
3894
|
-
this.generation_config = generation_config;
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3750
|
+
export class GPTBigCodePreTrainedModel extends PreTrainedModel { }
|
|
3897
3751
|
|
|
3898
3752
|
export class GPTBigCodeModel extends GPTBigCodePreTrainedModel { }
|
|
3899
3753
|
|
|
@@ -3902,18 +3756,7 @@ export class GPTBigCodeForCausalLM extends GPTBigCodePreTrainedModel { }
|
|
|
3902
3756
|
|
|
3903
3757
|
//////////////////////////////////////////////////
|
|
3904
3758
|
// CodeGen models
|
|
3905
|
-
export class CodeGenPreTrainedModel extends PreTrainedModel {
|
|
3906
|
-
/**
|
|
3907
|
-
* Creates a new instance of the `CodeGenPreTrainedModel` class.
|
|
3908
|
-
* @param {Object} config The model configuration.
|
|
3909
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3910
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3911
|
-
*/
|
|
3912
|
-
constructor(config, sessions, generation_config) {
|
|
3913
|
-
super(config, sessions);
|
|
3914
|
-
this.generation_config = generation_config;
|
|
3915
|
-
}
|
|
3916
|
-
}
|
|
3759
|
+
export class CodeGenPreTrainedModel extends PreTrainedModel { }
|
|
3917
3760
|
/**
|
|
3918
3761
|
* CodeGenModel is a class representing a code generation model without a language model head.
|
|
3919
3762
|
*/
|
|
@@ -3932,18 +3775,7 @@ export class CodeGenForCausalLM extends CodeGenPreTrainedModel { }
|
|
|
3932
3775
|
/**
|
|
3933
3776
|
* The bare LLama Model outputting raw hidden-states without any specific head on top.
|
|
3934
3777
|
*/
|
|
3935
|
-
export class LlamaPreTrainedModel extends PreTrainedModel {
|
|
3936
|
-
/**
|
|
3937
|
-
* Creates a new instance of the `LlamaPreTrainedModel` class.
|
|
3938
|
-
* @param {Object} config The model configuration.
|
|
3939
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3940
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3941
|
-
*/
|
|
3942
|
-
constructor(config, sessions, generation_config) {
|
|
3943
|
-
super(config, sessions);
|
|
3944
|
-
this.generation_config = generation_config;
|
|
3945
|
-
}
|
|
3946
|
-
}
|
|
3778
|
+
export class LlamaPreTrainedModel extends PreTrainedModel { }
|
|
3947
3779
|
/**
|
|
3948
3780
|
* The bare LLaMA Model outputting raw hidden-states without any specific head on top.
|
|
3949
3781
|
*/
|
|
@@ -3952,24 +3784,22 @@ export class LlamaModel extends LlamaPreTrainedModel { }
|
|
|
3952
3784
|
export class LlamaForCausalLM extends LlamaPreTrainedModel { }
|
|
3953
3785
|
//////////////////////////////////////////////////
|
|
3954
3786
|
|
|
3787
|
+
|
|
3788
|
+
//////////////////////////////////////////////////
|
|
3789
|
+
// Granite models
|
|
3790
|
+
export class GranitePreTrainedModel extends PreTrainedModel { }
|
|
3791
|
+
export class GraniteModel extends GranitePreTrainedModel { }
|
|
3792
|
+
export class GraniteForCausalLM extends GranitePreTrainedModel { }
|
|
3793
|
+
//////////////////////////////////////////////////
|
|
3794
|
+
|
|
3795
|
+
|
|
3955
3796
|
//////////////////////////////////////////////////
|
|
3956
3797
|
// Cohere models
|
|
3957
3798
|
|
|
3958
3799
|
/**
|
|
3959
3800
|
* The bare Cohere Model outputting raw hidden-states without any specific head on top.
|
|
3960
3801
|
*/
|
|
3961
|
-
export class CoherePreTrainedModel extends PreTrainedModel {
|
|
3962
|
-
/**
|
|
3963
|
-
* Creates a new instance of the `CoherePreTrainedModel` class.
|
|
3964
|
-
* @param {Object} config The model configuration.
|
|
3965
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3966
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3967
|
-
*/
|
|
3968
|
-
constructor(config, sessions, generation_config) {
|
|
3969
|
-
super(config, sessions);
|
|
3970
|
-
this.generation_config = generation_config;
|
|
3971
|
-
}
|
|
3972
|
-
}
|
|
3802
|
+
export class CoherePreTrainedModel extends PreTrainedModel { }
|
|
3973
3803
|
export class CohereModel extends CoherePreTrainedModel { }
|
|
3974
3804
|
|
|
3975
3805
|
export class CohereForCausalLM extends CoherePreTrainedModel { }
|
|
@@ -3981,18 +3811,7 @@ export class CohereForCausalLM extends CoherePreTrainedModel { }
|
|
|
3981
3811
|
/**
|
|
3982
3812
|
* The bare Gemma Model outputting raw hidden-states without any specific head on top.
|
|
3983
3813
|
*/
|
|
3984
|
-
export class GemmaPreTrainedModel extends PreTrainedModel {
|
|
3985
|
-
/**
|
|
3986
|
-
* Creates a new instance of the `GemmaPreTrainedModel` class.
|
|
3987
|
-
* @param {Object} config The model configuration.
|
|
3988
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
3989
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
3990
|
-
*/
|
|
3991
|
-
constructor(config, sessions, generation_config) {
|
|
3992
|
-
super(config, sessions);
|
|
3993
|
-
this.generation_config = generation_config;
|
|
3994
|
-
}
|
|
3995
|
-
}
|
|
3814
|
+
export class GemmaPreTrainedModel extends PreTrainedModel { }
|
|
3996
3815
|
/**
|
|
3997
3816
|
* The bare Gemma Model outputting raw hidden-states without any specific head on top.
|
|
3998
3817
|
*/
|
|
@@ -4007,18 +3826,7 @@ export class GemmaForCausalLM extends GemmaPreTrainedModel { }
|
|
|
4007
3826
|
/**
|
|
4008
3827
|
* The bare Gemma2 Model outputting raw hidden-states without any specific head on top.
|
|
4009
3828
|
*/
|
|
4010
|
-
export class Gemma2PreTrainedModel extends PreTrainedModel {
|
|
4011
|
-
/**
|
|
4012
|
-
* Creates a new instance of the `Gemma2PreTrainedModel` class.
|
|
4013
|
-
* @param {Object} config The model configuration.
|
|
4014
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4015
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4016
|
-
*/
|
|
4017
|
-
constructor(config, sessions, generation_config) {
|
|
4018
|
-
super(config, sessions);
|
|
4019
|
-
this.generation_config = generation_config;
|
|
4020
|
-
}
|
|
4021
|
-
}
|
|
3829
|
+
export class Gemma2PreTrainedModel extends PreTrainedModel { }
|
|
4022
3830
|
/**
|
|
4023
3831
|
* The bare Gemma2 Model outputting raw hidden-states without any specific head on top.
|
|
4024
3832
|
*/
|
|
@@ -4028,18 +3836,7 @@ export class Gemma2ForCausalLM extends Gemma2PreTrainedModel { }
|
|
|
4028
3836
|
//////////////////////////////////////////////////
|
|
4029
3837
|
|
|
4030
3838
|
//////////////////////////////////////////////////
|
|
4031
|
-
export class OpenELMPreTrainedModel extends PreTrainedModel {
|
|
4032
|
-
/**
|
|
4033
|
-
* Creates a new instance of the `OpenELMPreTrainedModel` class.
|
|
4034
|
-
* @param {Object} config The model configuration.
|
|
4035
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4036
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4037
|
-
*/
|
|
4038
|
-
constructor(config, sessions, generation_config) {
|
|
4039
|
-
super(config, sessions);
|
|
4040
|
-
this.generation_config = generation_config;
|
|
4041
|
-
}
|
|
4042
|
-
}
|
|
3839
|
+
export class OpenELMPreTrainedModel extends PreTrainedModel { }
|
|
4043
3840
|
export class OpenELMModel extends OpenELMPreTrainedModel { }
|
|
4044
3841
|
|
|
4045
3842
|
export class OpenELMForCausalLM extends OpenELMPreTrainedModel { }
|
|
@@ -4051,18 +3848,7 @@ export class OpenELMForCausalLM extends OpenELMPreTrainedModel { }
|
|
|
4051
3848
|
/**
|
|
4052
3849
|
* The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
|
|
4053
3850
|
*/
|
|
4054
|
-
export class Qwen2PreTrainedModel extends PreTrainedModel {
|
|
4055
|
-
/**
|
|
4056
|
-
* Creates a new instance of the `Qwen2PreTrainedModel` class.
|
|
4057
|
-
* @param {Object} config The model configuration.
|
|
4058
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4059
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4060
|
-
*/
|
|
4061
|
-
constructor(config, sessions, generation_config) {
|
|
4062
|
-
super(config, sessions);
|
|
4063
|
-
this.generation_config = generation_config;
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
3851
|
+
export class Qwen2PreTrainedModel extends PreTrainedModel { }
|
|
4066
3852
|
/**
|
|
4067
3853
|
* The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
|
|
4068
3854
|
*/
|
|
@@ -4074,18 +3860,7 @@ export class Qwen2ForCausalLM extends Qwen2PreTrainedModel { }
|
|
|
4074
3860
|
|
|
4075
3861
|
//////////////////////////////////////////////////
|
|
4076
3862
|
// Phi models
|
|
4077
|
-
export class PhiPreTrainedModel extends PreTrainedModel {
|
|
4078
|
-
/**
|
|
4079
|
-
* Creates a new instance of the `PhiPreTrainedModel` class.
|
|
4080
|
-
* @param {Object} config The model configuration.
|
|
4081
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4082
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4083
|
-
*/
|
|
4084
|
-
constructor(config, sessions, generation_config) {
|
|
4085
|
-
super(config, sessions);
|
|
4086
|
-
this.generation_config = generation_config;
|
|
4087
|
-
}
|
|
4088
|
-
}
|
|
3863
|
+
export class PhiPreTrainedModel extends PreTrainedModel { }
|
|
4089
3864
|
/**
|
|
4090
3865
|
* The bare Phi Model outputting raw hidden-states without any specific head on top.
|
|
4091
3866
|
*/
|
|
@@ -4096,18 +3871,7 @@ export class PhiForCausalLM extends PhiPreTrainedModel { }
|
|
|
4096
3871
|
|
|
4097
3872
|
//////////////////////////////////////////////////
|
|
4098
3873
|
// Phi3 models
|
|
4099
|
-
export class Phi3PreTrainedModel extends PreTrainedModel {
|
|
4100
|
-
/**
|
|
4101
|
-
* Creates a new instance of the `Phi3PreTrainedModel` class.
|
|
4102
|
-
* @param {Object} config The model configuration.
|
|
4103
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4104
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4105
|
-
*/
|
|
4106
|
-
constructor(config, sessions, generation_config) {
|
|
4107
|
-
super(config, sessions);
|
|
4108
|
-
this.generation_config = generation_config;
|
|
4109
|
-
}
|
|
4110
|
-
}
|
|
3874
|
+
export class Phi3PreTrainedModel extends PreTrainedModel { }
|
|
4111
3875
|
|
|
4112
3876
|
/**
|
|
4113
3877
|
* The bare Phi3 Model outputting raw hidden-states without any specific head on top.
|
|
@@ -4123,18 +3887,7 @@ export class Phi3ForCausalLM extends Phi3PreTrainedModel { }
|
|
|
4123
3887
|
/**
|
|
4124
3888
|
* The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
|
|
4125
3889
|
*/
|
|
4126
|
-
export class BloomPreTrainedModel extends PreTrainedModel {
|
|
4127
|
-
/**
|
|
4128
|
-
* Creates a new instance of the `BloomPreTrainedModel` class.
|
|
4129
|
-
* @param {Object} config The model configuration.
|
|
4130
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4131
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4132
|
-
*/
|
|
4133
|
-
constructor(config, sessions, generation_config) {
|
|
4134
|
-
super(config, sessions);
|
|
4135
|
-
this.generation_config = generation_config;
|
|
4136
|
-
}
|
|
4137
|
-
}
|
|
3890
|
+
export class BloomPreTrainedModel extends PreTrainedModel { }
|
|
4138
3891
|
|
|
4139
3892
|
/**
|
|
4140
3893
|
* The bare Bloom Model transformer outputting raw hidden-states without any specific head on top.
|
|
@@ -4149,18 +3902,7 @@ export class BloomForCausalLM extends BloomPreTrainedModel { }
|
|
|
4149
3902
|
|
|
4150
3903
|
//////////////////////////////////////////////////
|
|
4151
3904
|
// MPT models
|
|
4152
|
-
export class MptPreTrainedModel extends PreTrainedModel {
|
|
4153
|
-
/**
|
|
4154
|
-
* Creates a new instance of the `MptPreTrainedModel` class.
|
|
4155
|
-
* @param {Object} config The model configuration.
|
|
4156
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4157
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4158
|
-
*/
|
|
4159
|
-
constructor(config, sessions, generation_config) {
|
|
4160
|
-
super(config, sessions);
|
|
4161
|
-
this.generation_config = generation_config;
|
|
4162
|
-
}
|
|
4163
|
-
}
|
|
3905
|
+
export class MptPreTrainedModel extends PreTrainedModel { }
|
|
4164
3906
|
|
|
4165
3907
|
/**
|
|
4166
3908
|
* The bare Mpt Model transformer outputting raw hidden-states without any specific head on top.
|
|
@@ -4176,18 +3918,7 @@ export class MptForCausalLM extends MptPreTrainedModel { }
|
|
|
4176
3918
|
|
|
4177
3919
|
//////////////////////////////////////////////////
|
|
4178
3920
|
// OPT models
|
|
4179
|
-
export class OPTPreTrainedModel extends PreTrainedModel {
|
|
4180
|
-
/**
|
|
4181
|
-
* Creates a new instance of the `OPTPreTrainedModel` class.
|
|
4182
|
-
* @param {Object} config The model configuration.
|
|
4183
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
4184
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
4185
|
-
*/
|
|
4186
|
-
constructor(config, sessions, generation_config) {
|
|
4187
|
-
super(config, sessions);
|
|
4188
|
-
this.generation_config = generation_config;
|
|
4189
|
-
}
|
|
4190
|
-
}
|
|
3921
|
+
export class OPTPreTrainedModel extends PreTrainedModel { }
|
|
4191
3922
|
|
|
4192
3923
|
/**
|
|
4193
3924
|
* The bare OPT Model outputting raw hidden-states without any specific head on top.
|
|
@@ -5049,19 +4780,7 @@ export class SamImageSegmentationOutput extends ModelOutput {
|
|
|
5049
4780
|
|
|
5050
4781
|
//////////////////////////////////////////////////
|
|
5051
4782
|
// MarianMT models
|
|
5052
|
-
export class MarianPreTrainedModel extends PreTrainedModel {
|
|
5053
|
-
|
|
5054
|
-
/**
|
|
5055
|
-
* Creates a new instance of the `MarianMTModel` class.
|
|
5056
|
-
* @param {Object} config The model configuration.
|
|
5057
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
5058
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5059
|
-
*/
|
|
5060
|
-
constructor(config, sessions, generation_config) {
|
|
5061
|
-
super(config, sessions);
|
|
5062
|
-
this.generation_config = generation_config;
|
|
5063
|
-
}
|
|
5064
|
-
};
|
|
4783
|
+
export class MarianPreTrainedModel extends PreTrainedModel { };
|
|
5065
4784
|
|
|
5066
4785
|
export class MarianModel extends MarianPreTrainedModel { }
|
|
5067
4786
|
|
|
@@ -5070,19 +4789,7 @@ export class MarianMTModel extends MarianPreTrainedModel { }
|
|
|
5070
4789
|
|
|
5071
4790
|
//////////////////////////////////////////////////
|
|
5072
4791
|
// M2M100 models
|
|
5073
|
-
export class M2M100PreTrainedModel extends PreTrainedModel {
|
|
5074
|
-
|
|
5075
|
-
/**
|
|
5076
|
-
* Creates a new instance of the `M2M100ForConditionalGeneration` class.
|
|
5077
|
-
* @param {Object} config The model configuration.
|
|
5078
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
5079
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5080
|
-
*/
|
|
5081
|
-
constructor(config, sessions, generation_config) {
|
|
5082
|
-
super(config, sessions);
|
|
5083
|
-
this.generation_config = generation_config;
|
|
5084
|
-
}
|
|
5085
|
-
};
|
|
4792
|
+
export class M2M100PreTrainedModel extends PreTrainedModel { };
|
|
5086
4793
|
|
|
5087
4794
|
export class M2M100Model extends M2M100PreTrainedModel { }
|
|
5088
4795
|
|
|
@@ -5592,19 +5299,7 @@ export class WavLMForAudioFrameClassification extends WavLMPreTrainedModel {
|
|
|
5592
5299
|
/**
|
|
5593
5300
|
* An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
|
|
5594
5301
|
*/
|
|
5595
|
-
export class SpeechT5PreTrainedModel extends PreTrainedModel {
|
|
5596
|
-
|
|
5597
|
-
/**
|
|
5598
|
-
* Creates a new instance of the `SpeechT5ForTextToSpeech` class.
|
|
5599
|
-
* @param {Object} config The model configuration.
|
|
5600
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
5601
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5602
|
-
*/
|
|
5603
|
-
constructor(config, sessions, generation_config) {
|
|
5604
|
-
super(config, sessions);
|
|
5605
|
-
this.generation_config = generation_config;
|
|
5606
|
-
}
|
|
5607
|
-
};
|
|
5302
|
+
export class SpeechT5PreTrainedModel extends PreTrainedModel { };
|
|
5608
5303
|
|
|
5609
5304
|
/**
|
|
5610
5305
|
* The bare SpeechT5 Encoder-Decoder Model outputting raw hidden-states without any specific pre- or post-nets.
|
|
@@ -5765,18 +5460,7 @@ export class SpeechT5HifiGan extends PreTrainedModel {
|
|
|
5765
5460
|
|
|
5766
5461
|
//////////////////////////////////////////////////
|
|
5767
5462
|
// TrOCR models
|
|
5768
|
-
export class TrOCRPreTrainedModel extends PreTrainedModel {
|
|
5769
|
-
/**
|
|
5770
|
-
* Creates a new instance of the `TrOCRPreTrainedModel` class.
|
|
5771
|
-
* @param {Object} config The configuration of the model.
|
|
5772
|
-
* @param {any} session The ONNX session containing the model weights.
|
|
5773
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5774
|
-
*/
|
|
5775
|
-
constructor(config, session, generation_config) {
|
|
5776
|
-
super(config, session);
|
|
5777
|
-
this.generation_config = generation_config;
|
|
5778
|
-
}
|
|
5779
|
-
}
|
|
5463
|
+
export class TrOCRPreTrainedModel extends PreTrainedModel { }
|
|
5780
5464
|
|
|
5781
5465
|
/**
|
|
5782
5466
|
* The TrOCR Decoder with a language modeling head.
|
|
@@ -5791,18 +5475,7 @@ export class TrOCRForCausalLM extends TrOCRPreTrainedModel { }
|
|
|
5791
5475
|
/**
|
|
5792
5476
|
* The bare Mistral Model outputting raw hidden-states without any specific head on top.
|
|
5793
5477
|
*/
|
|
5794
|
-
export class MistralPreTrainedModel extends PreTrainedModel {
|
|
5795
|
-
/**
|
|
5796
|
-
* Creates a new instance of the `MistralPreTrainedModel` class.
|
|
5797
|
-
* @param {Object} config The configuration of the model.
|
|
5798
|
-
* @param {any} session The ONNX session containing the model weights.
|
|
5799
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5800
|
-
*/
|
|
5801
|
-
constructor(config, session, generation_config) {
|
|
5802
|
-
super(config, session);
|
|
5803
|
-
this.generation_config = generation_config;
|
|
5804
|
-
}
|
|
5805
|
-
}
|
|
5478
|
+
export class MistralPreTrainedModel extends PreTrainedModel { }
|
|
5806
5479
|
|
|
5807
5480
|
export class MistralModel extends MistralPreTrainedModel { }
|
|
5808
5481
|
|
|
@@ -5815,18 +5488,7 @@ export class MistralForCausalLM extends MistralPreTrainedModel { }
|
|
|
5815
5488
|
/**
|
|
5816
5489
|
* The bare Starcoder2 Model outputting raw hidden-states without any specific head on top.
|
|
5817
5490
|
*/
|
|
5818
|
-
export class Starcoder2PreTrainedModel extends PreTrainedModel {
|
|
5819
|
-
/**
|
|
5820
|
-
* Creates a new instance of the `Starcoder2PreTrainedModel` class.
|
|
5821
|
-
* @param {Object} config The configuration of the model.
|
|
5822
|
-
* @param {any} session The ONNX session containing the model weights.
|
|
5823
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5824
|
-
*/
|
|
5825
|
-
constructor(config, session, generation_config) {
|
|
5826
|
-
super(config, session);
|
|
5827
|
-
this.generation_config = generation_config;
|
|
5828
|
-
}
|
|
5829
|
-
}
|
|
5491
|
+
export class Starcoder2PreTrainedModel extends PreTrainedModel { }
|
|
5830
5492
|
|
|
5831
5493
|
export class Starcoder2Model extends Starcoder2PreTrainedModel { }
|
|
5832
5494
|
|
|
@@ -5839,18 +5501,7 @@ export class Starcoder2ForCausalLM extends Starcoder2PreTrainedModel { }
|
|
|
5839
5501
|
/**
|
|
5840
5502
|
* The bare Falcon Model outputting raw hidden-states without any specific head on top.
|
|
5841
5503
|
*/
|
|
5842
|
-
export class FalconPreTrainedModel extends PreTrainedModel {
|
|
5843
|
-
/**
|
|
5844
|
-
* Creates a new instance of the `FalconPreTrainedModel` class.
|
|
5845
|
-
* @param {Object} config The configuration of the model.
|
|
5846
|
-
* @param {any} session The ONNX session containing the model weights.
|
|
5847
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
5848
|
-
*/
|
|
5849
|
-
constructor(config, session, generation_config) {
|
|
5850
|
-
super(config, session);
|
|
5851
|
-
this.generation_config = generation_config;
|
|
5852
|
-
}
|
|
5853
|
-
}
|
|
5504
|
+
export class FalconPreTrainedModel extends PreTrainedModel { }
|
|
5854
5505
|
|
|
5855
5506
|
export class FalconModel extends FalconPreTrainedModel { }
|
|
5856
5507
|
|
|
@@ -6000,18 +5651,7 @@ export class SegformerForSemanticSegmentation extends SegformerPreTrainedModel {
|
|
|
6000
5651
|
|
|
6001
5652
|
//////////////////////////////////////////////////
|
|
6002
5653
|
// StableLm models
|
|
6003
|
-
export class StableLmPreTrainedModel extends PreTrainedModel {
|
|
6004
|
-
/**
|
|
6005
|
-
* Creates a new instance of the `StableLmPreTrainedModel` class.
|
|
6006
|
-
* @param {Object} config The configuration of the model.
|
|
6007
|
-
* @param {any} session The ONNX session containing the model weights.
|
|
6008
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
6009
|
-
*/
|
|
6010
|
-
constructor(config, session, generation_config) {
|
|
6011
|
-
super(config, session);
|
|
6012
|
-
this.generation_config = generation_config;
|
|
6013
|
-
}
|
|
6014
|
-
}
|
|
5654
|
+
export class StableLmPreTrainedModel extends PreTrainedModel { }
|
|
6015
5655
|
|
|
6016
5656
|
/**
|
|
6017
5657
|
* The bare StableLm Model transformer outputting raw hidden-states without any specific head on top.
|
|
@@ -6105,17 +5745,6 @@ export class MusicgenForConditionalGeneration extends PreTrainedModel { // NOTE:
|
|
|
6105
5745
|
'past_key_values',
|
|
6106
5746
|
];
|
|
6107
5747
|
|
|
6108
|
-
/**
|
|
6109
|
-
* Creates a new instance of the `MusicgenForConditionalGeneration` class.
|
|
6110
|
-
* @param {Object} config The model configuration.
|
|
6111
|
-
* @param {Record<string, any>} sessions The inference sessions for the model.
|
|
6112
|
-
* @param {GenerationConfig} generation_config The generation configuration.
|
|
6113
|
-
*/
|
|
6114
|
-
constructor(config, sessions, generation_config) {
|
|
6115
|
-
super(config, sessions);
|
|
6116
|
-
this.generation_config = generation_config;
|
|
6117
|
-
}
|
|
6118
|
-
|
|
6119
5748
|
/**
|
|
6120
5749
|
* Apply the pattern mask to the final ids,
|
|
6121
5750
|
* then revert the pattern delay mask by filtering the pad token id in a single step.
|
|
@@ -6471,6 +6100,7 @@ const MODEL_MAPPING_NAMES_DECODER_ONLY = new Map([
|
|
|
6471
6100
|
['gpt_neox', ['GPTNeoXModel', GPTNeoXModel]],
|
|
6472
6101
|
['codegen', ['CodeGenModel', CodeGenModel]],
|
|
6473
6102
|
['llama', ['LlamaModel', LlamaModel]],
|
|
6103
|
+
['granite', ['GraniteModel', GraniteModel]],
|
|
6474
6104
|
['cohere', ['CohereModel', CohereModel]],
|
|
6475
6105
|
['gemma', ['GemmaModel', GemmaModel]],
|
|
6476
6106
|
['gemma2', ['Gemma2Model', Gemma2Model]],
|
|
@@ -6559,6 +6189,7 @@ const MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = new Map([
|
|
|
6559
6189
|
['gpt_neox', ['GPTNeoXForCausalLM', GPTNeoXForCausalLM]],
|
|
6560
6190
|
['codegen', ['CodeGenForCausalLM', CodeGenForCausalLM]],
|
|
6561
6191
|
['llama', ['LlamaForCausalLM', LlamaForCausalLM]],
|
|
6192
|
+
['granite', ['GraniteForCausalLM', GraniteForCausalLM]],
|
|
6562
6193
|
['cohere', ['CohereForCausalLM', CohereForCausalLM]],
|
|
6563
6194
|
['gemma', ['GemmaForCausalLM', GemmaForCausalLM]],
|
|
6564
6195
|
['gemma2', ['Gemma2ForCausalLM', Gemma2ForCausalLM]],
|