Views
No views yet
1import sys, torch
2from huggingface_hub import snapshot_download
3
4# Download the self-contained release (architecture + weights + loader)
5local_dir = snapshot_download("hanxunh/AudioMosaic-vit-b16-pretrained")
6sys.path.insert(0, local_dir)
7
8from load_model import load_pretrained_encoder
9model = load_pretrained_encoder(device="cuda")
10
11# Forward a log-mel spectrogram batch of shape [B, 1, 1024, 128]
12fbank = torch.randn(2, 1, 1024, 128).cuda()
13with torch.no_grad():
14 features = model.forward_encoder(fbank) # [B, num_patches+1, 768]model.safetensors — encoder weightsconfig.json — architecture hyperparametersmodeling.py — vendored model architecture (no need to install AudioMosaic)load_model.py — convenience loadertorch, timm, torchlibrosa, safetensors, huggingface_hub.1@inproceedings{huang2026audiomosaic,
2 title={AudioMosaic: Contrastive Masked Audio Representation Learning},
3 author={Hanxun Huang and Qizhou Wang and Xingjun Ma and Cihang Xie and Christopher Leckie and Sarah Erfani},
4 booktitle={ICML},
5 year={2026}
6}