Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://pytorch-ignite.ai/tutorials/beginner/01-getting-started/ does it run training loop twice? #3188

Closed
inikishev opened this issue Jan 12, 2024 · 2 comments
Labels

Comments

@inikishev
Copy link

inikishev commented Jan 12, 2024

https://pytorch-ignite.ai/tutorials/beginner/01-getting-started

its says this

trainer = create_supervised_trainer(model, optimizer, criterion, device)

val_metrics = {
    "accuracy": Accuracy(),
    "loss": Loss(criterion)
}

train_evaluator = create_supervised_evaluator(model, metrics=val_metrics, device=device)
val_evaluator = create_supervised_evaluator(model, metrics=val_metrics, device=device)

Does that mean after trainer runs training epoch it will run train_evaluator through the entire train dataset to calculate losses again? Or am I misunderstanding something?

@inikishev inikishev added the docs label Jan 12, 2024
@vfdev-5
Copy link
Collaborator

vfdev-5 commented Jan 12, 2024

Below you can see the following:
image

So, yes, on each completed epoch we run train_evaluator.run(train_loader) on entire training dataloader to compute average loss value. This is optional and helps to see model's generalization capability. For large datasets we can also create a special train_eval_loader of size of validation dataset.

Keep also in mind that the average loss indicated during the training is not the one computed separately over the training set as during the training the model is updated on each iteration.

@inikishev
Copy link
Author

ok thanks😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants