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

Error When Loading the yolov5s.pt #19

Open
SuLi8 opened this issue Jan 1, 2023 · 3 comments
Open

Error When Loading the yolov5s.pt #19

SuLi8 opened this issue Jan 1, 2023 · 3 comments

Comments

@SuLi8
Copy link

SuLi8 commented Jan 1, 2023

I replaced this line in the main.dart of the example program
String pathCustomModel = "assets/models/yolov5s.pt";

After compiling and running on the IOS emulator, an error is reported:
[enforce fail at inline_container.cc:222] . file not found: archive/constants.pkl

It seems that yolov5s.pt is not loaded correctly
yolov5s.pt has been verified to be OK.
I would like to know how to solve this problem

@cyrillkuettel
Copy link

It could be incompatible versions. Try using pytorch 1.11 to train / export the model.

Then change this line, the iOS Libtorch version to 1.10.
After that, make sure to update the dependency with cocapods:

pod update LibTorch

@SuLi8
Copy link
Author

SuLi8 commented Jan 8, 2023

Thanks but still got exceptions.

Exception raised from valid at /Users/distiller/project/caffe2/serialize/inline_container.cc:158 (most recent call first):
frame #0: _ZN3c105ErrorC1ENS_14SourceLocationENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 75 (0x10640f933 in Runner)
frame #1: _ZN3c106detail14torchCheckFailEPKcS2_jRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 106 (0x10640e535 in Runner)
frame #2: ZN6caffe29serialize19PyTorchStreamReader5validEPKcS3 + 125 (0x105db516b in Runner)
frame #3: _ZN6caffe29serialize19PyTorchStreamReader11getRecordIDERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 101 (0x105db5b75 in Runner)
frame #4: _ZN6caffe29serialize19PyTorchStreamReader9getRecordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 70 (0x10159e352 in Runner)
frame #5: _ZN5torch3jit21readArchiveAndTensorsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_S9_N3<…>
Lost connection to device.

@dvagala
Copy link

dvagala commented Mar 1, 2023

@SuLi8 I've got the same error when importing my model, and I solved it by exporting the model as a torchscript and make sure that the model was saved for cpu and not cuda

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