MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / float_conversion

Function float_conversion

codegeex/megatron/model/module.py:148–154  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

146 """Convert fp16/bf16 `val` to fp32"""
147
148 def float_conversion(val):
149 val_typecheck = val
150 if isinstance(val_typecheck, (Parameter, Variable)):
151 val_typecheck = val.data
152 if isinstance(val_typecheck, (_BF16_TYPES, _HALF_TYPES)):
153 val = val.float()
154 return val
155
156 return conversion_helper(val, float_conversion)
157

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected