NVIDIA / vid2vid

Pytorch implementation of our method for high-resolution (e.g. 2048x1024) photorealistic video-to-video translation.
Other
8.6k stars 1.2k forks source link

flownet2_pytorch_040.zip failed to be built. #86

Open jiapei100 opened 5 years ago

jiapei100 commented 5 years ago

Hi, all:

  1. My environment:
➜  vid2vid git:(master) python --version
Python 3.6.7
➜  vid2vid git:(master) python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.1.0a0+b6a8c45'
>>> torch.__file__
'~/.local/lib/python3.6/site-packages/torch/__init__.py'
  1. I can successfully run the following 3 scripts,

    ➜  vid2vid git:(master) python scripts/download_datasets.py 
    ➜  vid2vid git:(master) python scripts/download_gdrive.py 
    ➜  vid2vid git:(master) python scripts/download_models_flownet2.py 

but FAILED to run the 4th script:

➜  vid2vid git:(master) python scripts/download_flownet2.py 
Compiling correlation kernels by nvcc...
rm: cannot remove '../_ext': No such file or directory
Traceback (most recent call last):
  File "build.py", line 3, in <module>
    import torch.utils.ffi
  File "~/.local/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
Compiling resample2d kernels by nvcc...
rm: cannot remove 'Resample2d_kernel.o': No such file or directory
rm: cannot remove '../_ext': No such file or directory
In file included from Resample2d_kernel.cu:1:0:
~/.local/lib/python3.6/site-packages/torch/lib/include/THC/THC.h:4:10: fatal error: THC/THCGeneral.h: No such file or directory
 #include <THC/THCGeneral.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "build.py", line 3, in <module>
    import torch.utils.ffi
  File "~/.local/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
Compiling channelnorm kernels by nvcc...
rm: cannot remove 'ChannelNorm_kernel.o': No such file or directory
rm: cannot remove '../_ext': No such file or directory
In file included from ChannelNorm_kernel.cu:1:0:
~/.local/lib/python3.6/site-packages/torch/lib/include/THC/THC.h:4:10: fatal error: THC/THCGeneral.h: No such file or directory
 #include <THC/THCGeneral.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "build.py", line 3, in <module>
    import torch.utils.ffi
  File "~/.local/lib/python3.6/site-packages/torch/utils/ffi/__init__.py", line 1, in <module>
    raise ImportError("torch.utils.ffi is deprecated. Please use cpp extensions instead.")
ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead.
  1. However, file THC/THCGeneral.h exists indeed.
➜  vid2vid git:(master) ls ~/.local/lib/python3.6/site-packages/torch/lib/include/THC/THC.h
~/.local/lib/python3.6/site-packages/torch/lib/include/THC/THC.h
➜  vid2vid git:(master) ls ~/.local/lib/python3.6/site-packages/torch/lib/include/THC/THCGeneral.h
~/.local/lib/python3.6/site-packages/torch/lib/include/THC/THCGeneral.h
  1. flownet2_pytorch_040.zip ? Or flownet2_pytorch git?

File ./scripts/download_flownet2.py seems to require torch 0.4.1 and flownet2_pytorch_040.zip ?

I'm using up-to-date PyTorch, and I've successfully built and installed the up-to-date official flownet2-pytorch. I mean: it seems I do NOT need to run the 4th script at all.

import os
from download_gdrive import *
import torch

if torch.__version__ == '0.4.1':
    file_id = '1gKwE1Ad41TwtAzwDcN3dYa_S6DcVyiSl'
    file_name = 'flownet2_pytorch_041.zip'
else:
    file_id = '1F2h_6e8gyTqxnbmFFW72zsxx_JX0dKFo'   
    file_name = 'flownet2_pytorch_040.zip'

chpt_path = './models/'
if not os.path.isdir(chpt_path):
    os.makedirs(chpt_path)
destination = os.path.join(chpt_path, file_name)
download_file_from_google_drive(file_id, destination) 
unzip_file(destination, chpt_path)
os.system('cd %s/flownet2_pytorch/; bash install.sh; cd ../' % chpt_path)
  1. What I've done afterwards is to use the up-to-date official flownet2-pytorch, instead of using the unzipped flownet2_pytorch_040.zip.

Then, vid2vid testing still went wrong:

➜  vid2vid git:(master) ✗ python test.py --name label2city_2048 --label_nc 35 --loadSize 2048 --n_scales_spatial 3 --use_instance --fg --use_single_G
------------ Options -------------
add_face_disc: False
aspect_ratio: 1.0
basic_point_only: False
batchSize: 1
checkpoints_dir: ./checkpoints
dataroot: datasets/Cityscapes/
dataset_mode: temporal
debug: False
densepose_only: False
display_id: 0
display_winsize: 512
feat_num: 3
fg: True
fg_labels: [26]
fineSize: 512
gpu_ids: [0]
how_many: 300
input_nc: 3
isTrain: False
label_feat: False
label_nc: 35
loadSize: 2048
load_features: False
load_pretrain: 
max_dataset_size: inf
model: vid2vid
nThreads: 2
n_blocks: 9
n_blocks_local: 3
n_downsample_E: 3
n_downsample_G: 3
n_frames_G: 3
n_gpus_gen: 1
n_local_enhancers: 1
n_scales_spatial: 3
name: label2city_2048
ndf: 64
nef: 32
netE: simple
netG: composite
ngf: 128
no_canny_edge: False
no_dist_map: False
no_first_img: False
no_flip: False
no_flow: False
norm: batch
ntest: inf
openpose_only: False
output_nc: 3
phase: test
random_drop_prob: 0.05
random_scale_points: False
remove_face_labels: False
resize_or_crop: scaleWidth
results_dir: ./results/
serial_batches: False
start_frame: 0
tf_log: False
use_instance: True
use_real_img: False
use_single_G: True
which_epoch: latest
-------------- End ----------------
CustomDatasetDataLoader
dataset [TestDataset] was created
vid2vid
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    model = create_model(opt)
  File "....../vid2vid/models/models.py", line 7, in create_model
    from .vid2vid_model_G import Vid2VidModelG
  File "....../vid2vid/models/vid2vid_model_G.py", line 13, in <module>
    from . import networks
  File "....../vid2vid/models/networks.py", line 12, in <module>
    from .flownet2_pytorch.networks.resample2d_package.resample2d import Resample2d
ModuleNotFoundError: No module named 'models.flownet2_pytorch'
  1. Finally, I tried from bash,
➜  ~ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import resample2d_cuda
>>> resample2d_cuda.
resample2d_cuda.backward(  resample2d_cuda.forward(
>>> from resample2d_cuda import Resample2d
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Resample2d'

Clearly, there are 2 functions ONLY,

Can anybody please give me a hand?

Cheers Pei

aixplrer commented 5 years ago

I think you can try as following:

  1. Don't use flownet2_pytorch_040.zip at all, pls use "flownet2_pytorch_041.zip"
  2. And how to get the "flownet2_pytorch_041.zip", there is very simple way, type "https://docs.google.com/uc?export=download&id=1gKwE1Ad41TwtAzwDcN3dYa_S6DcVyiSl" in your browser's URL Bar and Enter directly.
  3. Unzip the file you downloaded from the Google-Driver a moment ago, the unzipped folder name should be : [flownet2_pytorch]
  4. Copy [flownet2_pytorch] to the location: $yourWorkingPath$/vid2vid/models/
  5. And go to the location: $yourWorkingPath$/vid2vid/models/flownet2_pytorch/, run the command: bash install.sh

    if you have set up the CUDA Support on your laptop or Mac computer, I guess you might have gotten the successful result.