Skip to content

Inference v1 refactor: Port model and remove fastai dependency from inference #405

@akashmjn

Description

@akashmjn

Goal

Port the OrcaHello SRKW detection model from fastai to pure PyTorch, removing fastai==1.0.61 dependency. Greatly simplifies deployment/CI and enables easier sharing/use of the model (e.g. HuggingFace).

Context

Plan

There's now a pure Pytorch implementation in branch akash/inference-v1-nofastai with pytests that confirm numerical parity of both (1) audio preprocessing (2) model inference on test inputs. The checkpoint is converted once, and then can be used without fastai dependency.

When fully merged to main, addresses #150, making model inference much easier to use

e.g. directly from Huggingface orcasound/orcahello-srkw-detector-v1 as below.

from model_v1.inference import OrcaHelloSRKWDetectorV1

# Load model from HuggingFace Hub
model = OrcaHelloSRKWDetectorV1.from_pretrained("orcasound/orcahello-srkw-detector-v1")

# Detect SRKW calls in audio file
result = model.detect_srkw_from_file("audio.wav", config)

print(f"Orca detected: {result.global_prediction}")
print(f"Confidence: {result.global_confidence:.1f}%")

Will incrementally open PRs and track overall on this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions