ChangyaoTian / VL-LTR

VL-LTR: Learning Class-wise Visual-Linguistic Representation for Long-Tailed Visual Recognition
61 stars 8 forks source link

AttributeError: 'LGR' object has no attribute 'encode_text' #14

Open ZJX-CV opened 2 months ago

ZJX-CV commented 2 months ago

预训练结束之后,我的目录如下: image

我运行微调的指令,报错: Traceback (most recent call last): File "/root/code/VL-LTR/main.py", line 526, in main(args) File "/root/code/VL-LTR/main.py", line 329, in main model = create_model( File "/opt/conda/lib/python3.10/site-packages/timm/models/_factory.py", line 114, in create_model model = create_fn( File "/root/code/VL-LTR/models/finetune.py", line 396, in LGR_r50 model.load_pretrained_model( File "/root/code/VL-LTR/models/finetune.py", line 287, in load_pretrained_model self._load_text_embeddings(txt_embed_path) File "/root/code/VL-LTR/models/finetune.py", line 310, in _load_text_embeddings assert osp.exists(txt_ces_path) AssertionError

然后我把select_sent设置为rand,结果报错: eval dataset: val image embeddings: 100%|██████████| 6/6 [00:02<00:00, 2.47it/s] text embeddings: 0%| | 0/3 [00:00<?, ?it/s] Traceback (most recent call last): File "/root/code/VL-LTR/main.py", line 526, in main(args) File "/root/code/VL-LTR/main.py", line 441, in main test_stats = eval_func(data_loader, model, device, prefix=prefix) File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/root/code/VL-LTR/engine.py", line 551, in select_sent text_features = model.encode_text(batch_tokens) File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1614, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LGR' object has no attribute 'encode_text'