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

Crash when instantiating Analyzer() (from 0.14.0) #109

Open
jaro-kunzelmann opened this issue Mar 11, 2024 · 2 comments
Open

Crash when instantiating Analyzer() (from 0.14.0) #109

jaro-kunzelmann opened this issue Mar 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@jaro-kunzelmann
Copy link

Hello!

First of all, thank you very much for this great project!

Description
I am encountering an issue in versions 0.14 and 0.15. I tested with versions 0.8, 0.10, and 0.13.2 and there, the error didn't happen.

When I create an Analyzer object as follows...

from birdnetlib.analyzer import Analyzer
analyzer = Analyzer()

...I get the following output:

Labels loaded.
load model True
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Model loaded.
Labels loaded.
load_species_list_model
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jaro\AppData\Local\mambaforge\envs\EA2\lib\site-packages\birdnetlib\analyzer.py", line 127, in __init__
    self.species_class = SpeciesList()
  File "C:\Users\jaro\AppData\Local\mambaforge\envs\EA2\lib\site-packages\birdnetlib\species.py", line 40, in __init__
    self.load_species_list_model()
  File "C:\Users\jaro\AppData\Local\mambaforge\envs\EA2\lib\site-packages\birdnetlib\species.py", line 107, in load_species_list_model
    self.meta_interpreter.allocate_tensors()
  File "C:\Users\jaro\AppData\Local\mambaforge\envs\EA2\lib\site-packages\tensorflow\lite\python\interpreter.py", line 513, in allocate_tensors
    return self._interpreter.AllocateTensors()
ValueError: vector too long

Note: "EA2" is my mamba environment.

System
Windows 10
Python 3.9.15 (via conda/mamba)
I installed BirdNET requirements (Tensorflow, Librosa, NumPy, FFmpeg etc., as per BirdNET-Analyzer github page) via conda/mamba

What I tried
I tried to track down the problem and installed previous versions of birdnetlib. It seems the problem occurs starting from version 0.14.0. In this version a new metadata species model was added (BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite). As far as I understand it, when Analyzer is initialized, it tries to load this model (when instantiating SpeciesList), which for some reason then causes the this vector too long error when allocating tensors.

For now I will just stick to version 0.13.2, as I don't need the metadata species model at the moment.
Let me know if I can assist you with further info and thank you very much for looking into it.

Cheers,
Jaro

@joeweiss
Copy link
Owner

Hi @jaro-kunzelmann, thanks for the kind words, and for opening this issue.

Which version of tensorflow do you have installed in your Mamba environment? I'd like to try to replicate the crash here with your exact version.

Thanks!

@joeweiss joeweiss added the question Further information is requested label Mar 13, 2024
@jaro-kunzelmann
Copy link
Author

I'm using tensorflow 2.10.0.

I also attached a full requirements file (with birdnetlib 0.14.0, the version starting from which the crash is caused).
requirements.txt

Thank you for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants