configs
Helper module for using model configs. For more information, see the corresponding Python documentation.
Example: Load an AutoConfig
.
import { AutoConfig } from '@xenova/transformers';
let 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
- static
- .PretrainedConfig
new PretrainedConfig(configJSON)
.from_pretrained(pretrained_model_name_or_path, options)
βPromise.<PretrainedConfig>
- .AutoConfig
.from_pretrained()
:PretrainedConfig.from_pretrained
- .PretrainedConfig
- inner
~loadConfig(pretrained_model_name_or_path, options)
βPromise.<Array>
~PretrainedOptions
:*
- static
configs.PretrainedConfig
Base class for all configuration classes. For more information, see the corresponding Python documentation.
Kind: static class of configs
- .PretrainedConfig
new PretrainedConfig(configJSON)
.from_pretrained(pretrained_model_name_or_path, options)
βPromise.<PretrainedConfig>
new PretrainedConfig(configJSON)
Create a new PreTrainedTokenizer instance.
Param | Type | Description |
---|---|---|
configJSON | Object | The JSON of the config. |
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 PretrainedConfig
Returns: Promise.<PretrainedConfig>
- A new instance of the PretrainedConfig
class.
Throws:
Error
Throws an error if the config.json is not found in the `pretrained_model_name_or_path`.
Param | Type | Description |
---|---|---|
pretrained_model_name_or_path | string | The path to the pre-trained config. |
options | PretrainedOptions | Additional options for loading the config. |
configs.AutoConfig
Helper class which is used to instantiate pretrained configs with the from_pretrained
function.
Kind: static class of configs
AutoConfig.from_pretrained() : <code> PretrainedConfig.from_pretrained </code>
Kind: static method of AutoConfig
configs~loadConfig(pretrained_model_name_or_path, options) β <code> Promise. < Array > </code>
Loads a config from the specified path.
Kind: inner method of configs
Returns: Promise.<Array>
- A promise that resolves with information about the loaded config.
Param | Type | Description |
---|---|---|
pretrained_model_name_or_path | string | The path to the config directory. |
options | PretrainedOptions | Additional options for loading the config. |
configs~PretrainedOptions : <code> * </code>
Kind: inner typedef of configs
< > Update on GitHub