dunbar12138 / Audiovisual-Synthesis

Unsupervised Any-to-many Audiovisual Synthesis via Exemplar Autoencoders
120 stars 24 forks source link

error "typeError: forward() got multiple values for argument 'return_unsample'" when running audiovisual training #14

Open harsh-agarwal opened 3 years ago

harsh-agarwal commented 3 years ago

I am getting the following error log when I try running the training for audiovisual synthesis after training my audio branch.

---  ./oliver_train/ already exists!  ---
--- Totally 18227 video frames ---
Encoding Audio of  ./oliver_train.mp4
/extern/home/harshagarwal/miniconda3/envs/av2/lib/python3.7/site-packages/librosa/core/audio.py:146: UserWarning: PySoundFile failed. Trying audioread instead.
  warnings.warn('PySoundFile failed. Trying audioread instead.')
Raw_Data Shape: (80, 72901)
---  logs/oliver_video already exists!  ---
---  ./saved_models/oliver_video already exists!  ---
Trainable Parameters: 4.481M
Loading from ./pretrained_models/oliver.pkl...
Load 254 parameters!
AutoVC Model Loaded
Traceback (most recent call last):
  File "train_audiovisual.py", line 77, in <module>
    G.optimize_parameters_video(dataloader, args.epochs, device, display_freq=args.display_freq, save_freq=args.save_freq, save_dir=save_dir, experimentName=experimentName, initial_niter=args.initial_iter, load_model=args.load_model)
  File "/extern/home/harshagarwal/Audiovisual-Synthesis/model_vc.py", line 631, in optimize_parameters_video
    codes, code_unsample = self.encoder(mel, speaker, return_unsample=True)
  File "/extern/home/harshagarwal/miniconda3/envs/av2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
TypeError: forward() got multiple values for argument 'return_unsample' 

Any help is appreciated!

harsh-agarwal commented 3 years ago

https://github.com/dunbar12138/Audiovisual-Synthesis/blob/master/model_vc.py#L631

codes, code_unsample = self.encoder(mel, speaker, return_unsample=True)

This removes the speaker embedding argument from all the self.encoder function calls. Apparently the encoder definition state it is def without speaker embedding as of now.

The other lines that would need a change are:

Line 647, 706, 708

@dunbar12138 if this is the expected solution please close the issue. If there is a better solution please let me know :)

Thanks!