Open mahaling opened 11 months ago
def port_weights(model1, model2):
model1.eval()
model2.eval()
with torch.no_grad():
m1_std = model1.state_dict().values()
m2_std = model2.state_dict().values()
for m1, m2 in zip(m1_std, m2_std):
m1.copy_(m2)
state = {'model': model1.half()}
torch.save(state, 'weights/bestpt')
model1 is the dst model model2 is the src model
Thanks for this piece of code. But it looks like the architecture of ultralytics' YOLO is different from what your code has. Can you please confirm?
Can you share insights/code to convert ultralytics models to your version of yolo. I am specifically looking for conversion of yolov8. These are different from the base models you have provided.