cerebras.modelzoo.tools.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS18#
- class cerebras.modelzoo.tools.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS18[source]#
Bases:
cerebras.modelzoo.tools.checkpoint_converters.bert.ConfigConverter_Bert_HF_CS17Methods
assert_factory_fnassert_mlm_nonlinearityDetermines whether muP -> sP conversion is should be attempted.
convertconvert_all_keysConverts all keys in a config from converter_indices.direction format to the other format.
Attempts to convert the old key by matching against the list of conversion rules.
convert_position_embedding_typefile_formatsformatsget_converter_indicesAllows models to override the default muP converters with their own
loadpost_config_convertpre_config_convertCopies value that exists at old_state_dict's old_key to new_state_dict's new_key.
savesupports_conversionDetermines whether muP -> sP conversion is supported for this model.
- attempt_mup_to_sp()#
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, drop_unmatched_keys=False, no_progress_bar=True, debug=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, old_state_dict, new_state_dict, from_index, match_start=0, prefix='', action_fn_args=None, debug=False)#
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.
- get_mup_converter()#
Allows models to override the default muP converters with their own
- static replaceKey(old_key, new_key, old_state_dict, new_state_dict, from_index, action_fn_args=None)#
Copies value that exists at old_state_dict’s old_key to new_state_dict’s new_key.
- supports_mup_conversion()#
Determines whether muP -> sP conversion is supported for this model.