mit-han-lab / tinyml

MIT License
747 stars 136 forks source link

MCUnet testing script (for accuracy of models in TF-Lite format) crashing - DefaultCPUAllocator: not enough memory #17

Closed antragoudaras closed 2 years ago

antragoudaras commented 2 years ago

Hello there I am trying to test the accuracy of int8 models in TF-Lite format, in the mcunet subfolder, so after invoking the corresponding python script I get the following RuntimeError: _Traceback (most recent call last): File "jobs/eval_tflite.py", line 97, in images = torch.cat([v[0] for v in val_loader_cache], dim=0) RuntimeError: [enforce fail at C:\cb\pytorch_1000000000000\work\c10\core\impl\alloccpu.cpp:81] data. DefaultCPUAllocator: not enough memory: you tried to allocate 18585600000 bytes.

I invoke the jobs/eval_tflite.py script with the following parameter options: python jobs/eval_tflite.py --val-dir dataset/imagenet/val --tflite_path assets/tflite/mcunet-320kb-1mb_imagenet.tflite --workers 4

I have installed the tensorflow for cpu only edition , since my laptop/system has no GPU whatsoever. In the following snapshot you can see my system's specs

system_specs

Has anyone else also experienced a similar error? Any help will be invaluable! --Antonios.

tonylins commented 2 years ago

Hi Antonios, it seems that the caching of the validation set exceeds the memory (the server I tested on has a much larger memory). You may want to skip building val_loader_cache and directly feed the data from the val_loader to the model for testing.

tonylins commented 2 years ago

Close due to inactivity. Feel free to post issues under the new repo: https://github.com/mit-han-lab/mcunet.