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

Using next() instead of .next() in trainloaders #6

Open
cs-mshah opened this issue Jan 13, 2023 · 1 comment
Open

Using next() instead of .next() in trainloaders #6

cs-mshah opened this issue Jan 13, 2023 · 1 comment

Comments

@cs-mshah
Copy link

The .next() should be changed to the following (stackoverflow):

model.train()
for batch_idx in range(args.train_iteration):
    try:
        inputs_x, targets_x, _ = next(labeled_train_iter)
    except:
        labeled_train_iter = iter(labeled_trainloader)
        inputs_x, targets_x, _ = next(labeled_train_iter)

    try:
        (inputs_u, inputs_u2), _, _ = next(unlabeled_train_iter)
    except:
        unlabeled_train_iter = iter(unlabeled_trainloader)
        (inputs_u, inputs_u2), _, _ = next(unlabeled_train_iter)
@cs-mshah
Copy link
Author

cs-mshah commented Jan 13, 2023

It would be better to add a requirements.txt file to avoid conflicts/missing imports.
A few missing imports I encountered as compared to a standard PyTorch environment:
pip install progress
pip install tensorboardX

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

No branches or pull requests

1 participant