mindspore_gs.ptq.network_helpers.mf_net_helpers.MFParallelLlama2Helper

class mindspore_gs.ptq.network_helpers.mf_net_helpers.MFParallelLlama2Helper(config: Union[str, MindFormerConfig] = None)[源代码]

NetworkHelper 类派生,用于MindFormers框架ParallelLlamaForCasualLM网络的工具类。

参数:
  • config (MindFormerConfig) - 一个 MindFormerConfig 对象,表示对应网络的配置项。

异常:
  • TypeError - config 数据类型不是 MindFormerConfig

样例:

>>> 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)