Created
March 14, 2025 05:55
-
-
Save yoi-hibino/d467f18f5f8b0a9fe0c4c61e509550ca to your computer and use it in GitHub Desktop.
CSM Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from huggingface_hub import hf_hub_download | |
from generator import load_csm_1b | |
import torchaudio | |
# need this to access to model. | |
# you also need to get access to https://huggingface.co/meta-llama/Llama-3.2-1B | |
from huggingface_hub import login | |
login("your_huggingface_token") | |
model_path = hf_hub_download(repo_id="sesame/csm-1b", filename="ckpt.pt") | |
generator = load_csm_1b(model_path, "cuda") | |
audio = generator.generate( | |
text="Hello from Sesame.", | |
speaker=0, | |
context=[], | |
max_audio_length_ms=10_000, | |
) | |
torchaudio.save("audio.wav", audio.unsqueeze(0).cpu(), generator.sample_rate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/SesameAILabs/csm
make sure you have ffmpeg installed as well