You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I training your net ,The console feed me back "File "C:\Python39\lib\site-packages\torch\nn\modules\module.py", line 201, in _forward_unimplemented
raise NotImplementedError
NotImplementedError"
How can I solve it?
The text was updated successfully, but these errors were encountered:
trained_model = EfficientNet.from_pretrained('efficientnet-b0') model = nn.Sequential(*list(trained_model.children())[:-1],Flatten(),nn.Linear(1536,7)).to(device) optimizer=optim.Adam(model.parameters(),lr=lr) criteon=nn.CrossEntropyLoss() best_acc,best_epoch=0,0 global_step=0 viz.line([[0.0,0.0]],[0.],win='test',opts=dict(title='Loss on Training Data and Accuracy on Training Data',xlabel='Epochs',ylabel='Loss and Accuracy',legend=['loss','val_acc'])) for epoch in range(epochs): for step,(x,y) in enumerate(train_loader): x,y = x.to(device),y.to(device) model.train() logits=model(x) loss=criteon(logits,y) optimizer.zero_grad() loss.backward() optimizer.step() viz.line([[loss.item(),evalute(model,val_loader)]],[global_step],win='test',update='append') global_step+=1 if epoch==0: print('the '+str(epoch+1)+' epoch'+' training......') val_acc=evalute(model,val_loader) if val_acc>best_acc: best_epoch=epoch best_acc=val_acc torch.save(model.state_dict(),'best_trans.mdl') print('best accuracy:',best_acc,'best epoch:',(best_epoch+1)) torch.save(model,'model.dll')
However, I do not know what I do is wrong.
when I training your net ,The console feed me back "File "C:\Python39\lib\site-packages\torch\nn\modules\module.py", line 201, in _forward_unimplemented
raise NotImplementedError
NotImplementedError"
How can I solve it?
The text was updated successfully, but these errors were encountered: