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

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

Open
ZJX-CV opened this issue Apr 9, 2024 · 1 comment
Open

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

ZJX-CV opened this issue Apr 9, 2024 · 1 comment

Comments

@ZJX-CV
Copy link

ZJX-CV commented Apr 9, 2024

预训练结束之后,我的目录如下:
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'

@Aldafodur
Copy link

老哥你解决了吗,我感觉代码不全,这个得到select_sentence的过程被删了,导致不能跑微调

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

2 participants