配置
IOMixinProto
基类: Protocol
NeMo 中 IOMixin 类的 get/set hparam 函数的协议。
源代码在 bionemo/llm/model/config.py
中
117 118 119 120 121 122 123 124 125 126 |
|
get_hparam(attribute)
获取 IOMixin 附加到类的配置中属性的值。
源代码在 bionemo/llm/model/config.py
中
124 125 126 |
|
set_hparam(attribute, value, also_change_value=True)
设置 IOMixin 附加到类的配置中属性的值。
源代码在 bionemo/llm/model/config.py
中
120 121 122 |
|
MegatronBioNeMoModelConfig
基类: BionemoModelConfig[MegatronModelType]
, TransformerConfig
, WillHaveGetSetHparam
用于 bionemo 的 ModelConfig 类,支持与 Megatron 模型一起使用,例如 NeMo2 所要求的。
源代码在 bionemo/llm/model/config.py
中
53 54 55 56 |
|
MegatronBioNeMoTrainableModelConfig
dataclass
基类: MegatronBioNeMoModelConfig[MegatronModelType]
, BionemoTrainableModelConfig[MegatronModelType, MegatronLossType]
, Generic[MegatronModelType, MegatronLossType]
用于 bionemo 的 TrainableModelConfig 类,支持与 Megatron 模型一起使用,例如 NeMo2 所要求的。
源代码在 bionemo/llm/model/config.py
中
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
load_settings_from_checkpoint(initial_ckpt_path)
从保存在 self 中的检查点加载设置到 self 中。
self.override_parent_fields 中的任何设置都不会被覆盖。请注意,此函数还将更新此配置中的超参数,以及 self 中的关联属性,以防它们在初始化后被修改。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
initial_ckpt_path
|
str
|
要加载的检查点路径,请注意,除了 self.override_parent_fields 中的设置外,所有内容都从此检查点加载。 |
必需 |
返回
类型 | 描述 |
---|---|
None
|
None,设置就地加载到 self 中,并且更新稍后将保存到检查点中的超参数。 |
源代码在 bionemo/llm/model/config.py
中
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
update_model_from_checkpoint(model, initial_ckpt_path)
标准化如何从检查点加载 megatron 模型,忽略用户指定的键的实用函数。
使用提供的检查点路径中的权重更新模型,跳过前缀在 self.initial_ckpt_skip_keys_with_these_prefixes 中的键。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
model
|
MegatronModelType
|
要更新的 Megatron 模型。 |
必需 |
initial_ckpt_path
|
str
|
要加载的 megatron 检查点路径。 |
必需 |
返回
类型 | 描述 |
---|---|
None
|
None,模型就地更新,支持 megatron 模型并行抽象,并忽略 self.initial_ckpt_skip_keys_with_these_prefixes 中提供的任何额外键。 |
源代码在 bionemo/llm/model/config.py
中
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
override_mutate_possibly_extra_mutated_fiddle(target_cfg, source_cfg, maybe_mutated_elements_to_clone)
使用给定元素的源配置的值覆盖目标配置的值。
这将修改跟踪的初始化超参数值,以及修改 self 中的关联属性,以防它们稍后被 post_init 代码修改。
参数
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
target_cfg
|
IOMixinProto
|
要更新的配置。 |
必需 |
source_cfg
|
IOMixinProto
|
要从中复制值的配置。 |
必需 |
maybe_mutated_elements_to_clone
|
List[str]
|
要从源配置复制到目标配置的元素列表。 |
必需 |
返回
类型 | 描述 |
---|---|
None
|
None,目标配置就地更新。 |
源代码在 bionemo/llm/model/config.py
中
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|