@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.
@@ -4128,6 +4128,7 @@ function getNormalizedConfig(config) {
4128
4128
  mapping['hidden_size'] = 'hidden_size';
4129
4129
  break;
4130
4130
  case 'llama':
4131
+ case 'granite':
4131
4132
  case 'cohere':
4132
4133
  case 'mistral':
4133
4134
  case 'starcoder2':
@@ -4456,7 +4457,7 @@ __webpack_require__.r(__webpack_exports__);
4456
4457
 
4457
4458
 
4458
4459
 
4459
- const VERSION = '3.0.0-alpha.20';
4460
+ const VERSION = '3.0.0-alpha.21';
4460
4461
 
4461
4462
  // Check if various APIs are available (depends on environment)
4462
4463
  const IS_BROWSER_ENV = typeof self !== 'undefined';
@@ -6556,6 +6557,9 @@ __webpack_require__.r(__webpack_exports__);
6556
6557
  /* harmony export */ GemmaForCausalLM: () => (/* binding */ GemmaForCausalLM),
6557
6558
  /* harmony export */ GemmaModel: () => (/* binding */ GemmaModel),
6558
6559
  /* harmony export */ GemmaPreTrainedModel: () => (/* binding */ GemmaPreTrainedModel),
6560
+ /* harmony export */ GraniteForCausalLM: () => (/* binding */ GraniteForCausalLM),
6561
+ /* harmony export */ GraniteModel: () => (/* binding */ GraniteModel),
6562
+ /* harmony export */ GranitePreTrainedModel: () => (/* binding */ GranitePreTrainedModel),
6559
6563
  /* harmony export */ GroupViTModel: () => (/* binding */ GroupViTModel),
6560
6564
  /* harmony export */ GroupViTPreTrainedModel: () => (/* binding */ GroupViTPreTrainedModel),
6561
6565
  /* harmony export */ HieraForImageClassification: () => (/* binding */ HieraForImageClassification),
@@ -7044,6 +7048,23 @@ async function constructSessions(pretrained_model_name_or_path, names, options)
7044
7048
  ));
7045
7049
  }
7046
7050
 
7051
+ /**
7052
+ * Helper function to load multiple optional configuration files
7053
+ * @param {string} pretrained_model_name_or_path The path to the directory containing the config file.
7054
+ * @param {Record<string, string>} names The names of the config files to load.
7055
+ * @param {import('./utils/hub.js').PretrainedModelOptions} options Additional options for loading the configs.
7056
+ * @returns {Promise<Record<string, any>>} A Promise that resolves to a dictionary of configuration objects.
7057
+ * @private
7058
+ */
7059
+ async function getOptionalConfigs(pretrained_model_name_or_path, names, options) {
7060
+ return Object.fromEntries(await Promise.all(
7061
+ Object.keys(names).map(async (name) => {
7062
+ const config = await (0,_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelJSON)(pretrained_model_name_or_path, names[name], false, options);
7063
+ return [name, config];
7064
+ })
7065
+ ));
7066
+ }
7067
+
7047
7068
  /**
7048
7069
  * Validate model inputs
7049
7070
  * @param {Object} session The InferenceSession object that will be run.
@@ -7455,12 +7476,14 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7455
7476
  * Creates a new instance of the `PreTrainedModel` class.
7456
7477
  * @param {import('./configs.js').PretrainedConfig} config The model configuration.
7457
7478
  * @param {Record<string, any>} sessions The inference sessions for the model.
7479
+ * @param {Record<string, Object>} configs Additional configuration files (e.g., generation_config.json).
7458
7480
  */
7459
- constructor(config, sessions) {
7481
+ constructor(config, sessions, configs) {
7460
7482
  super();
7461
7483
 
7462
7484
  this.config = config;
7463
7485
  this.sessions = sessions;
7486
+ this.configs = configs;
7464
7487
 
7465
7488
  const modelName = MODEL_CLASS_TO_NAME_MAPPING.get(this.constructor);
7466
7489
  const modelType = MODEL_TYPE_MAPPING.get(modelName);
@@ -7576,7 +7599,9 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7576
7599
  constructSessions(pretrained_model_name_or_path, {
7577
7600
  model: options.model_file_name ?? 'model',
7578
7601
  }, options),
7579
- (0,_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelJSON)(pretrained_model_name_or_path, 'generation_config.json', false, options),
7602
+ getOptionalConfigs(pretrained_model_name_or_path, {
7603
+ generation_config: 'generation_config.json',
7604
+ }, options),
7580
7605
  ]);
7581
7606
 
7582
7607
  } else if (modelType === MODEL_TYPES.Seq2Seq || modelType === MODEL_TYPES.Vision2Seq) {
@@ -7585,7 +7610,9 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7585
7610
  model: 'encoder_model',
7586
7611
  decoder_model_merged: 'decoder_model_merged',
7587
7612
  }, options),
7588
- (0,_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelJSON)(pretrained_model_name_or_path, 'generation_config.json', false, options),
7613
+ getOptionalConfigs(pretrained_model_name_or_path, {
7614
+ generation_config: 'generation_config.json',
7615
+ }, options),
7589
7616
  ]);
7590
7617
 
7591
7618
  } else if (modelType === MODEL_TYPES.MaskGeneration) {
@@ -7615,7 +7642,9 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7615
7642
  }
7616
7643
  info = await Promise.all([
7617
7644
  constructSessions(pretrained_model_name_or_path, sessions, options),
7618
- (0,_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelJSON)(pretrained_model_name_or_path, 'generation_config.json', false, options),
7645
+ getOptionalConfigs(pretrained_model_name_or_path, {
7646
+ generation_config: 'generation_config.json',
7647
+ }, options),
7619
7648
  ]);
7620
7649
 
7621
7650
  } else if (modelType === MODEL_TYPES.Musicgen) {
@@ -7625,7 +7654,9 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7625
7654
  decoder_model_merged: 'decoder_model_merged',
7626
7655
  encodec_decode: 'encodec_decode',
7627
7656
  }, options),
7628
- (0,_utils_hub_js__WEBPACK_IMPORTED_MODULE_5__.getModelJSON)(pretrained_model_name_or_path, 'generation_config.json', false, options),
7657
+ getOptionalConfigs(pretrained_model_name_or_path, {
7658
+ generation_config: 'generation_config.json',
7659
+ }, options),
7629
7660
  ]);
7630
7661
 
