GPT OSS MXFP4 fix
This commit is contained in:
parent
bbac3e3de7
commit
64dff1456b
2 changed files with 5 additions and 2 deletions
|
|
@ -621,6 +621,7 @@ class FastModel(FastBaseModel):
|
|||
"if hasattr(module, x): "\
|
||||
"setattr(module, x, torch.nn.Parameter(getattr(module, x).to(torch.float32)) if isinstance(getattr(module, x), torch.nn.Parameter) else getattr(module, x).to(torch.float32))\n"\
|
||||
"x = 'down_proj_bias'\n"\
|
||||
"setattr(module, x, torch.nn.Parameter(getattr(module, x).to(torch.float32)) if isinstance(getattr(module, x), torch.nn.Parameter) else getattr(module, x).to(torch.float32))\n"\
|
||||
";"
|
||||
else:
|
||||
# Set down projection compute dtype to be float32 for float16 machines
|
||||
|
|
|
|||
|
|
@ -457,8 +457,10 @@ class FastBaseModel:
|
|||
|
||||
# Edit data-types
|
||||
if custom_datatype is not None:
|
||||
for jj, (name, module) in enumerate(model.named_modules()):
|
||||
exec(custom_datatype)
|
||||
with torch.no_grad():
|
||||
for jj, (name, module) in enumerate(model.named_modules()):
|
||||
exec(custom_datatype)
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
# Clear deleted GPU items
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue