Doubiiu / CodeTalker

[CVPR 2023] CodeTalker: Speech-Driven 3D Facial Animation with Discrete Motion Prior
MIT License
537 stars 58 forks source link

AttributeError: 'tuple' object has no attribute 'transpose' #49

Open ashutoshbk opened 1 year ago

ashutoshbk commented 1 year ago

when running, !sh scripts/demo.sh vocaset

Some weights of Wav2Vec2Model were not initialized from the model checkpoint at facebook/wav2vec2-base-960h and are newly initialized: ['wav2vec2.masked_spec_embed']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
=> loading checkpoint 'vocaset/vocaset_stage2.pth.tar'
=> loaded checkpoint 'vocaset/vocaset_stage2.pth.tar'
Generating facial animation for demo/wav/man.wav...
2023-08-01 13:21:18.492516: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Traceback (most recent call last):
  File "/content/CodeTalker/main/demo.py", line 219, in <module>
    main()
  File "/content/CodeTalker/main/demo.py", line 129, in main
    test(model, cfg.demo_wav_path, save_folder, condition, subject)
  File "/content/CodeTalker/main/demo.py", line 167, in test
    prediction = model.predict(audio_feature, template, one_hot)
  File "/content/CodeTalker/models/stage2.py", line 115, in predict
    hidden_states = self.audio_encoder(audio, self.dataset).last_hidden_state
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/content/CodeTalker/models/lib/wav2vec.py", line 132, in forward
    encoder_outputs = self.encoder(
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 788, in forward
    position_embeddings = self.pos_conv_embed(hidden_states)
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 397, in forward
    hidden_states = hidden_states.transpose(1, 2)
AttributeError: 'tuple' object has no attribute 'transpose'
Doubiiu commented 1 year ago

Hi, please make sure the package version is correct following the requirements.txt. I think transformers==4.6.1 can solve this problem.

ashutoshbk commented 1 year ago

hey, it is transformers==4.6.1. Actually i am running demo colab notebook provided by you. I am running without changing anything still same error.

Utkarsh-shift commented 1 year ago

same issue

mmxuan18 commented 5 months ago

same issue