Buckets:
| # configs | |
| Helper module for using model configs. For more information, see the corresponding | |
| [Python documentation](https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoConfig). | |
| **Example:** Load an `AutoConfig`. | |
| ```javascript | |
| import { AutoConfig } from '@huggingface/transformers'; | |
| const config = await AutoConfig.from_pretrained('bert-base-uncased'); | |
| console.log(config); | |
| // PretrainedConfig { | |
| // "model_type": "bert", | |
| // "is_encoder_decoder": false, | |
| // "architectures": [ | |
| // "BertForMaskedLM" | |
| // ], | |
| // "vocab_size": 30522 | |
| // "num_attention_heads": 12, | |
| // "num_hidden_layers": 12, | |
| // "hidden_size": 768, | |
| // "max_position_embeddings": 512, | |
| // ... | |
| // } | |
| ``` | |
| * [configs](#module_configs) | |
| * _static_ | |
| * [.PretrainedConfig](#module_configs.PretrainedConfig) | |
| * [`new PretrainedConfig(configJSON)`](#new_module_configs.PretrainedConfig_new) | |
| * _instance_ | |
| * [`.model_type`](#module_configs.PretrainedConfig+model_type) : <code>string</code> | <code>null</code> | |
| * [`.is_encoder_decoder`](#module_configs.PretrainedConfig+is_encoder_decoder) : <code>boolean</code> | |
| * [`.max_position_embeddings`](#module_configs.PretrainedConfig+max_position_embeddings) : <code>number</code> | |
| * _static_ | |
| * [`.from_pretrained(pretrained_model_name_or_path, options)`](#module_configs.PretrainedConfig.from_pretrained) ⇒ <code>Promise.<PretrainedConfig></code> | |
| * [.AutoConfig](#module_configs.AutoConfig) | |
| * [`new AutoConfig()`](#new_module_configs.AutoConfig_new) | |
| * [`.from_pretrained()`](#module_configs.AutoConfig.from_pretrained) : <code>*</code> | |
| * [`.getCacheShapes(config)`](#module_configs.getCacheShapes) ⇒ <code>Record.<string, Array<number>></code> | |
| * [`~cache_values`](#module_configs.getCacheShapes..cache_values) : <code>Record.<string, Array<number>></code> | |
| * _inner_ | |
| * [`~loadConfig(pretrained_model_name_or_path, options)`](#module_configs..loadConfig) ⇒ <code>Promise.<Object></code> | |
| * [`~getNormalizedConfig(config)`](#module_configs..getNormalizedConfig) ⇒ <code>Object</code> | |
| * [`~getKeyValueShapes()`](#module_configs..getKeyValueShapes) : <code>*</code> | |
| * [`~decoderFeeds`](#module_configs..getKeyValueShapes..decoderFeeds) : <code>Record.<string, Array<number>></code> | |
| * [`~PretrainedOptions`](#module_configs..PretrainedOptions) : <code>*</code> | |
| * [`~ProgressCallback`](#module_configs..ProgressCallback) : <code>*</code> | |
| * [`~ProgressInfo`](#module_configs..ProgressInfo) : <code>*</code> | |
| * * * | |
| <a id="module_configs.PretrainedConfig" class="group"></a> | |
| ## configs.PretrainedConfig | |
| Base class for all configuration classes. For more information, see the corresponding | |
| [Python documentation](https://huggingface.co/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig). | |
| **Kind**: static class of [<code>configs</code>](#module_configs) | |
| * [.PretrainedConfig](#module_configs.PretrainedConfig) | |
| * [`new PretrainedConfig(configJSON)`](#new_module_configs.PretrainedConfig_new) | |
| * _instance_ | |
| * [`.model_type`](#module_configs.PretrainedConfig+model_type) : <code>string</code> | <code>null</code> | |
| * [`.is_encoder_decoder`](#module_configs.PretrainedConfig+is_encoder_decoder) : <code>boolean</code> | |
| * [`.max_position_embeddings`](#module_configs.PretrainedConfig+max_position_embeddings) : <code>number</code> | |
| * _static_ | |
| * [`.from_pretrained(pretrained_model_name_or_path, options)`](#module_configs.PretrainedConfig.from_pretrained) ⇒ <code>Promise.<PretrainedConfig></code> | |
| * * * | |
| <a id="new_module_configs.PretrainedConfig_new" class="group"></a> | |
| ### `new PretrainedConfig(configJSON)` | |
| Create a new PreTrainedTokenizer instance. | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Param</th><th>Type</th><th>Description</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>configJSON</td><td><code>Object</code></td><td><p>The JSON of the config.</p> | |
| </td> | |
| </tr> </tbody> | |
| </table> | |
| * * * | |
| <a id="module_configs.PretrainedConfig+model_type" class="group"></a> | |
| ### `pretrainedConfig.model_type` : <code>string</code> | <code>null</code> | |
| **Kind**: instance property of [<code>PretrainedConfig</code>](#module_configs.PretrainedConfig) | |
| * * * | |
| <a id="module_configs.PretrainedConfig+is_encoder_decoder" class="group"></a> | |
| ### `pretrainedConfig.is_encoder_decoder` : <code>boolean</code> | |
| **Kind**: instance property of [<code>PretrainedConfig</code>](#module_configs.PretrainedConfig) | |
| * * * | |
| <a id="module_configs.PretrainedConfig+max_position_embeddings" class="group"></a> | |
| ### `pretrainedConfig.max_position_embeddings` : <code>number</code> | |
| **Kind**: instance property of [<code>PretrainedConfig</code>](#module_configs.PretrainedConfig) | |
| * * * | |
| <a id="module_configs.PretrainedConfig.from_pretrained" class="group"></a> | |
| ### `PretrainedConfig.from_pretrained(pretrained_model_name_or_path, options)` ⇒ <code>Promise.<PretrainedConfig></code> | |
| Loads a pre-trained config from the given `pretrained_model_name_or_path`. | |
| **Kind**: static method of [<code>PretrainedConfig</code>](#module_configs.PretrainedConfig) | |
| **Returns**: <code>Promise.<PretrainedConfig></code> - A new instance of the `PretrainedConfig` class. | |
| **Throws**: | |
| - <code>Error</code> Throws an error if the config.json is not found in the `pretrained_model_name_or_path`. | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Param</th><th>Type</th><th>Description</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>pretrained_model_name_or_path</td><td><code>string</code></td><td><p>The path to the pre-trained config.</p> | |
| </td> | |
| </tr><tr> | |
| <td>options</td><td><code>PretrainedOptions</code></td><td><p>Additional options for loading the config.</p> | |
| </td> | |
| </tr> </tbody> | |
| </table> | |
| * * * | |
| <a id="module_configs.AutoConfig" class="group"></a> | |
| ## configs.AutoConfig | |
| Helper class which is used to instantiate pretrained configs with the `from_pretrained` function. | |
| **Kind**: static class of [<code>configs</code>](#module_configs) | |
| * [.AutoConfig](#module_configs.AutoConfig) | |
| * [`new AutoConfig()`](#new_module_configs.AutoConfig_new) | |
| * [`.from_pretrained()`](#module_configs.AutoConfig.from_pretrained) : <code>*</code> | |
| * * * | |
| <a id="new_module_configs.AutoConfig_new" class="group"></a> | |
| ### `new AutoConfig()` | |
| **Example** | |
| ```js | |
| const config = await AutoConfig.from_pretrained('Xenova/bert-base-uncased'); | |
| ``` | |
| * * * | |
| <a id="module_configs.AutoConfig.from_pretrained" class="group"></a> | |
| ### `AutoConfig.from_pretrained()` : <code>*</code> | |
| **Kind**: static method of [<code>AutoConfig</code>](#module_configs.AutoConfig) | |
| * * * | |
| <a id="module_configs.getCacheShapes" class="group"></a> | |
| ## `configs.getCacheShapes(config)` ⇒ <code>Record.<string, Array<number>></code> | |
| **Kind**: static method of [<code>configs</code>](#module_configs) | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Param</th><th>Type</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>config</td><td><code>PretrainedConfig</code></td> | |
| </tr> </tbody> | |
| </table> | |
| * * * | |
| <a id="module_configs.getCacheShapes..cache_values" class="group"></a> | |
| ### `getCacheShapes~cache_values` : <code>Record.<string, Array<number>></code> | |
| **Kind**: inner constant of [<code>getCacheShapes</code>](#module_configs.getCacheShapes) | |
| * * * | |
| <a id="module_configs..loadConfig" class="group"></a> | |
| ## `configs~loadConfig(pretrained_model_name_or_path, options)` ⇒ <code>Promise.<Object></code> | |
| Loads a config from the specified path. | |
| **Kind**: inner method of [<code>configs</code>](#module_configs) | |
| **Returns**: <code>Promise.<Object></code> - A promise that resolves with information about the loaded config. | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Param</th><th>Type</th><th>Description</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>pretrained_model_name_or_path</td><td><code>string</code></td><td><p>The path to the config directory.</p> | |
| </td> | |
| </tr><tr> | |
| <td>options</td><td><code>PretrainedOptions</code></td><td><p>Additional options for loading the config.</p> | |
| </td> | |
| </tr> </tbody> | |
| </table> | |
| * * * | |
| <a id="module_configs..getNormalizedConfig" class="group"></a> | |
| ## `configs~getNormalizedConfig(config)` ⇒ <code>Object</code> | |
| **Kind**: inner method of [<code>configs</code>](#module_configs) | |
| **Returns**: <code>Object</code> - The normalized configuration. | |
| <table> | |
| <thead> | |
| <tr> | |
| <th>Param</th><th>Type</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td>config</td><td><code>PretrainedConfig</code></td> | |
| </tr> </tbody> | |
| </table> | |
| * * * | |
| <a id="module_configs..getKeyValueShapes" class="group"></a> | |
| ## `configs~getKeyValueShapes()` : <code>*</code> | |
| **Kind**: inner method of [<code>configs</code>](#module_configs) | |
| * * * | |
| <a id="module_configs..getKeyValueShapes..decoderFeeds" class="group"></a> | |
| ### `getKeyValueShapes~decoderFeeds` : <code>Record.<string, Array<number>></code> | |
| **Kind**: inner constant of [<code>getKeyValueShapes</code>](#module_configs..getKeyValueShapes) | |
| * * * | |
| <a id="module_configs..PretrainedOptions" class="group"></a> | |
| ## `configs~PretrainedOptions` : <code>*</code> | |
| **Kind**: inner typedef of [<code>configs</code>](#module_configs) | |
| * * * | |
| <a id="module_configs..ProgressCallback" class="group"></a> | |
| ## `configs~ProgressCallback` : <code>*</code> | |
| **Kind**: inner typedef of [<code>configs</code>](#module_configs) | |
| * * * | |
| <a id="module_configs..ProgressInfo" class="group"></a> | |
| ## `configs~ProgressInfo` : <code>*</code> | |
| **Kind**: inner typedef of [<code>configs</code>](#module_configs) | |
| * * * | |
| <EditOnGithub source="https://github.com/huggingface/transformers.js/blob/main/docs/source/api/configs.md" /> |
Xet Storage Details
- Size:
- 9.92 kB
- Xet hash:
- 650ab44c2eecc1ecf65000aec74d22a7aa18d20efb8f1bec7053a57c5e76b6da
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.