modelzoo.common.pytorch.model_utils.checkpoint_converters.llama.ConfigConverter_LlamaModel_CS19_CS20#

class modelzoo.common.pytorch.model_utils.checkpoint_converters.llama.ConfigConverter_LlamaModel_CS19_CS20[source]#

Bases: modelzoo.common.pytorch.model_utils.checkpoint_converters.gpt2_hf_cs.ConfigConverter_GPT2Model_CS18_CS20

Llama uses the GPT2 backbone

Methods

assert_factory_fn

convert

convert_all_keys

convert_helper

Converts all keys in a config from from_index format to the other format.

convert_key

Attempts to convert the old key by matching against the list of conversion rules.

convert_use_rms_layer_norm

file_formats

formats

get_from_index

load

post_config_convert

pre_config_convert

replaceKey

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

save

supports_conversion

__init__()#
convert_helper(config, from_index: int, drop_unmatched_keys: bool = False, no_progress_bar: bool = True, debug: bool = False)#

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.

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#

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

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#

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