7631
7662
  } else { // should be MODEL_TYPES.EncoderOnly
@@ -7663,6 +7694,14 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7663
7694
  return await this._forward(this, model_inputs);
7664
7695
  }
7665
7696
 
7697
+ /**
7698
+ * Get the model's generation config, if it exists.
7699
+ * @returns {GenerationConfig|null} The model's generation config if it exists, otherwise `null`.
7700
+ */
7701
+ get generation_config() {
7702
+ return this.configs?.generation_config ?? null;
7703
+ }
7704
+
7666
7705
  /**
7667
7706
  * This function returns a [`LogitsProcessorList`] list object that contains all relevant [`LogitsWarper`]
7668
7707
  * instances used for multinomial sampling.
@@ -7842,9 +7881,7 @@ class PreTrainedModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_3__.Cal
7842
7881
  const gen_config = new cls(config);
7843
7882
 
7844
7883
  // Apply model's generation config, if it exists
7845
- if ('generation_config' in this) {
7846
- Object.assign(gen_config, this.generation_config);
7847
- }
7884
+ Object.assign(gen_config, this.generation_config ?? {});
7848
7885
 
7849
7886
  // Next, use any generation config specified by the user
7850
7887
  // when calling `generate`
@@ -9257,17 +9294,6 @@ class T5PreTrainedModel extends PreTrainedModel {
9257
9294
  'decoder_attention_mask',
9258
9295
  'past_key_values',
9259
9296
  ];
9260
-
9261
- /**
9262
- * Creates a new instance of the `T5PreTrainedModel` class.
9263
- * @param {Object} config The model configuration.
9264
- * @param {Record<string, any>} sessions The inference sessions for the model.
9265
- * @param {GenerationConfig} generation_config The generation configuration.
9266
- */
9267
- constructor(config, sessions, generation_config) {
9268
- super(config, sessions);
9269
- this.generation_config = generation_config;
9270
- }
9271
9297
  };
9272
9298
 
9273
9299
  class T5Model extends T5PreTrainedModel { }
@@ -9284,18 +9310,7 @@ class T5ForConditionalGeneration extends T5PreTrainedModel { }
9284
9310
  /**
9285
9311
  * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
9286
9312
  */
9287
- class LongT5PreTrainedModel extends PreTrainedModel {
9288
- /**
9289
- * Creates a new instance of the `LongT5ForConditionalGeneration` class.
9290
- * @param {Object} config The model configuration.
9291
- * @param {Record<string, any>} sessions The inference sessions for the model.
9292
- * @param {GenerationConfig} generation_config The generation configuration.
9293
- */
9294
- constructor(config, sessions, generation_config) {
9295
- super(config, sessions);
9296
- this.generation_config = generation_config;
9297
- }
9298
- };
9313
+ class LongT5PreTrainedModel extends PreTrainedModel { };
9299
9314
 
9300
9315
  /**
9301
9316
  * The bare LONGT5 Model transformer outputting raw hidden-states without any specific head on top.
@@ -9311,19 +9326,7 @@ class LongT5ForConditionalGeneration extends LongT5PreTrainedModel { }
9311
9326
 
9312
9327
  //////////////////////////////////////////////////
9313
9328
  // MT5 models
9314
- class MT5PreTrainedModel extends PreTrainedModel {
9315
-
9316
- /**
9317
- * Creates a new instance of the `MT5ForConditionalGeneration` class.
9318
- * @param {Object} config The model configuration.
9319
- * @param {Record<string, any>} sessions The inference sessions for the model.
9320
- * @param {GenerationConfig} generation_config The generation configuration.
9321
- */
9322
- constructor(config, sessions, generation_config) {
9323
- super(config, sessions);
9324
- this.generation_config = generation_config;
9325
- }
9326
- };
9329
+ class MT5PreTrainedModel extends PreTrainedModel { };
9327
9330
 
9328
9331
  class MT5Model extends MT5PreTrainedModel { }
9329
9332
 
@@ -9335,19 +9338,7 @@ class MT5ForConditionalGeneration extends MT5PreTrainedModel { }
9335
9338
 
9336
9339
  //////////////////////////////////////////////////
9337
9340
  // Bart models
9338
- class BartPretrainedModel extends PreTrainedModel {
9339
-
9340
- /**
9341
- * Creates a new instance of the `BartForConditionalGeneration` class.
9342
- * @param {Object} config The model configuration.
9343
- * @param {Record<string, any>} sessions The inference sessions for the model.
9344
- * @param {GenerationConfig} generation_config The generation configuration.
9345
- */
9346
- constructor(config, sessions, generation_config) {
9347
- super(config, sessions);
9348
- this.generation_config = generation_config;
9349
- }
9350
- };
9341
+ class BartPretrainedModel extends PreTrainedModel { };
9351
9342
 
9352
9343
  /**
9353
9344
  * The bare BART Model outputting raw hidden-states without any specific head on top.
@@ -9378,19 +9369,7 @@ class BartForSequenceClassification extends BartPretrainedModel {
9378
9369
 
9379
9370
  //////////////////////////////////////////////////
9380
9371
  // MBart models
9381
- class MBartPreTrainedModel extends PreTrainedModel {
9382
-
9383
- /**
9384
- * Creates a new instance of the `MBartForConditionalGeneration` class.
9385
- * @param {Object} config The model configuration.
9386
- * @param {Record<string, any>} sessions The inference sessions for the model.
9387
- * @param {GenerationConfig} generation_config The generation configuration.
9388
- */
9389
- constructor(config, sessions, generation_config) {
9390
- super(config, sessions);
9391
- this.generation_config = generation_config;
9392
- }
9393
- };
9372
+ class MBartPreTrainedModel extends PreTrainedModel { };
9394
9373
 
9395
9374
  /**
9396
9375
  * The bare MBART Model outputting raw hidden-states without any specific head on top.
@@ -9424,19 +9403,7 @@ class MBartForCausalLM extends MBartPreTrainedModel { }
9424
9403
 
9425
9404
  //////////////////////////////////////////////////
9426
9405
  // Blenderbot models
9427
- class BlenderbotPreTrainedModel extends PreTrainedModel {
9428
-
9429
- /**
9430
- * Creates a new instance of the `BlenderbotForConditionalGeneration` class.
9431
- * @param {Object} config The model configuration.
9432
- * @param {Record<string, any>} sessions The inference sessions for the model.
9433
- * @param {GenerationConfig} generation_config The generation configuration.
9434
- */
9435
- constructor(config, sessions, generation_config) {
9436
- super(config, sessions);
9437
- this.generation_config = generation_config;
9438
- }
9439
- };
9406
+ class BlenderbotPreTrainedModel extends PreTrainedModel { };
9440
9407
 
