Buckets:

HuggingFaceDocBuilder's picture
|
download
raw
8.62 kB

configs

Helper module for using model configs. For more information, see the corresponding Python documentation.

Example: Load an AutoConfig.

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.PretrainedConfig

Base class for all configuration classes. For more information, see the corresponding Python documentation.

Kind: static class of configs


new PretrainedConfig(configJSON)

Create a new PreTrainedTokenizer instance.

  ParamTypeDescription




configJSONObjectThe JSON of the config.

  

pretrainedConfig.model_type : string | null

Kind: instance property of PretrainedConfig


pretrainedConfig.is_encoder_decoder : boolean

Kind: instance property of PretrainedConfig


pretrainedConfig.max_position_embeddings : number

Kind: instance property of PretrainedConfig


PretrainedConfig.from_pretrained(pretrained_model_name_or_path, options)Promise.<PretrainedConfig>

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.

    ParamTypeDescription
    

    pretrained_model_name_or_pathstringThe path to the pre-trained config.

    optionsPretrainedOptionsAdditional 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


new AutoConfig()

Example

const config = await AutoConfig.from_pretrained('Xenova/bert-base-uncased');

AutoConfig.from_pretrained() : Object.from_pretrained

Kind: static method of AutoConfig


configs.getCacheShapes(config) ⇒ Record.<string, Array>

Kind: static method of configs

  ParamType




configPretrainedConfig
  

getCacheShapes~cache_values : Record.<string, Array>

Kind: inner constant of getCacheShapes


getCacheShapes~cache_values : Record.<string, Array>

Kind: inner constant of getCacheShapes


getCacheShapes~cache_values : Record.<string, Array>

Kind: inner constant of getCacheShapes


getCacheShapes~cache_values : Record.<string, Array>

Kind: inner constant of getCacheShapes


configs~loadConfig(pretrained_model_name_or_path, options) ⇒ Promise.<Object>

Loads a config from the specified path.

Kind: inner method of configs
Returns: Promise.<Object> - A promise that resolves with information about the loaded config.

  ParamTypeDescription




pretrained_model_name_or_pathstringThe path to the config directory.


optionsPretrainedOptionsAdditional options for loading the config.

  

configs~getNormalizedConfig(config) ⇒ Object

Kind: inner method of configs
Returns: Object - The normalized configuration.

  ParamType




configPretrainedConfig
  

configs~getKeyValueShapes() : Object

Kind: inner method of configs


getKeyValueShapes~decoderFeeds : Record.<string, Array>

Kind: inner constant of getKeyValueShapes


configs~PretrainedOptions : PretrainedOptions

Kind: inner typedef of configs


configs~ProgressCallback : ProgressCallback

Kind: inner typedef of configs


configs~ProgressInfo : ProgressInfo

Kind: inner typedef of configs


Xet Storage Details

Size:
8.62 kB
·
Xet hash:
25769437d3638cb061fb236a8d0b96950a134375f3fab386be9f9bdd0d4a5e6d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.