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
I have successfully reproduced all the steps up to the point before the testing phase, as shown in the provided plots, and everything was working without any errors. However, when I reached the testing step, I encountered the following error:
AttributeError: 'GEARS' object has no attribute 'best_model'
I am unsure why this error occurs, as the code leading up to this point seems to work as expected. I am initializing the model with the following code:
Check if model and best_model are properly initialized
if not hasattr(gears_model, 'model') or gears_model.model is None:
gears_model.model_initialize() # Initialize model if not already done
if not hasattr(gears_model, 'best_model') or gears_model.best_model is None:
gears_model.best_model = gears_model.model.to(gears_model.device) # Initialize best_model
I suspect the issue might be related to how best_model or model is initialized or used within the class. In the class definition, self.config = None is set in the constructor (init), and self.model = GEARS_Model(self.config).to(self.device) is assigned in the model_initialize function.
Would you be able to provide any insights on what might be causing the error or how to correctly initialize best_model?
Thank you for your help!
The text was updated successfully, but these errors were encountered:
Hello,
I have successfully reproduced all the steps up to the point before the testing phase, as shown in the provided plots, and everything was working without any errors. However, when I reached the testing step, I encountered the following error:
AttributeError: 'GEARS' object has no attribute 'best_model'
I am unsure why this error occurs, as the code leading up to this point seems to work as expected. I am initializing the model with the following code:
Check if model and best_model are properly initialized
if not hasattr(gears_model, 'model') or gears_model.model is None:
gears_model.model_initialize() # Initialize model if not already done
if not hasattr(gears_model, 'best_model') or gears_model.best_model is None:
gears_model.best_model = gears_model.model.to(gears_model.device) # Initialize best_model
Continue with evaluation
test_res = evaluate(
gears_model.dataloader['test_loader'],
gears_model.best_model,
gears_model.config['uncertainty'],
gears_model.device
)
I suspect the issue might be related to how best_model or model is initialized or used within the class. In the class definition, self.config = None is set in the constructor (init), and self.model = GEARS_Model(self.config).to(self.device) is assigned in the model_initialize function.
Would you be able to provide any insights on what might be causing the error or how to correctly initialize best_model?
Thank you for your help!
The text was updated successfully, but these errors were encountered: