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

RuntimeError in python3 #35

Closed
CherylZR opened this issue Jan 5, 2018 · 8 comments
Closed

RuntimeError in python3 #35

CherylZR opened this issue Jan 5, 2018 · 8 comments

Comments

@CherylZR
Copy link

CherylZR commented Jan 5, 2018

Hi! Thank you very much for sharing your code. I encountered some error when training from scratch with celeba blond hair translation using python 3 according to the usage. The itertool.izip in python2 is changed to the built-in zip in python3:

Traceback (most recent call last): File "cocogan_train.py", line 88, in <module> main(sys.argv) File "cocogan_train.py", line 56, in main for it, (images_a, images_b) in enumerate(zip(train_loader_a,train_loader_b)): File "/home/fox/anaconda3/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 301, in __iter__ return DataLoaderIter(self) File "/home/fox/anaconda3/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 171, in __init__ self._put_indices() File "/home/fox/anaconda3/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 210, in _put_indices indices = next(self.sample_iter, None) File "/home/fox/anaconda3/lib/python3.5/site-packages/torch/utils/data/sampler.py", line 115, in __iter__ for idx in self.sampler: File "/home/fox/anaconda3/lib/python3.5/site-packages/torch/utils/data/sampler.py", line 50, in __iter__ return iter(torch.randperm(len(self.data_source)).long()) RuntimeError: invalid argument 1: must be strictly positive at /opt/conda/conda-bld/pytorch_1503968623488/work/torch/lib/TH/generic/THTensorMath.c:2033
How can I fix this problem?

@mingyuliutw
Copy link
Owner

Please check Issue 17.
#17

@benjaminlinken
Copy link

@CherylZR I also met the same question. Have you solved it?

@benjaminlinken
Copy link

@mingyuliutw
Hi! I don't quite understand what you mean. Does Issue 17 have anything to do with this issue?

@CherylZR
Copy link
Author

@benjaminlinken I rewrote the dataloader in python 3 and solved it.

@benjaminlinken
Copy link

@CherylZR Can you tell me how you rewrote the dataloader?

@CherylZR
Copy link
Author

@benjaminlinken it's very simple by just setting the right dataset, sample mode, etc. you can refer to the official document

@benjaminlinken
Copy link

@CherylZR Can you please tell me more details? I really don't know how to rewrote the dataloader.

@benjaminlinken
Copy link

@CherylZR Or you can send the modified files to my email, my email is 1278217355@qq.com. Thank you for your help!

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

3 participants