MCPcopy Create free account
hub / github.com/EmbodiedGPT/EmbodiedGPT_Pytorch / disable_torch_init

Function disable_torch_init

robohusky/utils.py:108–115  ·  view source on GitHub ↗

Disable the redundant torch default initialization to accelerate model creation.

()

Source from the content-addressed store, hash-verified

106
107
108def disable_torch_init():
109 """
110 Disable the redundant torch default initialization to accelerate model creation.
111 """
112 import torch
113
114 setattr(torch.nn.Linear, "reset_parameters", lambda self: None)
115 setattr(torch.nn.LayerNorm, "reset_parameters", lambda self: None)
116
117
118def get_gpu_memory(max_gpus=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected