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

Illegal instruction #32

Open
zoldaten opened this issue Mar 19, 2025 · 3 comments
Open

Illegal instruction #32

zoldaten opened this issue Mar 19, 2025 · 3 comments

Comments

@zoldaten
Copy link

hi!
i try to inference on raspberry pi:
python3 predict_text_prompt.py --source ultralytics/assets/bus.jpg --checkpoint pretrain/yoloe-v8s-seg.pt --names person
but got error.
the problem with this string in predict_text_prompt.py:
model.set_classes(args.names, model.get_text_pe(args.names))
in cmd it returns:

Traceback (most recent call last):
  File "/home/pi/yoloe/predict_text_prompt.py", line 89, in <module>
    main()
  File "/home/pi/yoloe/predict_text_prompt.py", line 56, in main
    model.set_classes(args.names, model.get_text_pe(args.names))
  File "/home/pi/yoloe/ultralytics/models/yolo/model.py", line 99, in get_text_pe
    return self.model.get_text_pe(texts)
  File "/home/pi/yoloe/venv/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/home/pi/yoloe/ultralytics/nn/tasks.py", line 626, in get_text_pe
    assert(not self.training)
AssertionError

how to fix ?

@jameslahm
Copy link
Collaborator

Thanks for your interest! We cannot reproduce the issue in our environment. Could you please try add model.eval() after this line? Thanks!

model.to(args.device)

@zoldaten
Copy link
Author

zoldaten commented Mar 19, 2025

Thanks for your interest! We cannot reproduce the issue in our environment. Could you please try add model.eval() after this line? Thanks!

yoloe/predict_text_prompt.py

Line 52 in a803c8b

model.to(args.device)

not working.
there is something with Build text model mobileclip:blt
it works on Windows. so that i just pickle dump pickle.dump(model.get_text_pe(args.names),f) on windows, copy-paste
and pickle load on raspberry and it starts working. but it is 'handmade fix'.

@zoldaten
Copy link
Author

ok, i fix it. that was about mobileclip
steps as follows:

  1. make venv only for mobileclip (do not install yoloe before)
git clone https://github.com/apple/ml-mobileclip.git
cd ml-mobileclip
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install -e .
  1. install yoloe
cd ~
git clone https://github.com/THU-MIG/yoloe.git

nano requerements.txt

*comment there:
#-e third_party/ml-mobileclip

pip install -e .

3.upgrade torch and torchvision if needed:
pip3 install torch==2.6 torchvision==0.21

Image

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