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

hi, can anyone help me , how to setup this project on windows for the testng purpose using cpu, pls? #8

Open
AyeshaShafique opened this issue Dec 22, 2020 · 23 comments

Comments

@AyeshaShafique
Copy link

No description provided.

@AyeshaShafique
Copy link
Author

its and urgent task

@minar09
Copy link
Owner

minar09 commented Dec 22, 2020

Hi @AyeshaShafique ,
I ran and tested this project in windows, so I think you can do as well. For using in CPU, please check the following:

  1. Install the requirements
  2. Provide the gpu id argument value "-1" for CPU and try to run the test.py:
    self.parser.add_argument('--gpu_ids', type=str, default='0,1,2,3',
  3. If there's some error due to .cuda() ending, remove .cuda() from the code
    Hope that helps. Thanks.

@AyeshaShafique
Copy link
Author

thank u so much for ur reply

i need to remove .cuda() from everyline of code?

@AyeshaShafique
Copy link
Author

AttributeError: 'Pix2PixHDModel' object has no attribute 'module'

facing this error

@minar09
Copy link
Owner

minar09 commented Dec 22, 2020

thank u so much for ur reply

i need to remove .cuda() from everyline of code?

Maybe First try to run without removing. Then if you get an error somewhere due to .cuda(), then remove that one and try running again if you don't wanna remove all of them.

@minar09
Copy link
Owner

minar09 commented Dec 22, 2020

AttributeError: 'Pix2PixHDModel' object has no attribute 'module'

facing this error

Can you please provide more details for the error. Thanks.

@AyeshaShafique
Copy link
Author

i was getting error with .cuda(), so i removed and ran it .

now facing this

latest_net_U.pth
latest_net_G1.pth
latest_net_G2.pth
latest_net_G.pth
?
?
C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the transf
orms.Scale transform is deprecated, please use transforms.Resize instead.
warnings.warn("The use of the transforms.Scale transform is deprecated, " +
C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the transf
orms.Scale transform is deprecated, please use transforms.Resize instead.
warnings.warn("The use of the transforms.Scale transform is deprecated, " +
C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn_reduction.py:43: UserWarning: size_average and reduce args will be
deprecated, please use reduction='mean' instead.
warnings.warn(warning.format(ret))
C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:1558: UserWarning: nn.functional.tanh is deprecated.
Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:3226: UserWarning: Default grid_sample and affine_gri
d behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desi
red. See the documentation of grid_sample for details.
warnings.warn("Default grid_sample and affine_grid behavior has changed "
..\torch\csrc\utils\python_arg_parser.cpp:756: UserWarning: This overload of nonzero is deprecated:
nonzero(Tensor input, *, Tensor out)
Consider using one of the following signatures instead:
nonzero(Tensor input, *, bool as_tuple)
Traceback (most recent call last):
File ".\test.py", line 154, in
loss_dict = dict(zip(model.module.loss_names, losses))
File "C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 594, in getattr
type(self).name, name))
AttributeError: 'Pix2PixHDModel' object has no attribute 'module'

@AyeshaShafique
Copy link
Author

someone provided this solution, but im not sure where to add this,

This will solve the issue, after model.initialize(), add the below code .Here,the model is wrapped around the DataParallel and the 'module' attribute is coming from here.
model = torch.nn.DataParallel(model, device_ids=[0]) #0 because of only 1 GPU, add [0,1,2,3] if you have multiple GPUs

@minar09
Copy link
Owner

minar09 commented Dec 22, 2020

You can try this one maybe:

BaseModel.initialize(self, opt)

@AyeshaShafique
Copy link
Author

i dont know how to add here :(

@AyeshaShafique
Copy link
Author

i think the above issue is resolved. now the test.py is running .

logs are here:

C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the trans
orms.Scale transform is deprecated, please use transforms.Resize instead.
warnings.warn("The use of the transforms.Scale transform is deprecated, " +
C:\Users\Khizer\anaconda3\lib\site-packages\torchvision\transforms\transforms.py:210: UserWarning: The use of the trans
orms.Scale transform is deprecated, please use transforms.Resize instead.
warnings.warn("The use of the transforms.Scale transform is deprecated, " +
C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn_reduction.py:43: UserWarning: size_average and reduce args will b
deprecated, please use reduction='mean' instead.
warnings.warn(warning.format(ret))
C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:1558: UserWarning: nn.functional.tanh is deprecated.
Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
C:\Users\Khizer\anaconda3\lib\site-packages\torch\nn\functional.py:3226: UserWarning: Default grid_sample and affine_gr
d behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is des
red. See the documentation of grid_sample for details.
warnings.warn("Default grid_sample and affine_grid behavior has changed "
..\torch\csrc\utils\python_arg_parser.cpp:756: UserWarning: This overload of nonzero is deprecated:
nonzero(Tensor input, *, Tensor out)
Consider using one of the following signatures instead:
nonzero(Tensor input, *, bool as_tuple)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

what does these number mean, plus where i will get the results?

@minar09
Copy link
Owner

minar09 commented Dec 23, 2020

Great! This number means the serial of output images that are being saved. You will get the results in the directory given here:

self.parser.add_argument(

@AyeshaShafique
Copy link
Author

AyeshaShafique commented Dec 23, 2020 via email

@minar09
Copy link
Owner

minar09 commented Dec 23, 2020

Can you please provide sample input images? That would be great.
If you are talking about person-to-person clothing transfer, then you can refer to the research works like SwapNet, O-VITON, Human appearance transfer, etc. Thanks.

@AyeshaShafique
Copy link
Author

AyeshaShafique commented Dec 23, 2020 via email

@AyeshaShafique
Copy link
Author

AyeshaShafique commented Dec 23, 2020 via email

@nitintyagi-ai
Copy link

nitintyagi-ai commented Feb 3, 2021

You can try this one maybe:

BaseModel.initialize(self, opt)

Hi @MinaR,
I have removed .cuda() wherever it is giving error. After that I am struggling with "AttributeError: 'Pix2PixHDModel' object has no attribute 'module" issue even solution which you have provided. Any help will be appreciated.

BaseModel.initialize(self, opt)

its include in pix2pixHD_model.py file.

You can try this one maybe:

BaseModel.initialize(self, opt)

@minar09
Copy link
Owner

minar09 commented Feb 6, 2021

@nitintyagi-ai, actually I haven't tried this repo in CPU. So it's better if you refer to the original repository and their discussions: https://github.com/switchablenorms/DeepFashion_Try_On .
Hope you can solve your issues.

@yfedberts
Copy link

@nitintyagi-ai, actually I haven't tried this repo in CPU. So it's better if you refer to the original repository and their discussions: https://github.com/switchablenorms/DeepFashion_Try_On .
Hope you can solve your issues.

Hi there! Seems like issues on the original repo are no longer answered, hoping that you might have an answer about running on the CPU. I've added the -1 but it seems like it's still trying to run on CUDA.

RuntimeError: CUDA out of memory. Tried to allocate 26.00 MiB (GPU 0; 4.00 GiB total capacity; 2.78 GiB already allocated; 25.22 MiB free; 2.79 GiB reserved in total by PyTorch)

Any answers or insights are greatly appreciated!

@minar09
Copy link
Owner

minar09 commented Feb 20, 2021

Hi @mystickal , for running the repo in CPU, you can follow the discussion above one by one.
And for your error, it seems like OOM error, so you can try running with lower batch sizes. Good luck.

@yfedberts
Copy link

Hi @mystickal , for running the repo in CPU, you can follow the discussion above one by one.
And for your error, it seems like OOM error, so you can try running with lower batch sizes. Good luck.

Hi @minar09 thanks for the reply! I've followed the discussion above but am getting different errors. As for the batch size any insight as to where I can modify that? It seems like it's already set to 1 on the base_options file?

Thanks in advance!

@minar09
Copy link
Owner

minar09 commented Mar 1, 2021

@mystickal , I think base_options is the place to change the batch size. If you still getting OOM error, then you might need higher memory or GPU. For CPU running, remove the .cuda from the code and try to run.

@yfedberts
Copy link

@mystickal , I think base_options is the place to change the batch size. If you still getting OOM error, then you might need higher memory or GPU. For CPU running, remove the .cuda from the code and try to run.

It's already set to 1 by default and removing the cuda causes a ton of errors unfortunately, guess I'll need a better GPU. Thank you anyways for the response!

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

4 participants