Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MusicFM
|
| 2 |
+
|
| 3 |
+
- MusicFM that supports `transformers.AutoModel`.
|
| 4 |
+
- Original repository: https://github.com/minzwon/musicfm
|
| 5 |
+
- See https://github.com/minzwon/musicfm/blob/master/README.md for details.
|
| 6 |
+
|
| 7 |
+
```python
|
| 8 |
+
>>> import torch
|
| 9 |
+
>>> from transformers import AutoModel
|
| 10 |
+
>>> torch.manual_seed(0)
|
| 11 |
+
>>> wav = (torch.rand(4, 24000 * 30) - 0.5) * 2
|
| 12 |
+
>>> model = AutoModel.from_pretrained("tky823/MusicFM", trust_remote_code=True)
|
| 13 |
+
#>>> get embeddings
|
| 14 |
+
>>> model.eval()
|
| 15 |
+
>>> emb = model.get_latent(wav, layer_ix=7)
|
| 16 |
+
>>> emb.size()
|
| 17 |
+
torch.Size([4, 750, 1024])
|
| 18 |
+
```
|