ankitbelbase034's picture
Upload folder using huggingface_hub
80e6c74 verified
Raw
History Blame Contribute Delete
310 Bytes
handler = None
def disable_torch_init():
"""
Disable the redundant torch default initialization to accelerate model creation.
"""
import torch
setattr(torch.nn.Linear, "reset_parameters", lambda self: None)
setattr(torch.nn.LayerNorm, "reset_parameters", lambda self: None)