TypeError: tensor is not a torch image
Askejm opened this issue · 1 comments
Askejm commented
I was trying to train the stem when I ran into this issue
Constructing networks...
loaded imagenet embeddings from in_embeddings/tf_efficientnet_lite0.pkl: Embedding(1000, 320)
Setting up PyTorch plugin "bias_act_plugin"... Done.
Setting up PyTorch plugin "filtered_lrelu_plugin"... Done.
Generator Parameters Buffers Output shape Datatype
--- --- --- --- ---
mapping.fc0 33280 - [16, 512] float32
mapping.fc1 262656 - [16, 512] float32
mapping 320000 512 [16, 9, 512] float32
synthesis.input.affine 2052 - [16, 4] float32
synthesis.input 262144 1545 [16, 512, 36, 36] float32
synthesis.L0_36_512.affine 262656 - [16, 512] float32
synthesis.L0_36_512 2359808 25 [16, 512, 36, 36] float16
synthesis.L1_36_512.affine 262656 - [16, 512] float32
synthesis.L1_36_512 2359808 25 [16, 512, 36, 36] float16
synthesis.L2_36_512.affine 262656 - [16, 512] float32
synthesis.L2_36_512 2359808 25 [16, 512, 36, 36] float16
synthesis.L3_52_512.affine 262656 - [16, 512] float32
synthesis.L3_52_512 2359808 37 [16, 512, 52, 52] float16
synthesis.L4_52_512.affine 262656 - [16, 512] float32
synthesis.L4_52_512 2359808 25 [16, 512, 52, 52] float16
synthesis.L5_52_512.affine 262656 - [16, 512] float32
synthesis.L5_52_512 2359808 25 [16, 512, 52, 52] float16
synthesis.L6_32_512.affine 262656 - [16, 512] float32
synthesis.L6_32_512 2359808 25 [16, 512, 32, 32] float16
synthesis.L7_32_3.affine 262656 - [16, 512] float32
synthesis.L7_32_3 1539 1 [16, 3, 32, 32] float16
synthesis - - [16, 3, 32, 32] float32
--- --- --- --- ---
Total 19501575 2245 - -
C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Traceback (most recent call last):
File "C:\Users\askee\Documents\vscode\stylegan_xl\train.py", line 336, in <module>
main() # pylint: disable=no-value-for-parameter
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\askee\Documents\vscode\stylegan_xl\train.py", line 321, in main
launch_training(c=c, desc=desc, outdir=opts.outdir, dry_run=opts.dry_run)
File "C:\Users\askee\Documents\vscode\stylegan_xl\train.py", line 104, in launch_training
subprocess_fn(rank=0, c=c, temp_dir=temp_dir)
File "C:\Users\askee\Documents\vscode\stylegan_xl\train.py", line 49, in subprocess_fn
training_loop.training_loop(rank=rank, **c)
File "C:\Users\askee\Documents\vscode\stylegan_xl\training\training_loop.py", line 208, in training_loop
misc.print_module_summary(D, [img, c])
File "C:\Users\askee\Documents\vscode\stylegan_xl\torch_utils\misc.py", line 236, in print_module_summary
outputs = module(*inputs)
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\torch\nn\modules\module.py", line 1120, in _call_impl
result = forward_call(*input, **kwargs)
File "C:\Users\askee\Documents\vscode\stylegan_xl\pg_modules\discriminator.py", line 207, in forward
x_n = Normalize(feat.normstats['mean'], feat.normstats['std'])(x_aug)
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\torchvision\transforms\transforms.py", line 163, in __call__
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "C:\Users\askee\anaconda3\envs\sgxl\lib\site-packages\torchvision\transforms\functional.py", line 201, in normalize
raise TypeError('tensor is not a torch image.')
TypeError: tensor is not a torch image.
This is my command: python train.py --outdir=checkpoints --cfg=stylegan3-t --data=data/mc32 --workers=6 --gpus=1 --batch=16 --batch-gpu=16 --snap=4 --metrics=none --cbase=16384 --cmax=256 --syn_layers=7
I tried it using the folder created by dataset_tool.py, the zip file, and a folder and zip file of just all the png files.
Windows 10
rtx 3070
Askejm commented
Nvm i got it working.
Deleted the env and started over making sure to install pytorch 1.9.1 with cudatoolkit 11.1 and that fixed it
pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html