MCPcopy
hub / github.com/modelscope/FunASR / train

Method train

funasr/models/lora/layers.py:179–198  ·  view source on GitHub ↗

Train. Args: mode: TODO.

(self, mode: bool = True)

Source from the content-addressed store, hash-verified

177 nn.init.zeros_(self.lora_B)
178
179 def train(self, mode: bool = True):
180 """Train.
181
182 Args:
183 mode: TODO.
184 """
185 def T(w):
186 """T.
187
188 Args:
189 w: TODO.
190 """
191 return w.T if self.fan_in_fan_out else w
192
193 nn.Linear.train(self, mode)
194 if self.merge_weights and self.merged:
195 # Make sure that the weights are not merged
196 if self.r > 0:
197 self.weight.data -= T(self.lora_B @ self.lora_A) * self.scaling
198 self.merged = False
199
200 def eval(self):
201 """Eval."""

Callers 9

train_epochMethod · 0.45
validate_epochMethod · 0.45
train_epochMethod · 0.45
validate_epochMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
trainMethod · 0.45
trainMethod · 0.45
trainMethod · 0.45

Calls 1

TFunction · 0.50

Tested by

no test coverage detected