9441
9408
  /**
9442
9409
  * The bare Blenderbot Model outputting raw hidden-states without any specific head on top.
@@ -9452,19 +9419,7 @@ class BlenderbotForConditionalGeneration extends BlenderbotPreTrainedModel { }
9452
9419
 
9453
9420
  //////////////////////////////////////////////////
9454
9421
  // Blenderbot models
9455
- class BlenderbotSmallPreTrainedModel extends PreTrainedModel {
9456
-
9457
- /**
9458
- * Creates a new instance of the `BlenderbotForConditionalGeneration` class.
9459
- * @param {Object} config The model configuration.
9460
- * @param {Record<string, any>} sessions The inference sessions for the model.
9461
- * @param {GenerationConfig} generation_config The generation configuration.
9462
- */
9463
- constructor(config, sessions, generation_config) {
9464
- super(config, sessions);
9465
- this.generation_config = generation_config;
9466
- }
9467
- };
9422
+ class BlenderbotSmallPreTrainedModel extends PreTrainedModel { };
9468
9423
 
9469
9424
  /**
9470
9425
  * The bare BlenderbotSmall Model outputting raw hidden-states without any specific head on top.
@@ -9713,17 +9668,6 @@ class WhisperPreTrainedModel extends PreTrainedModel {
9713
9668
  'decoder_attention_mask',
9714
9669
  'past_key_values',
9715
9670
  ];
9716
-
9717
- /**
9718
- * Creates a new instance of the `WhisperPreTrainedModel` class.
9719
- * @param {Object} config The model configuration.
9720
- * @param {Record<string, any>} sessions The inference sessions for the model.
9721
- * @param {GenerationConfig} generation_config The generation configuration.
9722
- */
9723
- constructor(config, sessions, generation_config) {
9724
- super(config, sessions);
9725
- this.generation_config = generation_config;
9726
- }
9727
9671
  };
9728
9672
 
9729
9673
  /**
@@ -9994,16 +9938,6 @@ class VisionEncoderDecoderModel extends PreTrainedModel {
9994
9938
  'encoder_hidden_states',
9995
9939
  'past_key_values',
9996
9940
  ];
9997
- /**
9998
- * Creates a new instance of the `VisionEncoderDecoderModel` class.
9999
- * @param {Object} config The model configuration.
10000
- * @param {Record<string, any>} sessions The inference sessions for the model.
10001
- * @param {GenerationConfig} generation_config The generation configuration.
10002
- */
10003
- constructor(config, sessions, generation_config) {
10004
- super(config, sessions);
10005
- this.generation_config = generation_config;
10006
- }
10007
9941
  }
10008
9942
  //////////////////////////////////////////////////
10009
9943
 
@@ -10018,11 +9952,6 @@ class LlavaPreTrainedModel extends PreTrainedModel {
10018
9952
  'position_ids',
10019
9953
  'past_key_values',
10020
9954
  ];
10021
-
10022
- constructor(config, sessions, generation_config) {
10023
- super(config, sessions);
10024
- this.generation_config = generation_config;
10025
- }
10026
9955
  }
10027
9956
 
10028
9957
  /**
@@ -10109,11 +10038,6 @@ class Florence2PreTrainedModel extends PreTrainedModel {
10109
10038
  'past_key_values',
10110
10039
  ];
10111
10040
  main_input_name = 'inputs_embeds';
10112
-
10113
- constructor(config, sessions, generation_config) {
10114
- super(config, sessions);
10115
- this.generation_config = generation_config;
10116
- }
10117
10041
  }
10118
10042
 
10119
10043
  class Florence2ForConditionalGeneration extends Florence2PreTrainedModel {
@@ -10533,18 +10457,7 @@ class CLIPSegForImageSegmentation extends CLIPSegPreTrainedModel { }
10533
10457
 
10534
10458
  //////////////////////////////////////////////////
10535
10459
  // GPT2 models
10536
- class GPT2PreTrainedModel extends PreTrainedModel {
10537
- /**
10538
- * Creates a new instance of the `GPT2PreTrainedModel` class.
10539
- * @param {Object} config The model configuration.
10540
- * @param {Record<string, any>} sessions The inference sessions for the model.
10541
- * @param {GenerationConfig} generation_config The generation configuration.
10542
- */
10543
- constructor(config, sessions, generation_config) {
10544
- super(config, sessions);
10545
- this.generation_config = generation_config;
10546
- }
10547
- }
10460
+ class GPT2PreTrainedModel extends PreTrainedModel { }
10548
10461
 
10549
10462
  class GPT2Model extends GPT2PreTrainedModel { }
10550
10463
 
@@ -10559,18 +10472,7 @@ class GPT2LMHeadModel extends GPT2PreTrainedModel { }
10559
10472
 
10560
10473
  //////////////////////////////////////////////////
10561
10474
  // JAIS models
10562
- class JAISPreTrainedModel extends PreTrainedModel {
10563
- /**
10564
- * Creates a new instance of the `JAISPreTrainedModel` class.
10565
- * @param {Object} config The model configuration.
10566
- * @param {Record<string, any>} sessions The inference sessions for the model.
10567
- * @param {GenerationConfig} generation_config The generation configuration.
10568
- */
10569
- constructor(config, sessions, generation_config) {
10570
- super(config, sessions);
10571
- this.generation_config = generation_config;
10572
- }
10573
- }
10475
+ class JAISPreTrainedModel extends PreTrainedModel { }
10574
10476
 
10575
10477
  /**
10576
10478
  * The bare JAIS Model transformer outputting raw hidden-states without any specific head on top.
@@ -10586,18 +10488,7 @@ class JAISLMHeadModel extends JAISPreTrainedModel { }
10586
10488
 
10587
10489
  //////////////////////////////////////////////////
10588
10490
  // GPTNeo models
10589
- class GPTNeoPreTrainedModel extends PreTrainedModel {
10590
- /**
10591
- * Creates a new instance of the `GPTNeoPreTrainedModel` class.
10592
- * @param {Object} config The model configuration.
10593
- * @param {Record<string, any>} sessions The inference sessions for the model.
10594
- * @param {GenerationConfig} generation_config The generation configuration.
10595
- */
10596
- constructor(config, sessions, generation_config) {
10597
- super(config, sessions);
10598
- this.generation_config = generation_config;
10599
- }
10600
- }
10491
+ class GPTNeoPreTrainedModel extends PreTrainedModel { }
10601
10492
  class GPTNeoModel extends GPTNeoPreTrainedModel { }
10602
10493
 
10603
10494
  class GPTNeoForCausalLM extends GPTNeoPreTrainedModel { }
@@ -10605,18 +10496,7 @@ class GPTNeoForCausalLM extends GPTNeoPreTrainedModel { }
10605
10496
 
10606
10497
  //////////////////////////////////////////////////
10607
10498
  // GPTNeoX models
10608
- class GPTNeoXPreTrainedModel extends PreTrainedModel {
10609
- /**
10610
- * Creates a new instance of the `GPTNeoXPreTrainedModel` class.
10611
- * @param {Object} config The model configuration.
10612
- * @param {Record<string, any>} sessions The inference sessions for the model.
10613
- * @param {GenerationConfig} generation_config The generation configuration.
10614
- */
10615
- constructor(config, sessions, generation_config) {
10616
- super(config, sessions);
10617
- this.generation_config = generation_config;
10618
- }
10619
- }
10499
+ class GPTNeoXPreTrainedModel extends PreTrainedModel { }
10620
10500
  class GPTNeoXModel extends GPTNeoXPreTrainedModel { }
10621
10501
 
10622
10502
  class GPTNeoXForCausalLM extends GPTNeoXPreTrainedModel { }
@@ -10625,18 +10505,7 @@ class GPTNeoXForCausalLM extends GPTNeoXPreTrainedModel { }
10625
10505
 
10626
10506
  //////////////////////////////////////////////////
10627
10507
  // GPT-J models
10628
- class GPTJPreTrainedModel extends PreTrainedModel {
10629
- /**
10630
- * Creates a new instance of the `GPTJPreTrainedModel` class.
10631
- * @param {Object} config The model configuration.
10632
- * @param {Record<string, any>} sessions The inference sessions for the model.
10633
- * @param {GenerationConfig} generation_config The generation configuration.
10634
- */
10635
- constructor(config, sessions, generation_config) {
10636
- super(config, sessions);
10637
- this.generation_config = generation_config;
10638
- }
10639
- }
10508
+ class GPTJPreTrainedModel extends PreTrainedModel { }
10640
10509
 
10641
10510
  class GPTJModel extends GPTJPreTrainedModel { }
10642
10511
 
@@ -10646,18 +10515,7 @@ class GPTJForCausalLM extends GPTJPreTrainedModel { }
10646
10515
 
10647
10516
  //////////////////////////////////////////////////
10648
10517
  // GPTBigCode models
10649
- class GPTBigCodePreTrainedModel extends PreTrainedModel {
10650
- /**
10651
- * Creates a new instance of the `GPTBigCodePreTrainedModel` class.
10652
- * @param {Object} config The model configuration.
10653
- * @param {Record<string, any>} sessions The inference sessions for the model.
10654
- * @param {GenerationConfig} generation_config The generation configuration.
10655
- */
10656
- constructor(config, sessions, generation_config) {
10657
- super(config, sessions);
10658
- this.generation_config = generation_config;
10659
- }
10660
- }
10518
+ class GPTBigCodePreTrainedModel extends PreTrainedModel { }
10661
10519
 
10662
10520
  class GPTBigCodeModel extends GPTBigCodePreTrainedModel { }
10663
10521
 
@@ -10666,18 +10524,7 @@ class GPTBigCodeForCausalLM extends GPTBigCodePreTrainedModel { }
10666
10524
 
10667
10525
  //////////////////////////////////////////////////
10668
10526
  // CodeGen models
10669
- class CodeGenPreTrainedModel extends PreTrainedModel {
10670
- /**
10671
- * Creates a new instance of the `CodeGenPreTrainedModel` class.
10672
- * @param {Object} config The model configuration.
10673
- * @param {Record<string, any>} sessions The inference sessions for the model.
10674
- * @param {GenerationConfig} generation_config The generation configuration.
10675
- */
10676
- constructor(config, sessions, generation_config) {
10677
- super(config, sessions);
10678
- this.generation_config = generation_config;
10679
- }
10680
- }
10527
+ class CodeGenPreTrainedModel extends PreTrainedModel { }
10681
10528
  /**
10682
10529
  * CodeGenModel is a class representing a code generation model without a language model head.
10683
10530
  */
@@ -10696,18 +10543,7 @@ class CodeGenForCausalLM extends CodeGenPreTrainedModel { }
10696
10543
  /**
10697
10544
  * The bare LLama Model outputting raw hidden-states without any specific head on top.
10698
10545
  */
10699
- class LlamaPreTrainedModel extends PreTrainedModel {
10700
- /**
10701
- * Creates a new instance of the `LlamaPreTrainedModel` class.
10702
- * @param {Object} config The model configuration.
10703
- * @param {Record<string, any>} sessions The inference sessions for the model.
10704
- * @param {GenerationConfig} generation_config The generation configuration.
10705
- */
10706
- constructor(config, sessions, generation_config) {
10707
- super(config, sessions);
10708
- this.generation_config = generation_config;
10709
- }
10710
- }
10546
+ class LlamaPreTrainedModel extends PreTrainedModel { }
10711
10547
  /**
10712
10548
  * The bare LLaMA Model outputting raw hidden-states without any specific head on top.
10713
10549
  */
@@ -10716,24 +10552,22 @@ class LlamaModel extends LlamaPreTrainedModel { }
10716
10552
  class LlamaForCausalLM extends LlamaPreTrainedModel { }
10717
10553
  //////////////////////////////////////////////////
10718
10554
 
10555
+
10556
+ //////////////////////////////////////////////////
10557
+ // Granite models
10558
+ class GranitePreTrainedModel extends PreTrainedModel { }
10559
+ class GraniteModel extends GranitePreTrainedModel { }
10560
+ class GraniteForCausalLM extends GranitePreTrainedModel { }
10561
+ //////////////////////////////////////////////////
10562
+
10563
+
10719
10564
  //////////////////////////////////////////////////
10720
10565
  // Cohere models
10721
10566
 
10722
10567
  /**
10723
10568
  * The bare Cohere Model outputting raw hidden-states without any specific head on top.
10724
10569
  */
10725
- class CoherePreTrainedModel extends PreTrainedModel {
10726
- /**
10727
- * Creates a new instance of the `CoherePreTrainedModel` class.
10728
- * @param {Object} config The model configuration.
10729
- * @param {Record<string, any>} sessions The inference sessions for the model.
10730
- * @param {GenerationConfig} generation_config The generation configuration.
10731
- */
10732
- constructor(config, sessions, generation_config) {
10733
- super(config, sessions);
10734
- this.generation_config = generation_config;
10735
- }
10736
- }
10570
+ class CoherePreTrainedModel extends PreTrainedModel { }
10737
10571
  class CohereModel extends CoherePreTrainedModel { }
10738
10572
 
10739
10573
  class CohereForCausalLM extends CoherePreTrainedModel { }
@@ -10745,18 +10579,7 @@ class CohereForCausalLM extends CoherePreTrainedModel { }
10745
10579
  /**
10746
10580
  * The bare Gemma Model outputting raw hidden-states without any specific head on top.
10747
10581
  */
10748
- class GemmaPreTrainedModel extends PreTrainedModel {
10749
- /**
10750
- * Creates a new instance of the `GemmaPreTrainedModel` class.
10751
- * @param {Object} config The model configuration.
10752
- * @param {Record<string, any>} sessions The inference sessions for the model.
10753
- * @param {GenerationConfig} generation_config The generation configuration.
10754
- */
10755
- constructor(config, sessions, generation_config) {
10756
- super(config, sessions);
10757
- this.generation_config = generation_config;
10758
- }
10759
- }
10582
+ class GemmaPreTrainedModel extends PreTrainedModel { }
10760
10583
  /**
10761
10584
  * The bare Gemma Model outputting raw hidden-states without any specific head on top.
10762
10585
  */
@@ -10771,18 +10594,7 @@ class GemmaForCausalLM extends GemmaPreTrainedModel { }
10771
10594
  /**
10772
10595
  * The bare Gemma2 Model outputting raw hidden-states without any specific head on top.
10773
10596
  */
10774
- class Gemma2PreTrainedModel extends PreTrainedModel {
10775
- /**
10776
- * Creates a new instance of the `Gemma2PreTrainedModel` class.
10777
- * @param {Object} config The model configuration.
10778
- * @param {Record<string, any>} sessions The inference sessions for the model.
10779
- * @param {GenerationConfig} generation_config The generation configuration.
10780
- */
10781
- constructor(config, sessions, generation_config) {
10782
- super(config, sessions);
10783
- this.generation_config = generation_config;
10784
- }
10785
- }
10597
+ class Gemma2PreTrainedModel extends PreTrainedModel { }
10786
10598
  /**
10787
10599
  * The bare Gemma2 Model outputting raw hidden-states without any specific head on top.
10788
10600
  */
@@ -10792,18 +10604,7 @@ class Gemma2ForCausalLM extends Gemma2PreTrainedModel { }
10792
10604
  //////////////////////////////////////////////////
10793
10605
 
10794
10606
  //////////////////////////////////////////////////
10795
- class OpenELMPreTrainedModel extends PreTrainedModel {
10796
- /**
10797
- * Creates a new instance of the `OpenELMPreTrainedModel` class.
10798
- * @param {Object} config The model configuration.
10799
- * @param {Record<string, any>} sessions The inference sessions for the model.
10800
- * @param {GenerationConfig} generation_config The generation configuration.
10801
- */
10802
- constructor(config, sessions, generation_config) {
10803
- super(config, sessions);
10804
- this.generation_config = generation_config;
10805
- }
10806
- }
10607
+ class OpenELMPreTrainedModel extends PreTrainedModel { }
10807
10608
  class OpenELMModel extends OpenELMPreTrainedModel { }
10808
10609
 
10809
10610
  class OpenELMForCausalLM extends OpenELMPreTrainedModel { }
@@ -10815,18 +10616,7 @@ class OpenELMForCausalLM extends OpenELMPreTrainedModel { }
10815
10616
  /**
10816
10617
  * The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
10817
10618
  */
10818
- class Qwen2PreTrainedModel extends PreTrainedModel {
10819
- /**
10820
- * Creates a new instance of the `Qwen2PreTrainedModel` class.
10821
- * @param {Object} config The model configuration.
10822
- * @param {Record<string, any>} sessions The inference sessions for the model.
10823
- * @param {GenerationConfig} generation_config The generation configuration.
10824
- */
10825
- constructor(config, sessions, generation_config) {
10826
- super(config, sessions);
10827
- this.generation_config = generation_config;
10828
- }
10829
- }
10619
+ class Qwen2PreTrainedModel extends PreTrainedModel { }
10830
10620
  /**
10831
10621
  * The bare Qwen2 Model outputting raw hidden-states without any specific head on top.
10832
10622
  */
@@ -10838,18 +10628,7 @@ class Qwen2ForCausalLM extends Qwen2PreTrainedModel { }
10838
10628
 
10839
10629
  //////////////////////////////////////////////////
10840
10630
  // Phi models
10841
- class PhiPreTrainedModel extends PreTrainedModel {
10842
- /**
10843
- * Creates a new instance of the `PhiPreTrainedModel` class.
10844
- * @param {Object} config The model configuration.
10845
- * @param {Record<string, any>} sessions The inference sessions for the model.
10846
- * @param {GenerationConfig} generation_config The generation configuration.
10847
- */
10848
- constructor(config, sessions, generation_config) {
10849
- super(config, sessions);
10850
- this.generation_config = generation_config;
10851
- }
10852
- }
10631
+ class PhiPreTrainedModel extends PreTrainedModel { }
10853
10632
  /**
10854
10633
  * The bare Phi Model outputting raw hidden-states without any specific head on top.
10855
10634
  */
@@ -10860,18 +10639,7 @@ class PhiForCausalLM extends PhiPreTrainedModel { }
10860
10639
 
10861
10640
  //////////////////////////////////////////////////
10862
10641
  // Phi3 models
10863
- class Phi3PreTrainedModel extends PreTrainedModel {
10864
- /**
10865
- * Creates a new instance of the `Phi3PreTrainedModel` class.
10866
- * @param {Object} config The model configuration.
10867
- * @param {Record<string, any>} sessions The inference sessions for the model.
10868
- * @param {GenerationConfig} generation_config The generation configuration.
10869
- */
10870
- constructor(config, sessions, generation_config) {
10871
- super(config, sessions);
10872
- this.generation_config = generation_config;
10873
- }
10874
- }
10642
+ class Phi3PreTrainedModel extends PreTrainedModel { }
10875
10643
 
10876
10644
  /**
10877
10645
  * The bare Phi3 Model outputting raw hidden-states without any specific head on top.
@@ -10887,18 +10655,7 @@ class Phi3ForCausalLM extends Phi3PreTrainedModel { }
10887
10655
  /**
10888
10656
  * The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
10889
10657
  */
10890
- class BloomPreTrainedModel extends PreTrainedModel {
10891
- /**
10892
- * Creates a new instance of the `BloomPreTrainedModel` class.
10893
- * @param {Object} config The model configuration.
10894
- * @param {Record<string, any>} sessions The inference sessions for the model.
10895
- * @param {GenerationConfig} generation_config The generation configuration.
10896
- */
10897
- constructor(config, sessions, generation_config) {
10898
- super(config, sessions);
10899
- this.generation_config = generation_config;
10900
- }
10901
- }
10658
+ class BloomPreTrainedModel extends PreTrainedModel { }
10902
10659
 
10903
10660
  /**
10904
10661
  * The bare Bloom Model transformer outputting raw hidden-states without any specific head on top.
@@ -10913,18 +10670,7 @@ class BloomForCausalLM extends BloomPreTrainedModel { }
10913
10670
 
10914
10671
  //////////////////////////////////////////////////
10915
10672
  // MPT models
10916
- class MptPreTrainedModel extends PreTrainedModel {
10917
- /**
10918
- * Creates a new instance of the `MptPreTrainedModel` class.
10919
- * @param {Object} config The model configuration.
10920
- * @param {Record<string, any>} sessions The inference sessions for the model.
10921
- * @param {GenerationConfig} generation_config The generation configuration.
10922
- */
10923
- constructor(config, sessions, generation_config) {
10924
- super(config, sessions);
10925
- this.generation_config = generation_config;
10926
- }
10927
- }
10673
+ class MptPreTrainedModel extends PreTrainedModel { }
10928
10674
 
10929
10675
  /**
10930
10676
  * The bare Mpt Model transformer outputting raw hidden-states without any specific head on top.
@@ -10940,18 +10686,7 @@ class MptForCausalLM extends MptPreTrainedModel { }
10940
10686
 
10941
10687
  //////////////////////////////////////////////////
10942
10688
  // OPT models
10943
- class OPTPreTrainedModel extends PreTrainedModel {
10944
- /**
10945
- * Creates a new instance of the `OPTPreTrainedModel` class.
10946
- * @param {Object} config The model configuration.
10947
- * @param {Record<string, any>} sessions The inference sessions for the model.
10948
- * @param {GenerationConfig} generation_config The generation configuration.
10949
- */
10950
- constructor(config, sessions, generation_config) {
10951
- super(config, sessions);
10952
- this.generation_config = generation_config;
10953
- }
10954
- }
10689
+ class OPTPreTrainedModel extends PreTrainedModel { }
10955
10690
 
10956
10691
  /**
10957
10692
  * The bare OPT Model outputting raw hidden-states without any specific head on top.
@@ -11813,19 +11548,7 @@ class SamImageSegmentationOutput extends ModelOutput {
11813
11548
 
11814
11549
  //////////////////////////////////////////////////
11815
11550
  // MarianMT models
11816
- class MarianPreTrainedModel extends PreTrainedModel {
11817
-
11818
- /**
11819
- * Creates a new instance of the `MarianMTModel` class.
11820
- * @param {Object} config The model configuration.
11821
- * @param {Record<string, any>} sessions The inference sessions for the model.
11822
- * @param {GenerationConfig} generation_config The generation configuration.
11823
- */
11824
- constructor(config, sessions, generation_config) {
11825
- super(config, sessions);
11826
- this.generation_config = generation_config;
11827
- }
11828
- };
11551
+ class MarianPreTrainedModel extends PreTrainedModel { };
11829
11552
 
11830
11553
  class MarianModel extends MarianPreTrainedModel { }
11831
11554
 
@@ -11834,19 +11557,7 @@ class MarianMTModel extends MarianPreTrainedModel { }
11834
11557
 
11835
11558
  //////////////////////////////////////////////////
11836
11559
  // M2M100 models
11837
- class M2M100PreTrainedModel extends PreTrainedModel {
11838
-
11839
- /**
11840
- * Creates a new instance of the `M2M100ForConditionalGeneration` class.
11841
- * @param {Object} config The model configuration.
11842
- * @param {Record<string, any>} sessions The inference sessions for the model.
11843
- * @param {GenerationConfig} generation_config The generation configuration.
11844
- */
11845
- constructor(config, sessions, generation_config) {
11846
- super(config, sessions);
11847
- this.generation_config = generation_config;
11848
- }
11849
- };
11560
+ class M2M100PreTrainedModel extends PreTrainedModel { };
11850
11561
 
11851
11562
  class M2M100Model extends M2M100PreTrainedModel { }
11852
11563
 
@@ -12356,19 +12067,7 @@ class WavLMForAudioFrameClassification extends WavLMPreTrainedModel {
12356
12067
  /**
12357
12068
  * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
12358
12069
  */
12359
- class SpeechT5PreTrainedModel extends PreTrainedModel {
12360
-
12361
- /**
12362
- * Creates a new instance of the `SpeechT5ForTextToSpeech` class.
12363
- * @param {Object} config The model configuration.
12364
- * @param {Record<string, any>} sessions The inference sessions for the model.
12365
- * @param {GenerationConfig} generation_config The generation configuration.
12366
- */
12367
- constructor(config, sessions, generation_config) {
12368
- super(config, sessions);
12369
- this.generation_config = generation_config;
12370
- }
12371
- };
12070
+ class SpeechT5PreTrainedModel extends PreTrainedModel { };
12372
12071
 
12373
12072
  /**
12374
12073
  * The bare SpeechT5 Encoder-Decoder Model outputting raw hidden-states without any specific pre- or post-nets.
@@ -12529,18 +12228,7 @@ class SpeechT5HifiGan extends PreTrainedModel {
12529
12228
 
12530
12229
  //////////////////////////////////////////////////
12531
12230
  // TrOCR models
12532
- class TrOCRPreTrainedModel extends PreTrainedModel {
12533
- /**
12534
- * Creates a new instance of the `TrOCRPreTrainedModel` class.
12535
- * @param {Object} config The configuration of the model.
12536
- * @param {any} session The ONNX session containing the model weights.
12537
- * @param {GenerationConfig} generation_config The generation configuration.
12538
- */
12539
- constructor(config, session, generation_config) {
12540
- super(config, session);
12541
- this.generation_config = generation_config;
12542
- }
12543
- }
12231
+ class TrOCRPreTrainedModel extends PreTrainedModel { }
12544
12232
 
