common.pytorch.model_utils.checkpoint_converters package#

Submodules#

common.pytorch.model_utils.checkpoint_converters.base_converter module#

class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.base_converter.BaseDictionaryConverter, abc.ABC

Converts between checkpoint state_dict formats.

__init__()[source]#
classmethod convert(checkpoint, configs, checkpoint_from_index, **kwargs)[source]#
convert_helper(checkpoint, configs: Tuple[dict, dict], from_index: int, drop_unmatched_keys: bool = False, no_progress_bar: bool = True, debug: bool = False)[source]#

Converts all keys in a checkpoint from from_index format to the other format. Conversion will fail if at least one of the keys did not match on any conversion rules and drop_unmatched_keys is not enabled. Returns the newly converted checkpoint.

abstract static file_formats() Tuple[str, str][source]#
abstract static get_config_converter_class() common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
abstract classmethod load(file: str, from_index: int, **kwargs) collections.OrderedDict[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#

Hook executes after checkpoint conversion.

post_model_convert(old_state_dict: collections.OrderedDict, new_state_dict: collections.OrderedDict, configs: Tuple[dict, dict], from_index: int, drop_unmatched_keys: bool)[source]#

Hook executes right after model conversion.

pre_checkpoint_convert(checkpoint, configs: Tuple[dict, dict], from_index: int)[source]#

Hook executes before checkpoint conversion.

pre_model_convert(old_state_dict: collections.OrderedDict, new_state_dict: collections.OrderedDict, configs: Tuple[dict, dict], from_index: int, drop_unmatched_keys: bool)[source]#

Hook executes right before model conversion.

abstract classmethod save(file_without_ext: str, checkpoint: collections.OrderedDict, from_index: int, **kwargs) str[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

HF checkpoints contain model only while CS checkpoints package model, optimizer, and lr_scheduler into a single checkpoint. This class overrides the post_checkpoint_convert to automatically extract/package the state_dict correctly.

__init__()[source]#
static file_formats() Tuple[str, str][source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#

Hook executes after checkpoint conversion.

pre_checkpoint_convert(checkpoint, configs: Tuple[dict, dict], from_index: int)[source]#

Hook executes before checkpoint conversion.

class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter

__init__()[source]#
static file_formats() Tuple[str, str][source]#
classmethod load(file: str, from_index: int) collections.OrderedDict[source]#
classmethod save(file_without_ext: str, checkpoint: collections.OrderedDict, from_index: int, export_h5_checkpoint: bool = False) collections.OrderedDict[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.base_converter.BaseDictionaryConverter, abc.ABC

__init__()[source]#
static assert_factory_fn(assert_index, assert_value)[source]#
classmethod convert(config, from_index: int, drop_unmatched_keys: bool = False, no_progress_bar: bool = True, debug: bool = False)[source]#
convert_helper(config, from_index: int, drop_unmatched_keys: bool = False, no_progress_bar: bool = True, debug: bool = False)[source]#

Converts all keys in a config from from_index format to the other format. Conversion will fail if at least one of the keys did not match on any conversion rules and drop_unmatched_keys is not enabled. Returns the newly converted config.

abstract static file_formats() Tuple[str, str][source]#
classmethod load(file: str, from_index: int) dict[source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
classmethod save(file_without_ext: str, config: dict, from_index: int) str[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_CS_CS[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter

CS packages model, optimizer, and lr_scheduler into a single config. This class overrides the [pre|post]_config_convert fn to automatically extract/package the model configuration correctly.

__init__()[source]#
static file_formats() Tuple[str, str][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter

CS packages model, optimizer, and lr_scheduler into a single config. This class overrides the [pre|post]_config_convert fn to automatically extract/package the model configuration correctly.

__init__()[source]#
static file_formats() Tuple[str, str][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.BaseDictionaryConverter[source]#

Bases: abc.ABC

A dictionary converter represents a pair of two dictionary formats that can be converted between each other. The converter object defines a list of conversion rules which should be applied when converting one dict format to the other (and vice-versa).

In order to make your own dictionary converter, simply: 1. Create a new converter class which inherits from BaseDictionaryConverter 2. Supply a list of conversion rules (self.rules) 3. Override the pre_model_convert or post_model_convert hooks if you

need to execute arbitrary behavior before/after the conversion.

__init__(pbar_desc=None)[source]#
convert_all_keys(old_state_dict: collections.OrderedDict, new_state_dict: collections.OrderedDict, from_index: int, action_fn_args: Optional[dict] = None, no_progress_bar: bool = True, debug: bool = False, suppress_unmatched_key_warning: bool = False)[source]#
convert_key(old_key: str, old_state_dict: collections.OrderedDict, new_state_dict: collections.OrderedDict, from_index: int, match_start: int = 0, prefix: str = '', action_fn_args: Optional[dict] = None, debug: bool = False) None[source]#

Attempts to convert the old key by matching against the list of conversion rules. The first rule to match is used for conversion (i.e. even if multiple rules would match, the latter ones are never used). Returns True if a conversion occured.

abstract static formats() Tuple[common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
classmethod get_from_index(src_fmt, tgt_fmt)[source]#
static replaceKey(old_key: str, new_key: str, old_state_dict: collections.OrderedDict, new_state_dict: collections.OrderedDict, from_index: int, action_fn_args: Optional[dict] = None) None[source]#

Copies value that exists at old_state_dict’s old_key to new_state_dict’s new_key.

classmethod supports_conversion(src_fmt, tgt_fmt)[source]#
exception common.pytorch.model_utils.checkpoint_converters.base_converter.ConfigConversionError[source]#

Bases: Exception

Raised when a config cannot be converted

class common.pytorch.model_utils.checkpoint_converters.base_converter.ConversionRule[source]#

Bases: object

ConversionRule defines a “rule” which:
  1. a key can be matched against

  2. procedure for converting this old key to a new one upon a sucessful match

  3. and an action to be taken once the new key is created (ex: updating the state dictionary)

A rule consists of a sequence of regex pattern (supplied as a string), EquivalentSubkey object, and (possibly) a BaseDictionaryConverter as long as this object is last in the sequence. It also contains an “exists” argument which can be set to “left”, “both”, or “right”. The “left” and “right” arguments are used to describe if a key exists in one checkpoint format but not the other and should be ignored. Without this behavior, keys that exist in one but not the other wouldn’t be matched by any conversion rules, causing a failure as drop_unmatched_keys is disabled by default.

Example: The following describes the conversion rule for mapping HF’s layer normalization key to CS layer normalization in the GPT2 model.

>>> ConversionRule(
>>>     [
>>>         EquivalentSubkey("h", "transformer_decoder.layers"),
>>>         "\.\d+\.",
>>>         EquivalentSubkey("ln_1", "norm1"),
>>>         "\.(weight|bias)",
>>>     ],
>>>     action=BaseCheckpointConverter.replaceKey,
>>> )
This should be interpreted as:
  1. HF uses ‘h’ to represent the decoder name while CS uses ‘transformer_decoder.layers’

  2. Both will have keys that follow with a dot, the decoder number, and then another dot

  3. HF uses ‘ln_1’ for the first layer norm while CS names it ‘norm1’

  4. Both will have keys that follow with a dot and then either weight or bias

This representation should make it easy to see how we can 1) build a regex which matches against old keys, and 2) use the matched result & EquivalentSubkey information to create a new key. Finally, once thhe new key is constructed the conversion rule will apply the ‘action’ described by the user in order to complete the conversion (in this case simply copying the value at old_state’s old key into the new_state at the new key).

As previously mentioned, a conversion rule object can also contain a checkpoint converter at the end of the sequence. This is used to create a new checkpoint converter which uses another converter to handle a portion of the conversion. Doing so reduces the amount of copy & pasted conversion rules. For example, many models have base model classes which are extended with additional layers for finetuning. For example, HF’s GP2Model doesn’t contain a language model head while GP2LMHeadModel does. Rather than copying the conversion rules, we could instead define a new checkpoint converter as follows:

>>> class Converter_GPT2LMHeadModel_HF_CS17(BaseDictionaryConverter):
>>>     def __init__(self):
>>>         super().__init__()
>>>         self.rules = [
>>>             ConversionRule(
>>>                 ["lm_head\.(weight|bias)"],
>>>                 action=BaseCheckpointConverter.replaceKey,
>>>             ),
>>>             ConversionRule(
>>>                 [
>>>                     EquivalentSubkey("transformer.", ""),
>>>                     Converter_GPT2Model_HF_CS17(),
>>>                 ],
>>>                 action=None,
>>>             ),
>>>         ]

The first rule simply notates that the lm_head key now exists (and is named the same in both models). The second rule notates that if the “transformer.” prefix is encountered, we should try all of the GPT2Model HF -> CS 1.7 conversion rules.

__init__(segments: List[Union[str, common.pytorch.model_utils.checkpoint_converters.base_converter.EquivalentSubkey, common.pytorch.model_utils.checkpoint_converters.base_converter.BaseDictionaryConverter]], exists: str = 'both', action: Optional[Callable[[str, collections.OrderedDict, str, collections.OrderedDict, int], None]] = None) None[source]#
convert_key(old_key: str, old_state_dict: collections.OrderedDict, new_state_dict: collections.OrderedDict, from_index: int, match_start: int = 0, prefix: str = '', action_fn_args: Optional[dict] = None, debug: bool = False) bool[source]#
exists_in_index(to_index: int) bool[source]#
static segment_is_converter(elm: Union[str, common.pytorch.model_utils.checkpoint_converters.base_converter.EquivalentSubkey, common.pytorch.model_utils.checkpoint_converters.base_converter.BaseDictionaryConverter]) bool[source]#
validate_segments()[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.EquivalentSubkey[source]#

Bases: object

EquivalentSubkey defines the bidirectional relationship between subkeys of a model’s checkpoint. This class is simply a 2-tuple with index bounds checking.

For example if the normalization layer in one model is named “norm” and “ln” in the other, the relationship can be represented as EquivalentSubkey(“norm”, “ln”).

__init__(a: str, b: str) None[source]#
class common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions[source]#

Bases: list

__init__(*versions) None[source]#

common.pytorch.model_utils.checkpoint_converters.bert module#

class common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_CS16_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_CS_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_CS16_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_CS16_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_CS17_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_CS16_CS18

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
assert_mlm_nonlinearity(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_position_embedding_type(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertLayerNorm_HF_CS[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__(hf_name, cs_name)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertModel_CS16_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
position_embeddings_convert(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertModel_CS16_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertModel_HF_CS17[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertModel_CS16_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertModel_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertPretrainModel_CS16_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
convert_cls_predictions_bias(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertPretrainModel_CS16_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertPretrainModel_HF_CS17[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertPretrainModel_CS16_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertPretrainModel_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert.Converter_BertPretrainModel_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert.Converter_Bert_CS17_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.bert_finetune module#

class common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForQuestionAnswering_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForQuestionAnswering_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForQuestionAnswering_HF_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS18

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForSequenceClassification_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForSequenceClassification_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForSequenceClassification_HF_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS18

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForTokenClassification_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForTokenClassification_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert_finetune.ConfigConverter_BertForTokenClassification_HF_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS18

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertFinetuneModel_CS16_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertFinetuneModel_CS16_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertForQuestionAnswering_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertForQuestionAnswering_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertForSequenceClassification_HF_CS17[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertFinetuneModel_CS16_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertForSequenceClassification_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertForTokenClassification_HF_CS17[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertFinetuneModel_CS16_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.bert_finetune.Converter_BertForTokenClassification_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs module#

class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.ConfigConverter_BloomModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
assert_attention_inner_dim(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
assert_filter_size(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.ConfigConverter_BloomModel_HF_CS19[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.ConfigConverter_BloomModel_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.Converter_BloomLMHeadModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.Converter_BloomLMHeadModel_HF_CS19[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.Converter_BloomModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_alibi_slopes(n)[source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.Converter_BloomModel_HF_CS19[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.Converter_BloomModel_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.bloom_hf_cs.Converter_Bloom_Attention_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
assert_already_converted(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
qkv_converter(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
qkv_converter_cs17_to_hf(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
qkv_converter_hf_to_cs17(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#

common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs module#

class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.ConfigConverter_GPT2Model_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
convert_attention_type(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.ConfigConverter_GPT2Model_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.ConfigConverter_GPT2Model_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.Converter_GPT2LMHeadModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.Converter_GPT2LMHeadModel_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.Converter_GPT2Model_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.Converter_GPT2Model_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.Converter_GPT2Model_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.Converter_GPT2_Attention_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
assert_already_converted(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
c_attn_converter(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
c_attn_converter_cs17_to_hf(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
c_attn_converter_hf_to_cs17(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.transpose_key_if_2D(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#

common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs module#

class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.ConfigConverter_GPT_Neox_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
rotary_dim_converter(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.ConfigConverter_GPT_Neox_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.ConfigConverter_GPT_Neox_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.Converter_GPT_Neox_Attention_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
assert_already_converted(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
interleave_helper(t, cs_config)[source]#
qkv_converter(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
qkv_converter_cs17_to_hf(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
qkv_converter_hf_to_cs17(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
reverse_interleave_helper(t, cs_config)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.Converter_GPT_Neox_Headless_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.Converter_GPT_Neox_Headless_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.Converter_GPT_Neox_Headless_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.Converter_GPT_Neox_LMHeadModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.gpt_neox_hf_cs.Converter_GPT_Neox_LMHeadModel_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs module#

class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.ConfigConverter_GPTJModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
convert_attention_type(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_position_embedding_type(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.ConfigConverter_GPTJModel_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.ConfigConverter_GPTJModel_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.Converter_GPTJ_Attention_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
replace_or_fill_masked_bias(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.Converter_GPTJ_Headless_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.Converter_GPTJ_Headless_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.Converter_GPTJ_Headless_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.Converter_GPTJ_LMHeadModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.gptj_hf_cs.Converter_GPTJ_LMHeadModel_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.llama module#

class common.pytorch.model_utils.checkpoint_converters.llama.ConfigConverter_LLaMa_HF_CS19[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
assert_rotary_dim(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_nonlinearity(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.llama.Converter_LlamaAttention_HF_CS[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
convert_output_and_inv_freq(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_with_interleaving(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
interleave_helper(t, cs_config)[source]#
reverse_interleave_helper(t, cs_config)[source]#
class common.pytorch.model_utils.checkpoint_converters.llama.Converter_LlamaForCausalLM_HF_CS[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.llama.Converter_LlamaForCausalLM_HF_CS19[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.llama.Converter_LlamaModel_HF_CS[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.llama.Converter_LlamaModel_HF_CS19[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.llama.Converter_LlamaModel_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.opt_hf_cs module#

class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.ConfigConverter_OPTModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
assert_word_embed_proj_dim(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_attention_type(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_bias(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.ConfigConverter_OPTModel_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.ConfigConverter_OPTModel_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.Converter_OPT_Attention_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.Converter_OPT_Headless_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.Converter_OPT_Headless_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.Converter_OPT_Headless_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.Converter_OPT_LMHeadModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.opt_hf_cs.Converter_OPT_LMHeadModel_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs module#

class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.ConfigConverter_Codegen_Model_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
rotary_dim_converter(old_key, new_key, old_state_dict, new_state_dict, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.ConfigConverter_Codegen_Model_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.ConfigConverter_Codegen_Model_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.Converter_Codegen_Attention_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
assert_already_converted(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
qkv_converter(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
qkv_converter_cs17_to_hf(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
qkv_converter_hf_to_cs17(old_key, new_key, old_state_dict, new_state_dict, action_fn_args)[source]#
replace_or_fill_masked_bias(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.Converter_Codegen_Headless_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
replace_final_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.Converter_Codegen_Headless_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.Converter_Codegen_Headless_HF_CS17

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.Converter_Codegen_LMHeadModel_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.salesforce_codegen_hf_cs.Converter_Codegen_LMHeadModel_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

common.pytorch.model_utils.checkpoint_converters.t5 module#

class common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_CS16_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_CS_CS

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_CS16_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_CS16_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_CS17_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_CS_CS

__init__()[source]#
classmethod flip_use_pre_encoder_decoder_layer_norm(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
class common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_HF_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter_HF_CS

__init__()[source]#
assert_decoder_nonlinearity(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_nonlinearity(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
post_config_convert(original_config, old_config, new_config, from_index, drop_unmatched_keys)[source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_HF_CS18[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.t5.ConfigConverter_T5_HF_CS17

__init__()[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
pre_config_convert(config, from_index)[source]#
class common.pytorch.model_utils.checkpoint_converters.t5.Converter_T5_CS16_CS17[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
convert_dense_layer(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_relative_attention_bias_cs16_to_cs17(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_relative_attention_bias_cs17_to_cs16(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.t5.Converter_T5_CS16_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
class common.pytorch.model_utils.checkpoint_converters.t5.Converter_T5_CS17_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_PT_PT

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
class common.pytorch.model_utils.checkpoint_converters.t5.Converter_T5_HF_CS17[source]#

Bases: common.pytorch.model_utils.checkpoint_converters.t5.Converter_T5_CS16_CS17, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
convert_embeddings(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
convert_relative_attention_bias_cs17_to_hf(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args)[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#
post_checkpoint_convert(checkpoint, from_index: int)[source]#
pre_model_convert(old_state_dict, new_state_dict, configs, from_index, drop_unmatched_keys)[source]#
class common.pytorch.model_utils.checkpoint_converters.t5.Converter_T5_HF_CS18[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseCheckpointConverter_HF_CS

__init__()[source]#
classmethod converter_note() str[source]#
static formats() Tuple[modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions, modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.FormatVersions][source]#
static get_config_converter_class() modelzoo.common.pytorch.model_utils.checkpoint_converters.base_converter.BaseConfigConverter[source]#

Module contents#