Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How do I inferece on custom data with pretrained model? #167

Open
1 of 2 tasks
ylee1123 opened this issue Nov 5, 2024 · 3 comments
Open
1 of 2 tasks
Assignees

Comments

@ylee1123
Copy link

ylee1123 commented Nov 5, 2024

System Info

PyTorch version: 2.6.0.dev20241101+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.25.0
Libc version: glibc-2.35

Python version: 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.8.0-45-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.2.91
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA GeForce RTX 4090
GPU 1: NVIDIA GeForce RTX 4090

Nvidia driver version: 535.183.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 43 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: AuthenticAMD
Model name: AMD Ryzen Threadripper PRO 3955WX 16-Cores
CPU family: 23
Model: 49
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
Stepping: 0
Frequency boost: enabled
CPU max MHz: 4402.7339
CPU min MHz: 2200.0000
BogoMIPS: 7785.33
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es
Virtualization: AMD-V
L1d cache: 512 KiB (16 instances)
L1i cache: 512 KiB (16 instances)
L2 cache: 8 MiB (16 instances)
L3 cache: 64 MiB (4 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0-31
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow: Mitigation; Safe RET
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu11==11.10.3.66
[pip3] nvidia-cublas-cu12==12.1.3.1
[pip3] nvidia-cuda-cupti-cu11==11.7.101
[pip3] nvidia-cuda-cupti-cu12==12.1.105
[pip3] nvidia-cuda-nvrtc-cu11==11.7.99
[pip3] nvidia-cuda-nvrtc-cu12==12.1.105
[pip3] nvidia-cuda-runtime-cu11==11.7.99
[pip3] nvidia-cuda-runtime-cu12==12.1.105
[pip3] nvidia-cudnn-cu11==8.5.0.96
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu11==10.9.0.58
[pip3] nvidia-cufft-cu12==11.0.2.54
[pip3] nvidia-curand-cu11==10.2.10.91
[pip3] nvidia-curand-cu12==10.3.2.106
[pip3] nvidia-cusolver-cu11==11.4.0.1
[pip3] nvidia-cusolver-cu12==11.4.5.107
[pip3] nvidia-cusparse-cu11==11.7.4.91
[pip3] nvidia-cusparse-cu12==12.1.0.106
[pip3] nvidia-nccl-cu11==2.14.3
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu11==11.7.91
[pip3] nvidia-nvtx-cu12==12.1.105
[pip3] pytorch-triton==3.1.0+cf34004b8a
[pip3] torch==2.6.0.dev20241101+cu121
[pip3] torchaudio==2.5.0.dev20241101+cu121
[pip3] torchvision==0.20.0.dev20241101+cu121
[pip3] triton==2.1.0

Information

  • The official example scripts
  • My own modified scripts

🐛 Describe the bug

After downloading pretrained EAT encoder file from the github repository, I tried to run 'inference_clotho_bs.sh' file and this error popped out.
I wonder the reason for this error and the ``proper'' way to implement pretrained model to inference on both clotho dataset and custom data.

Thanks in advance.

Error logs

'''
Error executing job with overrides: ['++model_config.llm_name=vicuna-7b-v1.5', '++model_config.llm_path=/AAC/SLAM-LLM/models/pretrain/model.pt', '++model_config.llm_dim=4096', '++model_config.encoder_name=eat', '++model_config.encoder_path=AAC/SLAM-LLM/models/pretrain/model.pt', '++model_config.encoder_dim=768', '++model_config.encoder_projector=linear', '++model_config.encoder_projector_ds_rate=5', '++model_config.normalize=true', '++dataset_config.encoder_projector_ds_rate=5', '++dataset_config.dataset=audio_dataset', '++dataset_config.val_data_path=/AAC/SLAM-LLM/dataset/clotho-dataset/clotho/evaluation_single.jsonl', '++dataset_config.fbank_mean=-4.268', '++dataset_config.fbank_std=4.569', '++dataset_config.model_name=eat', '++dataset_config.inference_mode=true', '++dataset_config.normalize=true', '++dataset_config.input_type=mel', '++dataset_config.fixed_length=true', '++dataset_config.target_length=1024', '++train_config.model_name=aac', '++train_config.batching_strategy=custom', '++train_config.num_epochs=1', '++train_config.val_batch_size=4', '++train_config.num_workers_dataloader=0', '++train_config.output_dir=/AAC/SLAM-LLM/exp/clotho/aac_epoch_1_step_4500', '++train_config.freeze_encoder=true', '++train_config.freeze_llm=true', '++train_config.use_peft=false', '++ckpt_path=/AAC/SLAM-LLM/exp/clotho/aac_epoch_1_step_4500/model.pt', '++peft_ckpt=/AAC/SLAM-LLM/exp/clotho/aac_epoch_1_step_4500', '++decode_log=/AAC/SLAM-LLM/exp/clotho/aac_epoch_1_step_4500/decode_beam4', '++model_config.num_beams=4']
Traceback (most recent call last):
File "
/AAC/SLAM-LLM/examples/slam_aac/inference_aac_batch.py", line 49, in main_hydra
inference(cfg)
File "/AAC/SLAM-LLM/src/slam_llm/pipeline/inference_batch.py", line 100, in main
model, tokenizer = model_factory(train_config, model_config, **kwargs)
File "examples/slam_aac/model/slam_model_aac.py", line 28, in model_factory
encoder = setup_encoder(train_config, model_config, **kwargs)
File "
/AAC/SLAM-LLM/src/slam_llm/models/slam_model.py", line 85, in setup_encoder
encoder = EATEncoder.load(model_config)
File "/AAC/SLAM-LLM/src/slam_llm/models/encoder.py", line 68, in load
EATEncoder, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([model_config.encoder_path])
File "
/AAC/fairseq/fairseq/checkpoint_utils.py", line 451, in load_model_ensemble_and_task
state = load_checkpoint_to_cpu(filename, arg_overrides)
File "/AAC/fairseq/fairseq/checkpoint_utils.py", line 368, in load_checkpoint_to_cpu
state = _upgrade_state_dict(state)
File "
/AAC/fairseq/fairseq/checkpoint_utils.py", line 618, in _upgrade_state_dict
{"criterion_name": "CrossEntropyCriterion", "best_loss": state["best_loss"]}
KeyError: 'best_loss'
'''

Expected behavior

I was hoping to get results on evaluation dataset (as written in the official github README.md)

@ddlBoJack
Copy link
Collaborator

You may need to download the EAT checkpoint from the README page of SLAM-AAC

@ylee1123
Copy link
Author

ylee1123 commented Nov 6, 2024

When I downloaded the checkpoint file and specified the path in bash file, the following error appears.

File "/PATH/TO/AAC/SLAM-LLM/examples/slam_aac/inference_aac_batch.py", line 49, in main_hydra
inference(cfg)
File "/PATH/TO/AAC/SLAM-LLM/src/slam_llm/pipeline/inference_batch.py", line 100, in main
model, tokenizer = model_factory(train_config, model_config, **kwargs)
File "examples/slam_aac/model/slam_model_aac.py", line 28, in model_factory
encoder = setup_encoder(train_config, model_config, **kwargs)
File "/PATH/TO/AAC/SLAM-LLM/src/slam_llm/models/slam_model.py", line 85, in setup_encoder
encoder = EATEncoder.load(model_config)
File "/PATH/TO/AAC/SLAM-LLM/src/slam_llm/models/encoder.py", line 68, in load
EATEncoder, cfg, task = fairseq.checkpoint_utils.load_model_ensemble_and_task([model_config.encoder_path])
File "/PATH/TO/AAC/fairseq/fairseq/checkpoint_utils.py", line 463, in load_model_ensemble_and_task
task = tasks.setup_task(cfg.task, from_checkpoint=True)
File "/PATH/TO/AAC/fairseq/fairseq/tasks/init.py", line 44, in setup_task
task is not None

AssertionError: Could not infer task type from {'_name': 'mae_image_classification', 'data': '/hpc_stor03/sjtu_home/wenxi.chen/mydata/audio/AS2M', 'multi_data': None, 'input_size': 224, 'local_cache_path': None, 'key': 'imgs', 'beit_transforms': False, 'target_transform': False, 'no_transform': False, 'rebuild_batches': True, 'precompute_mask_config': None, 'subsample': 1.0, 'seed': 1, 'dataset_type': 'imagefolder', 'audio_mae': True, 'h5_format': True, 'downsr_16hz': True, 'target_length': 1024, 'flexible_mask': False, 'esc50_eval': False, 'spcv2_eval': False, 'AS2M_finetune': True, 'spcv1_finetune': False, 'roll_aug': True, 'noise': False, 'weights_file': '/hpc_stor03/sjtu_home/wenxi.chen/mydata/audio/AS2M/weight_train_all.csv', 'num_samples': 200000, 'is_finetuning': False, 'label_descriptors': 'label_descriptors.csv', 'labels': 'lbl'}. Available argparse tasks: dict_keys(['multilingual_masked_lm', 'translation_multi_simple_epoch', 'speech_dlm_task', 'speech_to_text', 'text_to_speech', 'language_modeling', 'masked_lm', 'sentence_prediction', 'sentence_prediction_adapters', 'audio_pretraining', 'audio_finetuning', 'nlu_finetuning', 'multilingual_language_modeling', 'audio_classification', 'span_masked_lm', 'hubert_pretraining', 'speech_unit_modeling', 'multires_hubert_pretraining', 'translation', 'online_backtranslation', 'denoising', 'multilingual_denoising', 'simul_speech_to_text', 'simul_text_to_text', 'translation_from_pretrained_xlm', 'translation_lev', 'frm_text_to_speech', 'speech_to_speech', 'legacy_masked_lm', 'translation_from_pretrained_bart', 'multilingual_translation', 'sentence_ranking', 'semisupervised_translation', 'cross_lingual_lm', 'dummy_lm', 'dummy_masked_lm', 'dummy_mt']). Available hydra tasks: dict_keys(['speech_dlm_task', 'language_modeling', 'masked_lm', 'sentence_prediction', 'sentence_prediction_adapters', 'audio_pretraining', 'audio_finetuning', 'nlu_finetuning', 'multilingual_language_modeling', 'audio_classification', 'span_masked_lm', 'hubert_pretraining', 'speech_unit_modeling', 'multires_hubert_pretraining', 'translation', 'denoising', 'multilingual_denoising', 'simul_text_to_text', 'translation_from_pretrained_xlm', 'translation_lev', 'dummy_lm', 'dummy_masked_lm'])

how do I setup the task for fairseq library?

@cwx-worst-one
Copy link
Collaborator

cwx-worst-one commented Nov 12, 2024

You should set up the necessary environment for each model component as described in the README. Please refer to the environment setup instructions in the EAT repository for guidance. Here’s an example setup (from that repository):

git clone https://github.com/pytorch/fairseq
cd fairseq
pip install --editable ./
git clone https://github.com/cwx-worst-one/EAT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants