MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / save_linear

Function save_linear

python/save.py:17–21  ·  view source on GitHub ↗
(linear, path)

Source from the content-addressed store, hash-verified

15 np.save(pathlib.Path(path, f'{name}.npy'), tensor_to_save)
16
17def save_linear(linear, path):
18 pathlib.Path(path).mkdir(parents=True, exist_ok=True)
19 save_tensor(linear.weight.transpose(), 'weight', path) # PyTorch and Tinygrad strangely transpose linear weights so reverse that
20 if linear.bias is not None:
21 save_tensor(linear.bias, 'bias', path)
22
23def save_layer_norm(layer_norm, path):
24 pathlib.Path(path).mkdir(parents=True, exist_ok=True)

Callers 7

save_res_blockFunction · 0.85
save_cross_attentionFunction · 0.85
save_gegluFunction · 0.85
save_feed_forwardFunction · 0.85
save_unet_modelFunction · 0.85
save_clipmlpFunction · 0.85
save_clip_attentionFunction · 0.85

Calls 1

save_tensorFunction · 0.85

Tested by

no test coverage detected