EvelynFan / FaceFormer

[CVPR 2022] FaceFormer: Speech-Driven 3D Facial Animation with Transformers
MIT License
783 stars 133 forks source link

error when running prediction demo part #4

Closed khalidhnv closed 2 years ago

khalidhnv commented 2 years ago

I wanted to test the prediction part by running demo script. I've set the environment and data as explained in the documentation but there's code level error when i run below command

 python demo.py --model_name vocaset --wav_path "demo/wav/test.wav" --dataset vocaset --vertice_dim 15069 --feature_dim 64 --period 30  --fps 30  --train_subjects "FaceTalk_170728_03272_TA FaceTalk_170904_00128_TA FaceTalk_170725_00137_TA FaceTalk_170915_00223_TA FaceTalk_170811_03274_TA FaceTalk_170913_03279_TA FaceTalk_170904_03276_TA FaceTalk_170912_03278_TA" --test_subjects "FaceTalk_170809_00138_TA FaceTalk_170731_00024_TA" --condition FaceTalk_170913_03279_TA --subject FaceTalk_170809_00138_TA

The error happens in Wav2Vec part and looks as below

Traceback (most recent call last):
  File "/home/shounan/Development/FaceFormer/demo.py", line 204, in <module>
    main()
  File "/home/shounan/Development/FaceFormer/demo.py", line 200, in main
    test_model(args)
  File "/home/xxx/Development/FaceFormer/demo.py", line 57, in test_model
    prediction = model.predict(audio_feature, template, one_hot)
  File "/home/xxx/Development/FaceFormer/faceformer.py", line 140, in predict
    hidden_states = self.audio_encoder(audio, self.dataset).last_hidden_state
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xxx/Development/FaceFormer/wav2vec.py", line 140, in forward
    return_dict=return_dict,
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 812, in forward
    position_embeddings = self.pos_conv_embed(hidden_states)
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 446, in forward
    hidden_states = hidden_states.transpose(1, 2)
AttributeError: 'tuple' object has no attribute 'transpose'

So I was wondering if the authors or anyone else had issues running current version of code

Additional env info:

EvelynFan commented 2 years ago

I wanted to test the prediction part by running demo script. I've set the environment and data as explained in the documentation but there's code level error when i run below command

 python demo.py --model_name vocaset --wav_path "demo/wav/test.wav" --dataset vocaset --vertice_dim 15069 --feature_dim 64 --period 30  --fps 30  --train_subjects "FaceTalk_170728_03272_TA FaceTalk_170904_00128_TA FaceTalk_170725_00137_TA FaceTalk_170915_00223_TA FaceTalk_170811_03274_TA FaceTalk_170913_03279_TA FaceTalk_170904_03276_TA FaceTalk_170912_03278_TA" --test_subjects "FaceTalk_170809_00138_TA FaceTalk_170731_00024_TA" --condition FaceTalk_170913_03279_TA --subject FaceTalk_170809_00138_TA

The error happens in Wav2Vec part and looks as below

Traceback (most recent call last):
  File "/home/shounan/Development/FaceFormer/demo.py", line 204, in <module>
    main()
  File "/home/shounan/Development/FaceFormer/demo.py", line 200, in main
    test_model(args)
  File "/home/xxx/Development/FaceFormer/demo.py", line 57, in test_model
    prediction = model.predict(audio_feature, template, one_hot)
  File "/home/xxx/Development/FaceFormer/faceformer.py", line 140, in predict
    hidden_states = self.audio_encoder(audio, self.dataset).last_hidden_state
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xxx/Development/FaceFormer/wav2vec.py", line 140, in forward
    return_dict=return_dict,
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 812, in forward
    position_embeddings = self.pos_conv_embed(hidden_states)
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/xxx/miniconda3/envs/faceformer/lib/python3.7/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 446, in forward
    hidden_states = hidden_states.transpose(1, 2)
AttributeError: 'tuple' object has no attribute 'transpose'

So I was wondering if the authors or anyone else had issues running current version of code

Additional env info:

  • Ubuntu 20.04
  • transformers 4.17.0 (latest)

Hi, this might be caused by different versions of transformers. The version of transformers should be 4.6.1. I will update the version info.

khalidhnv commented 2 years ago

thank you very much for prompt response! changing transformers version solved the issue, there's another error with pyrenderer but it's not related to this.