Audio Classification
PEFT
Safetensors
English
audio
audio-decision
qwen2_5_omni
lora
streaming
custom-code
research
Instructions to use TeenageWorks/Toddler-Jev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use TeenageWorks/Toddler-Jev with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Download evaluate.py from TeenageWorks/Toddler-Jev: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/TeenageWorks/Toddler-Jev/resolve/main/evaluate.py
- Command line
-
hf download hf://TeenageWorks/Toddler-Jev/evaluate.py
-
curl -L -o evaluate.py https://huggingface.co/TeenageWorks/Toddler-Jev/resolve/main/evaluate.py
1.48 kB
| """Evaluate labeled local audio without a server. Built with Qwen; see LICENSE.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from toddler_jev import ToddlerJev | |
| from train import read_data | |
| def main(): | |
| p=argparse.ArgumentParser() | |
| p.add_argument('--data',required=True) | |
| p.add_argument('--output',required=True) | |
| p.add_argument('--batch-size',type=int,default=1) | |
| p.add_argument('--model',default=str(Path(__file__).parent)) | |
| p.add_argument('--revision',default='v1.0.0') | |
| p.add_argument('--device',default=None) | |
| args=p.parse_args() | |
| if args.batch_size<1:p.error('Batch size must be positive') | |
| target=Path(args.output) | |
| if target.exists():p.error('Output must be a new file') | |
| rows=read_data(args.data) | |
| model=ToddlerJev.from_pretrained(args.model,revision=args.revision,device=args.device) | |
| correct=0 | |
| with target.open('x',encoding='utf-8') as f: | |
| for i in range(0,len(rows),args.batch_size): | |
| batch=rows[i:i+args.batch_size] | |
| for row,result in zip(batch,model.predict_batch(batch)): | |
| result['id']=row.get('id',i) | |
| result['target_index']=row['target'] | |
| result['correct']=result['decision_index']==row['target'] | |
| correct+=result['correct'] | |
| f.write(json.dumps(result)+'\n') | |
| f.flush() | |
| print(json.dumps({'examples':len(rows),'correct':correct,'accuracy':correct/len(rows)})) | |
| if __name__=='__main__':main() | |