cerebras.modelzoo.tools.checkpoint_converters.llava.ConfigConverter_LLaVA_HF_CS22#

class cerebras.modelzoo.tools.checkpoint_converters.llava.ConfigConverter_LLaVA_HF_CS22[source]#

Bases: cerebras.modelzoo.tools.checkpoint_converters.base_converter.BaseConfigConverter_UnpackedHF_PackedCS

Methods

assert_factory_fn

attempt_mup_to_sp

Determines whether muP -> sP conversion is should be attempted.

component_names

convert

convert_all_keys

convert_helper

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

convert_key

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

converter_note

converters

file_formats

formats

get_converter_indices

load

post_config_convert

new_config: List[Dict] if converter_indices = 1 (CS -> HF) else Dict if converter_indices = 0 (HF -> CS)

pre_config_convert

config: List[dicts] if converter_indices = 0 (HF-> CS) else dict (CS->HF)

replaceKey

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

save

supports_conversion

supports_mup_conversion

Determines whether muP -> sP conversion is supported for this model

Attributes

preprocessor_config_defaults

__init__()[source]#
post_config_convert(original_config, old_config, new_config, converter_indices, drop_unmatched_keys)[source]#

new_config: List[Dict] if converter_indices = 1 (CS -> HF) else Dict if converter_indices = 0 (HF -> CS)

pre_config_convert(config, converter_indices)[source]#

config: List[dicts] if converter_indices = 0 (HF-> CS) else dict (CS->HF)

attempt_mup_to_sp() bool#

Determines whether muP -> sP conversion is should be attempted. Some HF models (such as BTLM) should not attempt muP -> sP conversion since they can natively handle muP.

convert_helper(config, converter_indices: cerebras.modelzoo.tools.checkpoint_converters.base_converter.FormatIndices, drop_unmatched_keys: bool = False, no_progress_bar: bool = True, debug: bool = False)#

Converts all keys in a config from converter_indices.direction 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.

supports_mup_conversion() bool#

Determines whether muP -> sP conversion is supported for this model