(linear, path)
| 15 | np.save(pathlib.Path(path, f'{name}.npy'), tensor_to_save) |
| 16 | |
| 17 | def 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 | |
| 23 | def save_layer_norm(layer_norm, path): |
| 24 | pathlib.Path(path).mkdir(parents=True, exist_ok=True) |
no test coverage detected