-
In above video, I noticed that model_2.train( ) is not included epoch loop or above. Before that model, model.train is included in every model epoch loop. Why is that not included? |
Beta Was this translation helpful? Give feedback.
Answered by
mrdbourke
Aug 9, 2022
Replies: 1 comment 1 reply
-
Hey @dsnal, Good question!
So it doesn't always have to be called but it should usually be called after calling For example (the code is just an example and not a full training/testing loop): # Training loop
model.train() # this is the default
for x in training_data:
model(x)
# Testing loop
model.eval()
for x in test_data:
model(x) So if you're training: call And if you're testing/making predictions: call |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dsnal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @dsnal,
Good question!
model.train()
is the default state of the model.So it doesn't always have to be called but it should usually be called after calling
model.eval()
.For example (the code is just an example and not a full training/testing loop):
So if you're training: call
model.train()
.And if you're testing/making predictions: call
model.eval()