Downloads · 30 days
2.2K
2% of all-time downloads
davidrrobinson/BioLingual
BioLingual is a feature extraction model from davidrrobinson. Use it when you need embeddings to search or compare text. It is set up for transformers.
Model card for BioLingual: Transferable Models for bioacoustics with Human Language Supervision
Downloads · 30 days
2.2K
2% of all-time downloads
All-time downloads
91.9K
Public
Repo size
1.2 GB
Likes
8
Public
Click a slice to open those files.
.bin615 MB · 99%
From the Hugging Face model README
Model card for BioLingual: Transferable Models for bioacoustics with Human Language Supervision
An audio-text model for bioacoustics based on contrastive language-audio pretraining.
You can use this model for bioacoustic zero shot audio classification, or for fine-tuning on bioacoustic tasks.
pipelinefrom datasets import load_dataset
from transformers import pipeline
dataset = load_dataset("ashraq/esc50")
audio = dataset["train"]["audio"][-1]["array"]
audio_classifier = pipeline(task="zero-shot-audio-classification", model="davidrrobinson/BioLingual")
output = audio_classifier(audio, candidate_labels=["Sound of a sperm whale", "Sound of a sea lion"])
print(output)
>>> [{"score": 0.999, "label": "Sound of a dog"}, {"score": 0.001, "label": "Sound of vaccum cleaner"}]
You can also get the audio and text embeddings using ClapModel
from datasets import load_dataset
from transformers import ClapModel, ClapProcessor
librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
audio_sample = librispeech_dummy[0]
model = ClapModel.from_pretrained("laion/clap-htsat-unfused")
processor = ClapProcessor.from_pretrained("laion/clap-htsat-unfused")
inputs = processor(audios=audio_sample["audio"]["array"], return_tensors="pt")
audio_embed = model.get_audio_features(**inputs)
from datasets import load_dataset
from transformers import ClapModel, ClapProcessor
librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
audio_sample = librispeech_dummy[0]
model = ClapModel.from_pretrained("laion/clap-htsat-unfused").to(0)
processor = ClapProcessor.from_pretrained("laion/clap-htsat-unfused")
inputs = processor(audios=audio_sample["audio"]["array"], return_tensors="pt").to(0)
audio_embed = model.get_audio_features(**inputs)