File size: 304 Bytes
75160e6
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import torch

# تحميل الموديل
model = YourModelClass()
model.load_state_dict(torch.load("full_model.pth"))
model.eval()

# حفظه بصيغة safetensors (الأفضل لـ HF)
from safetensors.torch import save_file
state_dict = model.state_dict()
save_file(state_dict, "model.safetensors")