12545
12233
  /**
12546
12234
  * The TrOCR Decoder with a language modeling head.
@@ -12555,18 +12243,7 @@ class TrOCRForCausalLM extends TrOCRPreTrainedModel { }
12555
12243
  /**
12556
12244
  * The bare Mistral Model outputting raw hidden-states without any specific head on top.
12557
12245
  */
12558
- class MistralPreTrainedModel extends PreTrainedModel {
12559
- /**
12560
- * Creates a new instance of the `MistralPreTrainedModel` class.
12561
- * @param {Object} config The configuration of the model.
12562
- * @param {any} session The ONNX session containing the model weights.
12563
- * @param {GenerationConfig} generation_config The generation configuration.
12564
- */
12565
- constructor(config, session, generation_config) {
12566
- super(config, session);
12567
- this.generation_config = generation_config;
12568
- }
12569
- }
12246
+ class MistralPreTrainedModel extends PreTrainedModel { }
12570
12247
 
12571
12248
  class MistralModel extends MistralPreTrainedModel { }
12572
12249
 
@@ -12579,18 +12256,7 @@ class MistralForCausalLM extends MistralPreTrainedModel { }
12579
12256
  /**
12580
12257
  * The bare Starcoder2 Model outputting raw hidden-states without any specific head on top.
12581
12258
  */
12582
- class Starcoder2PreTrainedModel extends PreTrainedModel {
12583
- /**
12584
- * Creates a new instance of the `Starcoder2PreTrainedModel` class.
12585
- * @param {Object} config The configuration of the model.
12586
- * @param {any} session The ONNX session containing the model weights.
12587
- * @param {GenerationConfig} generation_config The generation configuration.
12588
- */
12589
- constructor(config, session, generation_config) {
12590
- super(config, session);
12591
- this.generation_config = generation_config;
12592
- }
12593
- }
12259
+ class Starcoder2PreTrainedModel extends PreTrainedModel { }
12594
12260
 
12595
12261
  class Starcoder2Model extends Starcoder2PreTrainedModel { }
12596
12262
 
@@ -12603,18 +12269,7 @@ class Starcoder2ForCausalLM extends Starcoder2PreTrainedModel { }
12603
12269
  /**
12604
12270
  * The bare Falcon Model outputting raw hidden-states without any specific head on top.
12605
12271
  */
12606
- class FalconPreTrainedModel extends PreTrainedModel {
12607
- /**
12608
- * Creates a new instance of the `FalconPreTrainedModel` class.
12609
- * @param {Object} config The configuration of the model.
12610
- * @param {any} session The ONNX session containing the model weights.
12611
- * @param {GenerationConfig} generation_config The generation configuration.
12612
- */
12613
- constructor(config, session, generation_config) {
12614
- super(config, session);
12615
- this.generation_config = generation_config;
12616
- }
12617
- }
12272
+ class FalconPreTrainedModel extends PreTrainedModel { }
12618
12273
 
12619
12274
  class FalconModel extends FalconPreTrainedModel { }
12620
12275
 
@@ -12764,18 +12419,7 @@ class SegformerForSemanticSegmentation extends SegformerPreTrainedModel { }
12764
12419
 
12765
12420
  //////////////////////////////////////////////////
12766
12421
  // StableLm models
12767
- class StableLmPreTrainedModel extends PreTrainedModel {
12768
- /**
12769
- * Creates a new instance of the `StableLmPreTrainedModel` class.
12770
- * @param {Object} config The configuration of the model.
12771
- * @param {any} session The ONNX session containing the model weights.
12772
- * @param {GenerationConfig} generation_config The generation configuration.
12773
- */
12774
- constructor(config, session, generation_config) {
12775
- super(config, session);
12776
- this.generation_config = generation_config;
12777
- }
12778
- }
12422
+ class StableLmPreTrainedModel extends PreTrainedModel { }
12779
12423
 
12780
12424
  /**
12781
12425
  * The bare StableLm Model transformer outputting raw hidden-states without any specific head on top.
@@ -12869,17 +12513,6 @@ class MusicgenForConditionalGeneration extends PreTrainedModel { // NOTE: not Mu
12869
12513
  'past_key_values',
12870
12514
  ];
12871
12515
 
12872
- /**
12873
- * Creates a new instance of the `MusicgenForConditionalGeneration` class.
12874
- * @param {Object} config The model configuration.
12875
- * @param {Record<string, any>} sessions The inference sessions for the model.
12876
- * @param {GenerationConfig} generation_config The generation configuration.
12877
- */
12878
- constructor(config, sessions, generation_config) {
12879
- super(config, sessions);
12880
- this.generation_config = generation_config;
12881
- }
12882
-
12883
12516
  /**
12884
12517
  * Apply the pattern mask to the final ids,
12885
12518
  * then revert the pattern delay mask by filtering the pad token id in a single step.
@@ -13235,6 +12868,7 @@ const MODEL_MAPPING_NAMES_DECODER_ONLY = new Map([
13235
12868
  ['gpt_neox', ['GPTNeoXModel', GPTNeoXModel]],
13236
12869
  ['codegen', ['CodeGenModel', CodeGenModel]],
13237
12870
  ['llama', ['LlamaModel', LlamaModel]],
12871
+ ['granite', ['GraniteModel', GraniteModel]],
13238
12872
  ['cohere', ['CohereModel', CohereModel]],
13239
12873
  ['gemma', ['GemmaModel', GemmaModel]],
13240
12874
  ['gemma2', ['Gemma2Model', Gemma2Model]],
@@ -13323,6 +12957,7 @@ const MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = new Map([
13323
12957
  ['gpt_neox', ['GPTNeoXForCausalLM', GPTNeoXForCausalLM]],
13324
12958
  ['codegen', ['CodeGenForCausalLM', CodeGenForCausalLM]],
13325
12959
  ['llama', ['LlamaForCausalLM', LlamaForCausalLM]],
12960
+ ['granite', ['GraniteForCausalLM', GraniteForCausalLM]],
13326
12961
  ['cohere', ['CohereForCausalLM', CohereForCausalLM]],
13327
12962
  ['gemma', ['GemmaForCausalLM', GemmaForCausalLM]],
13328
12963
  ['gemma2', ['Gemma2ForCausalLM', Gemma2ForCausalLM]],
@@ -28954,10 +28589,10 @@ __webpack_require__.r(__webpack_exports__);
28954
28589
  /* harmony import */ var _ops_registry_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ops/registry.js */ "./src/ops/registry.js");
28955
28590
  /**
28956
28591
  * @file Helper module for `Tensor` processing.
28957
- *
28958
- * These functions and classes are only used internally,
28592
+ *
28593
+ * These functions and classes are only used internally,
28959
28594
  * meaning an end-user shouldn't need to access anything here.
28960
- *
28595
+ *
28961
28596
  * @module utils/tensor
28962
28597
  */
28963
28598
 
@@ -29118,9 +28753,9 @@ class Tensor {
29118
28753
  }
29119
28754
 
29120
28755
  /**
29121
- * @param {number} index
29122
- * @param {number} iterSize
29123
- * @param {any} iterDims
28756
+ * @param {number} index
28757
+ * @param {number} iterSize
28758
+ * @param {any} iterDims
29124
28759
  * @returns {Tensor}
29125
28760
  */
29126
28761
  _subarray(index, iterSize, iterDims) {
@@ -29177,6 +28812,30 @@ class Tensor {
29177
28812
  return this;
29178
28813
  }
29179
28814
 
28815
+ /**
28816
+ * Return a new Tensor with a callback function applied to each element.
28817
+ * @param {Function} callback - The function to apply to each element. It should take three arguments:
28818
+ * the current element, its index, and the tensor's data array.
28819
+ * @returns {Tensor} A new Tensor with the callback function applied to each element.
28820
+ */
28821
+ map(callback) {
28822
+ return this.clone().map_(callback);
28823
+ }
28824
+
28825
+ /**
28826
+ * Apply a callback function to each element of the tensor in place.
28827
+ * @param {Function} callback - The function to apply to each element. It should take three arguments:
28828
+ * the current element, its index, and the tensor's data array.
28829
+ * @returns {Tensor} Returns `this`.
28830
+ */
28831
+ map_(callback) {
28832
+ const this_data = this.data;
28833
+ for (let i = 0; i < this_data.length; ++i) {
28834
+ this_data[i] = callback(this_data[i], i, this_data);
28835
+ }
28836
+ return this;
28837
+ }
28838
+
29180
28839
  /**
29181
28840
  * Return a new Tensor with every element multiplied by a constant.
29182
28841
  * @param {number} val The value to multiply by.
@@ -29359,7 +29018,7 @@ class Tensor {
29359
29018
 
29360
29019
  /**
29361
29020
  * Returns the sum of each row of the input tensor in the given dimension dim.
29362
- *
29021
+ *
29363
29022
  * @param {number} [dim=null] The dimension or dimensions to reduce. If `null`, all dimensions are reduced.
29364
29023
  * @param {boolean} keepdim Whether the output tensor has `dim` retained or not.
29365
29024
  * @returns The summed tensor
@@ -29492,10 +29151,10 @@ class Tensor {
29492
29151
 
29493
29152
  /**
29494
29153
  * Returns a tensor with all specified dimensions of input of size 1 removed.
29495
- *
29154
+ *
29496
29155
  * NOTE: The returned tensor shares the storage with the input tensor, so changing the contents of one will change the contents of the other.
29497
29156
  * If you would like a copy, use `tensor.clone()` before squeezing.
29498
- *
29157
+ *
29499
29158
  * @param {number} [dim=null] If given, the input will be squeezed only in the specified dimensions.
29500
29159
  * @returns {Tensor} The squeezed tensor
29501
29160
  */
@@ -29517,9 +29176,9 @@ class Tensor {
29517
29176
 
29518
29177
  /**
29519
29178
  * Returns a new tensor with a dimension of size one inserted at the specified position.
29520
- *
29179
+ *
29521
29180
  * NOTE: The returned tensor shares the same underlying data with this tensor.
29522
- *
29181
+ *
29523
29182
  * @param {number} dim The index at which to insert the singleton dimension
29524
29183
  * @returns {Tensor} The unsqueezed tensor
29525
29184
  */
@@ -29670,7 +29329,7 @@ class Tensor {
29670
29329
 
29671
29330
  /**
29672
29331
  * This creates a nested array of a given type and depth (see examples).
29673
- *
29332
+ *
29674
29333
  * @example
29675
29334
  * NestArray<string, 1>; // string[]
29676
29335
  * @example
@@ -29997,7 +29656,7 @@ function calc_unsqueeze_dims(dims, dim) {
29997
29656
  * @param {number} size The size of the array.
29998
29657
  * @param {number} [dimension=null] The dimension that the index is for (optional).
29999
29658
  * @returns {number} The index, guaranteed to be non-negative and less than `arrayLength`.
30000
- *
29659
+ *
30001
29660
  * @throws {Error} If the index is out of range.
30002
29661
  * @private
30003
29662
  */
@@ -30685,6 +30344,9 @@ __webpack_require__.r(__webpack_exports__);
30685
30344
  /* harmony export */ GemmaModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GemmaModel),
30686
30345
  /* harmony export */ GemmaPreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GemmaPreTrainedModel),
30687
30346
  /* harmony export */ GemmaTokenizer: () => (/* reexport safe */ _tokenizers_js__WEBPACK_IMPORTED_MODULE_3__.GemmaTokenizer),
30347
+ /* harmony export */ GraniteForCausalLM: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GraniteForCausalLM),
30348
+ /* harmony export */ GraniteModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GraniteModel),
30349
+ /* harmony export */ GranitePreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GranitePreTrainedModel),
30688
30350
  /* harmony export */ Grok1Tokenizer: () => (/* reexport safe */ _tokenizers_js__WEBPACK_IMPORTED_MODULE_3__.Grok1Tokenizer),
30689
30351
  /* harmony export */ GroupViTModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GroupViTModel),
30690
30352
  /* harmony export */ GroupViTPreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.GroupViTPreTrainedModel),