• Python 99.9%
  • Shell 0.1%
Find a file
2025-06-04 14:29:13 -06:00
assets Initial commit 2025-04-23 16:01:50 +01:00
configs Initial commit 2025-04-23 16:01:50 +01:00
NatureLM Reformat with black 2025-06-04 14:29:13 -06:00
.gitattributes Initial commit 2025-04-23 16:01:50 +01:00
.gitignore Ignore vi temp files 2025-06-01 15:29:38 -06:00
.pre-commit-config.yaml Initial commit 2025-04-23 16:01:50 +01:00
.python-version Initial commit 2025-04-23 16:01:50 +01:00
beans_zero_dataset_config.json Initial commit 2025-04-23 16:01:50 +01:00
beans_zero_inference.py Reformat with black 2025-06-04 14:29:13 -06:00
cli.py Reformat with black 2025-06-04 14:29:13 -06:00
CODE_OF_CONDUCT.md Initial commit 2025-04-23 16:01:50 +01:00
delme.py Reformat with black 2025-06-04 14:29:13 -06:00
inference_web_app.py Reformat with black 2025-06-04 14:29:13 -06:00
LICENSE Initial commit 2025-04-23 16:01:50 +01:00
pyproject.toml Beans-zero dependency now using https for git (#5) 2025-05-12 09:49:58 +02:00
README-upstream.md mv upstream README 2025-06-01 15:10:26 -06:00
README.md BEANS-Zero inference exec time 2025-06-03 12:12:49 -06:00
requirements.txt Beans-zero dependency now using https for git (#5) 2025-05-12 09:49:58 +02:00
train.py Reformat with black 2025-06-04 14:29:13 -06:00
train_dist.sh Initial commit 2025-04-23 16:01:50 +01:00
uv.lock Beans-zero dependency now using https for git (#5) 2025-05-12 09:49:58 +02:00

NatureLM-audio

Audio-Language Foundation Model for Bioacoustics.

Fork

This repository is a fork of:

The upstream code requires a google API key.

This version is De-googled.

See README-upstream.md for the upstream README.

Install

Note, upstream ships with a .python-version with Python 3.10. So you probably want a version of Python 3.10 installed.

They use uv upstream, so perhaps use that. Install to taste, such as:

python -m venv .venv
source .venv/bin/activate
pip install -U pip uv
uv sync

Usage

Inference

On an Nvidia A6000, uses 16.628Gi VRAM, slightly too much for A16.

The file extensions need to be lower case (e.g. .wav not .WAV).

This perhaps works. Note output_path is a file, not a directory name.

python NatureLM/infer.py --cfg-path configs/inference.yml --audio ../audio/ --query "Caption the audio" --window_length_seconds 10.0 --hop_length_seconds 10.0 --output_path ../out

And/or run with uv:

uv run naturelm infer --cfg-path configs/inference.yml --audio-path ../audio/ --query "Caption the audio" --window-length-seconds 10.0 --hop-length-seconds 10.0 --output-path ../out  

BEANS-Zero inference (~50G dataset, uses 23.073G GPU VRAM, takes ~4.5 hours to run on an Nvidia A6000):

python beans_zero_inference.py --cfg-path configs/inference.yml --data_path EarthSpeciesProject/BEANS-Zero --output_path ../out-NatureLM-audio/beans_zero_eval.jsonl --beans_zero_config_path beans_zero_dataset_config.json

Whence SPICE?

Running beans_zero_inference.py uses the beans-zero package. The Earth Species Project code for that is here:

That repository contains this blob:

  • beans_zero/external/spice/spice-1.0.jar

That ancient blob requires Java 8, which was released in 2014.

The Earth Species Project got the blob from this repo:

That repo is a fork of an earlier repo. The newer fork updates the Python code from old Python 2.7.

All three copies of spice-1.0.jar from the above repos have this sha1sum:

  • a27d265796c64d167834bcd4b0cf4b7ba6ca11a4

SPICE itself, afaict, comes from the authors of this 2016 paper, "SPICE: Semantic Propositional Image Caption Evaluation"

That paper links to this archive:

That archive has a link to a SPICE-1.0.zip archive, which contains SPICE-1.0/spice-1.0.jar.

The spice-1.0.jar in that archive is 19751099 bytes, identical to the size of the spice-1.0.jar in the beans-zero and earlier archives. But the panderson.me has a different checksum, so it is a different file:

  • 925fad3c2030e86c3d99375e55eb2ee15973169d

It is unclear who built the blob used by the Earth Species Project.

The panderson.me site links to this repo:

This appears to be the actual source code for the blob. The code is under the GNU AGPL v3 license. It was last modified in 2018.

The tylin/coco-caption repository, which is the most likely candidate for who built the blob, uses the BSD 2-Clause license (Simplified BSD license). This may be an issue, because the upstream license is AGPL v3.

The salaniz/pycocoevalcap repository, also uses this BSD license, again not mentioning the original AGPL v3 license.

The Earth Species Project beans-zero repository contains no license file. Neither the README nor the pyproject.toml file make any reference to a license. None of the source code files' headers have a license. Licenses are only mentioned with respect to the datasets used, nothing about the code itself. The paper the repository references is here:

That paper states:

"To advance bioacoustics research, we release our model weights, benchmark data, and open-source the code for training and benchmark data generation and model training."

That quote is linked to this page:

Which links to this repository:

That repository is under the MIT license. I see no mention of the AGPLv3 license.

Without an ancient Java install, running beans-zero will give this error:

ERROR:beans_zero:Error evaluating dataset captioning: [Errno 2] No such file or directory: 'java'

I'm not sure why the Earth Species Project is using this ancient blob.

License

MIT license.

Unofficial project, not related to upstream projects.

Upstream sources under their respective copyrights.

Copyright © 2025 Jeff Moe.