genjib / lavish Goto Github PK
View Code? Open in Web Editor NEWVision Transformers are Parameter-Efficient Audio-Visual Learners
Vision Transformers are Parameter-Efficient Audio-Visual Learners
LAVISH-main/AVQA/net_grd_avst/net_avst.py", line 270, in init
self.nce_av = InfoNCELoss(margin=opt.tmp_av)
NameError: name 'InfoNCELoss' is not defined
File "/home/LAVisH/LAVISH-main/AVQA/net_grd_avst/net_avst.py", line 317, in forward
audio = repeat(audio, 'b t len dim -> b t c len dim', c=3)
File "/home/anaconda3/envs/lavish/lib/python3.8/site-packages/einops/einops.py", line 537, in repeat
return reduce(tensor, pattern, reduction='repeat', **axes_lengths)
File "/home/anaconda3/envs/lavish/lib/python3.8/site-packages/einops/einops.py", line 418, in reduce
raise EinopsError(message + '\n {}'.format(e))
einops.EinopsError: Error while processing repeat-reduction pattern "b t len dim -> b t c len dim".
Input tensor shape: torch.Size([1, 10, 128]). Additional info: {'c': 3}.
Expected 4 dimensions, got 3
I try to run the code of avs, but the following error occurs:
XXXXXXXXXXXXXXXXX
File "../LAVISH/AVS/avs_scripts/avs_s4/model/PVT_AVSModel.py", line 492, in forward
x = self.swin.norm(x)
XXXXXXXXXXXXXXXXX
RuntimeError: Given normalized_shape=[1536], expected input with shape [*, 1536], but got input of size[5, 3, 192, 192]
Hello,
Thanks for sharing the code of your interesting work. I am trying to adapt your work for audio-visual speaker verification. In order to improve my results, I need few clarifications:
Thanks for your time.
I try to run the code of Lavish on avs, but the following error occurs:
Traceback (most recent call last):
File "/root/LAVISH/AVS/avs_scripts/avs_s4/train.py", line 247, in
output, visual_map_list, a_fea_list = model(imgs, audio_spec) # [bs*5, 1, 224, 224]
File "/root/miniconda3/envs/LAVISH_AVS/lib/python3.9/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/LAVISH_AVS/lib/python3.9/site-packages/torch/nn/parallel/data_parallel.py", line 159, in forward
return self.module(*inputs[0], **kwargs[0])
File "/root/miniconda3/envs/LAVISH_AVS/lib/python3.9/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/LAVISH/AVS/avs_scripts/avs_s4/model/PVT_AVSModel.py", line 492, in forward
x = self.swin.norm(x)
File "/root/miniconda3/envs/LAVISH_AVS/lib/python3.9/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(input, **kwargs)
File "/root/miniconda3/envs/LAVISH_AVS/lib/python3.9/site-packages/torch/nn/modules/normalization.py", line 169, in forward
return F.layer_norm(
File "/root/miniconda3/envs/LAVISH_AVS/lib/python3.9/site-packages/torch/nn/functional.py", line 2094, in layer_norm
return torch.layer_norm(input, normalized_shape, weight, bias, eps,
RuntimeError: Given normalized_shape=[1536], expected input with shape [, 1536], but got input of size[20, 3, 192, 192]
Hi, what set you used to report the performance of AVQA, validation set or testing set? It seems that you use the validation set in your script. Thank you very much.
Hello, I'm interested in your pretty work and trying to reproduce the result. But I found that it's so slow to train for the AVE task on my 2080Ti GPU. Thus, I want to know how many GPU days the training procedure of AVE takes?
Hi, could you please explain the cross attention you used in the paper is frozen or newly added? Where I can find the corresponding implementation? Thank you very much.
i have same error:
Traceback (most recent call last):
File "/LAVISH-main/AVQA/net_grd_avst/net_avst.py", line 318, in forward
audio = repeat(audio, 'b t len dim -> b t c len dim', c=3)
File "/root/anaconda3/lib/python3.9/site-packages/einops/einops.py", line 533, in repeat
return reduce(tensor, pattern, reduction='repeat', **axes_lengths)
File "/root/anaconda3/lib/python3.9/site-packages/einops/einops.py", line 420, in reduce
raise EinopsError(message + '\n {}'.format(e))
einops.EinopsError: Error while processing repeat-reduction pattern "b t len dim -> b t c len dim".
Input tensor shape: torch.Size([32, 10, 128]). Additional info: {'c': 3}.
Expected 4 dimensions, got 3
this my command:
python net_grd_avst/main_avst.py --mode train --audio_dir=/AVQA/MUSIC_AVQA/MUSIC-AVQA-main/data/vggish/ --video_res14x14_dir=/AVQA/MUSIC_AVQA/MUSIC-AVQA-main/data/
plz help me
Hi, could I know whether you can release the script about using visual prompt tuning for AVE? Many thanks.
I use the default config in this repo to train AVE task without any modification. But the accuracy obtained is not the same as the reported in the paper. I'm a bit confused about this. Swin-V2 Large is also taken as the visual and audio encoder, but the best precision I get is 78.8, while the paper is 81.1.
Training shell
python3 main_trans.py --Adapter_downsample=8 --audio_folder=data/AVE_audio --batch_size=2 --early_stop=5 --epochs=50 \ --is_audio_adapter_p1=1 --is_audio_adapter_p2=1 --is_audio_adapter_p3=0 --is_before_layernorm=1 --is_bn=1 --is_fusion_before=1 \ --is_gate=1 --is_post_layernorm=1 --is_vit_ln=0 --lr=5e-05 --lr_mlp=4e-06 --mode=train \ --num_conv_group=2 --num_tokens=2 --num_workers=16 --video_folder=data/AVE_video_frames \ --is_multimodal=1 --vis_encoder_type=swin --wandb=1
HI, could you share your training logs for AVQA task? Many thanks
When I tried to tune the batch size to 8 and tune the learning rates(adapter block lr and model lr) to 8 times the previous synchronously, the acc fall to 50%. I know it's not your fault, for I have trained the original baseline (Music-avqa), it also has such a problem.
I just want to discuss about that, did you meet the same problem when you tune the model? and how do you tackle it? I know the grid search for hyperparameters with lavish in avqa task is time consuming.
Hi,
We used the same config in this repo to train AVE task on a 3090, but the accuracy we got is 78.96.
python3 main_trans.py --Adapter_downsample=8 --audio_folder=$PATH/raw_audio --batch_size=2 --early_stop=5 --epochs=50 --is_audio_adapter_p1=1 --is_audio_adapter_p2=1 --is_audio_adapter_p3=0 --is_before_layernorm=1 --is_bn=1 --is_fusion_before=1 --is_gate=1 --is_post_layernorm=1 --is_vit_ln=0 --lr=5e-05 --lr_mlp=4e-06 --mode=train --num_conv_group=2 --num_tokens=2 --num_workers=16 --video_folder=$PATH/video_frames --is_multimodal=1 --vis_encoder_type=swin
When we use the config in run_v2.sh, the accuracy is 80.05, which is different from those reported in the paper (81.1%). Is the result within the acceptable floating range?
Hi,
We used this config to train AVE task on a 3090, and we used the procesed data you provided, but the accuracy we got is 73.31
python3 /code/AVE/main_trans.py --Adapter_downsample=8 --batch_size=4 --early_stop=5 --epochs=50 --is_audio_adapter_p1=1 --is_audio_adapter_p2=1 --is_audio_adapter_p3=0 --is_before_layernorm=1 --is_bn=1 --is_fusion_before=1 --is_gate=1 --is_post_layernorm=1 --is_vit_ln=0 --lr=5e-06 --lr_mlp=4e-06 --mode=train --num_conv_group=2 --num_tokens=2 --num_workers=8 --is_multimodal=1 --vis_encoder_type=vit
And the
Line 435 in 97722b0
Hello, I'm intrested in your pretty work and trying to reproduce the result. But I found that I have to spend nearly 5 gpu days to train for the AVQA task on 1 3090 gpu. Is this normal?
This is the recorded time during training:
feature Embed time: 0.0016405582427978516
time for posi encode: 0.26480627059936523
time for nega encode: 0.09544777870178223
time for grounding: 0.009487152099609375
time for result: 0.0050661563873291016
It can be seen that encoding one audio and positive visual sample using swin transformer with adapter spend 0.2s. So it will take 2 gpu days just to encode the positive feature for 30 epochs.
In the readme file of AVQA task, you have provided the command to train the model.
"python3 net_grd_avst/main_avst.py --Adapter_downsample=8 --audio_dir=/data/yanbo/Dataset/AVQA/vggish --batch-size=1 --early_stop=5 --epochs=30 --is_before_layernorm=1 --is_bn=0 --is_gate=1 --is_multimodal=1 --is_post_layernorm=1 --is_vit_ln=1 --lr=8e-05 --lr_block=3e-06 --num_conv_group=4 --num_tokens=64 --num_workers=16 --video_res14x14_dir=/data/yanbo/Dataset/AVQA/ --wandb=1“
You only used 1 sample per batch? Or we could use the command in train.sh to reproduce the result?
I tried to train the whole model in the AVS repo, but got some errors.
According to this problem, i guess there are some bugs hidden in the AVS repo, or more precisely, the two lines 513 and 518 should be exchanged, and final the x1 = multi_scale[0].view(multi_scale[0].size(0),64,64,-1)
need to be commented.
My Solution
Hello,
Thanks for the amazing work. I am trying your LAVISH setup for a different dataset for emotion recognition. I found that the output of the LAVISH model (tried all variants of vits ) returns Nan after a few layers. May I know whether I need to use different mean and variance for normalizing the audio and visual inputs. If so, can you share the scripts to compute the mean and variance for data normalization for my data.
After fixing few bugs I managed to reach ~79% accuracy only, I used the provided settings:
python3 main_trans.py --Adapter_downsample=8 --audio_folder=$PATH/raw_audio --batch_size=2 --early_stop=5 --epochs=50 --is_audio_adapter_p1=1 --is_audio_adapter_p2=1 --is_audio_adapter_p3=0 --is_before_layernorm=1 --is_bn=1 --is_fusion_before=1 --is_gate=1 --is_post_layernorm=1 --is_vit_ln=0 --lr=5e-05 --lr_mlp=4e-06 --mode=train --num_conv_group=2 --num_tokens=2 --num_workers=16 --video_folder=$PATH/video_frames --is_multimodal=1 --vis_encoder_type=swin
The code works on the validation set and the maximum accuracy is 78%, while the accuracy for the test set is 79%. Could you please provide the settings for reported results?
Maybe you can check the address of the paper in readme. When I open the address, the result is a paper named EclipSE.
I have tried to delete the adapter in both AVE and AVQA task, without other config changed. And the performance only decreased for around 1~2%. If we unlock the layernorm in original swinv2, the gap will be further narrowed. But if I finetune all parameters (without adapter) in AVE, the performance decreased a lot, maybe the learning schedule needs to be adjusted simultaneously.
And there is an interesting phenomenon that if I delete the adapter, the model need more epochs to achieve the best performance, which indicated that the added trainable parameters can accelerate the training. Of course, it may also be caused by the need to adjust the learning rate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.