mindspore_gs.ptq.network_helpers.mf_net_helpers.MFParallelLlama2Helper

View Source On Gitee
class mindspore_gs.ptq.network_helpers.mf_net_helpers.MFParallelLlama2Helper(config: Union[str, MindFormerConfig] = None)[source]

Derived from 'NetworkHelper', a utility class for the MindFormers framework ParrallelLlamaForCasualLM network.

Parameters

config (MindFormerConfig) – A MindFormerConfig object indicates the network configuration.

Raises

TypeError – If input config is not an instance of MindFormerConfig.

Examples

>>> from mindspore_gs.ptq.network_helpers.mf_net_helpers import MFParallelLlama2Helper
>>> from mindformers.tools.register.config import MindFormerConfig
>>> mf_yaml_config_file = "/path/to/mf_yaml_config_file"
>>> mfconfig = MindFormerConfig(mf_yaml_config_file)
>>> helper = MFParallelLlama2Helper(mfconfig)
>>> network = helper.create_network()
>>> decoder_layers = helper.get_decoder_layers(network)
>>> helper.analysis_decoder_groups(network)
analysis_decoder_groups(network)[source]

Analyze decoder groups information of network.

Parameters

network (ParallelLlamaForCausalLM) – network to analyze decoder groups information.