MCPcopy
hub / github.com/XPixelGroup/DiffBIR / disable_torch_init

Function disable_torch_init

llava/utils.py:93–99  ·  view source on GitHub ↗

Disable the redundant torch default initialization to accelerate model creation.

()

Source from the content-addressed store, hash-verified

91
92
93def disable_torch_init():
94 """
95 Disable the redundant torch default initialization to accelerate model creation.
96 """
97 import torch
98 setattr(torch.nn.Linear, "reset_parameters", lambda self: None)
99 setattr(torch.nn.LayerNorm, "reset_parameters", lambda self: None)
100
101
102def violates_moderation(text):

Callers 7

mainFunction · 0.90
eval_modelFunction · 0.90
eval_modelFunction · 0.90
eval_modelFunction · 0.90
eval_modelFunction · 0.90
eval_modelFunction · 0.90
eval_modelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected