YuvalNirkin / fsgan

FSGAN - Official PyTorch Implementation
https://nirkin.com/fsgan
Creative Commons Zero v1.0 Universal
749 stars 147 forks source link

Version problem? #142

Open kkafieh opened 3 years ago

kkafieh commented 3 years ago

I am just trying to get this running for the first time. Running on RTX 3060

On trying my first swap with the example files I initially had an incompatibility message for my 3060, but installing pytorch v1.8.0 and cuda 11.3 fixed that. (conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge)

I then received an error: "RuntimeError: Cache file does not exist: ../docs/examples/shinzo_abe\shinzo_abe_dsfd_seq.pkl" Which I finally got passed by copying and renaming another pkl file. It seemed to allow the process to continue. although obviously its pretty sketchy.

Now I have this problem...

=> Cropping video sequences from video: "shinzo_abe.mp4"...
Traceback (most recent call last):
  File "swap.py", line 504, in <module>
    main(**vars(parser.parse_args()))
  File "swap.py", line 498, in main
    face_swapping(source[0], target[0], output, select_source, select_target)
  File "swap.py", line 239, in __call__
    source_cache_dir, source_seq_file_path, _ = self.cache(source_path)
  File "C:\DATA\DEV\PROJECTS\fsgan\preprocess\preprocess_video.py", line 457, in cache
    crop_video_sequences_main(input_path, output_dir, seq_file_path, self.seq_postfix, self.resolution,
  File "C:\DATA\DEV\PROJECTS\fsgan\preprocess\crop_video_sequences.py", line 53, in main
    curr_vid_name = os.path.splitext(os.path.basename(input_path))[0] + '_seq%02d.mp4' % seq.id
AttributeError: 'numpy.ndarray' object has no attribute 'id'

No "id" attribute? This looked like a programming error. I poked around in the code, but I am new to python and couldn't spot anything obvious. But also, the code should already be fine.

Is this an interpreter version problem? Somrthing else?

Python version 3.8.8 Pytorch version 1.8.0 Conda version 4.10.1 Cuda version 11.3.109

YuvalNirkin commented 3 years ago

Try deleting all the cache files and running it again.

kkafieh commented 3 years ago

Out of Memory.

I deleted... -shinzo_abe_dsfd.pkl -shinzo_abe_dsfd_seq.pkl

Is there anything else I should have deleted? Not sure what the cache files are other than that.

It seemed to get much further. But now I get the Out of memory error below...

 File "swap.py", line 504, in <module>
    main(**vars(parser.parse_args()))
  File "swap.py", line 498, in main
    face_swapping(source[0], target[0], output, select_source, select_target)
  File "swap.py", line 240, in __call__
    target_cache_dir, target_seq_file_path, _ = self.cache(target_path)
  File "C:\DATA\DEV\PROJECTS\fsgan\preprocess\preprocess_video.py", line 446, in cache
    self.face_detector(input_path, det_file_path)
  File "C:\DATA\DEV\PROJECTS\face_detection_dsfd\face_detector.py", line 92, in __call__
    detections_batch = self.net(frame_tensor_batch)
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\DATA\DEV\PROJECTS\face_detection_dsfd\face_ssd_infer.py", line 415, in forward
    sources[0] = self.cpm3_3(sources[0])
  File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\DATA\DEV\PROJECTS\face_detection_dsfd\face_ssd_infer.py", line 47, in forward
    return torch.cat((x1_1, x2_1, x3_1), 1)
RuntimeError: CUDA out of memory. Tried to allocate 1.98 GiB (GPU 0; 12.00 GiB total capacity; 7.45 GiB already allocated; 0 bytes free; 9.52 GiB reserved in total by PyTorch)
Kwakyejin commented 1 year ago

I have the same issue. Did you solved it? @kkafieh Is it general issue? @YuvalNirkin

kkafieh commented 1 year ago

No. We gave up.

What kind of card so you have? We have a GeForce 3060.

Kwakyejin commented 1 year ago

I have Quadro RTX 5000