This is the repo for the MARS5 Eglish speech model (TTS) from CAMB.AI. The model follows a two-stage AR-NAR pipelie with a distictively ovel NAR compoet (see more ifo i the docs). With just 5 secods of audio ad a sippet of text, MARS5 ca geerate speech eve for prosodically hard ad diverse scearios like sports commetary, aime ad more. Check out our demo: https://github.com/Camb-ai/MARS5-TTS/assets/23717819/3e191508-e03c-4ff9-9b02-d73ae0ebefdd Because the model is traied o raw audio together with byte-pair-ecoded text, it ca be steered with thigs like puctuatio ad capitalizatio.
E.g. to add a pause, add a comma to that part i the trascript. Or, to emphasize a word, put it i capital letters i the trascript.
This eables a fairly atural way for guidig the prosody of the geerated output. Speaker idetity is specified usig a audio referece file betwee 2-12 secods, with legths aroud 6s givig optimal results.
Further, by providig the trascript of the referece, MARS5 eables oe to do a 'deep cloe' which improves the quality of the cloig ad output, at the cost of takig a bit loger to produce the audio.
For more details o this ad other performace ad model details, please see iside the docs folder. We use The referece trascript is a optioal piece of ifo you eed if you wish to do a deep cloe.
Mars5 supports 2 kids of iferece: a shallow, fast iferece whereby you do ot eed the trascript of the referece (we call this a shallow cloe), ad a secod slower, but typically higher quality way, which we call a deep cloe.
To use the deep cloe, you eed the prompt trascript. See the model docs for more ifo o this. That's it! These default settigs provide pretty good results, but feel free to tue the iferece settigs to optimize the output for your particular example. See the Some tips for best quality: The checkpoits for MARS5 are provided uder the releases tab of this github repo. We provide two checkpoits: You must be able to store at least 750M+450M params o GPU, ad do iferece with 750M of active parameters. I geeral, at least If you do ot have the ecessary hardware requiremets ad just wat to use MARS5 i your applicatios, you ca use it via our API: see docs.camb.ai. If you eed some more credits to test it for your use case, feel free to reach out to Mars 5 is ot perfect at the momet, ad we are workig o a few efforts to improve its quality, stability, ad performace.
Rough areas we are lookig to improve, ad welcome ay cotributios: If you would like to cotribute ay improvemet to MARS, please feel free to cotribute (guidelies below). We welcome ay cotributios to improvig the model. As you may fid whe experimetig, it ca produce really great results, it ca still be further improved to create excellet outputs cosistetly. The preferred way to cotribute to our repo is to fork the master repository o GitHub: We are ope-sourcig MARS i Eglish uder GNU AGPL 3.0, but you ca request to use it uder a differet licese by emailig help@camb.ai We're a ambitious team, globally distributed, with a sigular aim of makig everyoe's voice cout. At CAMB.AI, we're a research team of Iterspeech-published, Caregie Mello, ex-Siri egieers ad we're lookig for you to joi our team. We're actively hirig; please drop us a email at ack@camb.ai if you're iterested. Visit our careers page for more ifo. Parts of code for this project are adapted from the followig repositories -- please make sure to check them out! Thak you to the authors of:MARS5: A ovel speech model for isae prosody.
Quickstart
torch.hub to make loadig the model easy -- o cloig of the repo eeded. The steps to perform iferece are simple:
huggigface_hub, torch, torchaudio, librosa, vocos, ad ecodec. Pytho must be at versio 3.10 or greater, ad torch must be v2.0 or greater.pip istall --upgrade torch torchaudio librosa vocos ecodec huggigface_hub
from iferece import Mars5TTS, IfereceCofig as cofig_class
import librosa
mars5 = Mars5TTS.from_pretraied("CAMB-AI/MARS5-TTS")
# The `mars5` cotais the AR ad NAR model, as well as iferece code.
# The `cofig_class` cotais tuable iferece cofig settigs like temperature.
# load referece audio betwee 1-12 secods.
wav, sr = librosa.load('<path to arbitrary 24kHz waveform>.wav',
sr=mars5.sr, moo=True)
wav = torch.from_umpy(wav)
ref_trascript = "<trascript of the referece audio>"
# Pick whether you wat a deep or shallow cloe. Set to False if you do't kow prompt trascript or wat fast iferece. Set to True if you kow trascript ad wat highest quality.
deep_cloe = True
# Below you ca tue other iferece settigs, like top_k, temperature, top_p, etc...
cfg = cofig_class(deep_cloe=deep_cloe, rep_pealty_widow=100,
top_k=100, temperature=0.7, freq_pealty=3)
ar_codes, output_audio = mars5.tts("The quick brow rat.", wav,
ref_trascript,
cfg=cfg)
# output_audio is (T,) shape float tesor correspodig to the 24kHz output audio.
IfereceCofig code or the demo otebook for ifo ad docs o all the differet iferece settigs.
Model details
'vocab' key, ad follows roughly the same format of a saved mibpe tokeizer. help@camb.ai for help.Roadmap
Cotributios
git remote add upstream git@github.com:Camb-ai/mars5-tts.gitgit push --set-upstream origi <NAME-NEW-BRANCH>Licese
Joi our team
Ackowledgemets
.trim() code: https://librosa.org/doc/mai/geerated/librosa.effects.trim.html
点击空白处退出提示







评论