Zum Inhalt springen
ModelAufgelistetExtern
Herunterladen

Nos TTS Brais Vits Graphemes

Brais is a Galician TTS model developed by the Nós project. It was trained from scratch using the Coqui TTS Python library on the corpus NosBrais-GL. This corpus comprises a total of 16,121 sentences recorded by a...

ArtOtherVersionRevision 644925dBBewertung

Modellquelle

Art
Other
Dateigröße
952 MB
Version
vRevision 644925d
Aktualisiert
18. Okt. 2026
Downloads
57
Quelle
Hugging Face

Quellenbeschreibung

Brais: Nós Project's Galician TTS Model

Model description

Brais is a Galician TTS model developed by the Nós project. It was trained from scratch using the Coqui TTS Python library on the corpus Nos_Brais-GL. This corpus comprises a total of 16,121 sentences recorded by a professional male voice talent, corresponding to approximately 18 hours of speech.

The model was trained directly on grapheme inputs, so no phonetic transcription is required. The Cotovía tool can be used to normalize the input text.

You can test the model in our live inference demo (Nós-TTS) or in our spaces (Galician TTS).

Intended uses and limitations

You can use this model to generate synthetic speech in Galician.

Installation

Cotovía

For text normalization, you can use the front-end of Cotovía. This software is available for download on the SourceForge website. The required Debian packages are cotovia_0.5_amd64.deb and cotovia-lang-gl_0.5_all.deb, which can be installed using the following commands:

sudo dpkg -i cotovia_0.5_amd64.deb
sudo dpkg -i cotovia-lang-gl_0.5_all.deb

TTS library

To synthesize speech, you need to install the Coqui TTS library:

pip install TTS

How to use

Command-line usage

The following command normalizes and synthesizes the input text using the Brais model:

echo "Son Brais, unha voz creada con intelixencia artificial" | cotovia -p -n -S | iconv -f iso88591 -t utf8 | tts --text "$(cat -)" --model_path brais.pth --config_path config.json --out_path brais.wav

The output synthesized speech is saved to the specified audio file.

Python usage

Normalization and synthesis can also be performed within Python:

import argparse
import string
import subprocess
from TTS.utils.synthesizer import Synthesizer

def sanitize_filename(filename):
    """Remove or replace any characters that are not allowed in file names."""
    return ''.join(c for c in filename if c.isalnum() or c in (' ', '_', '-')).rstrip()

def to_cotovia(text):
    # Input and output Cotovía files
    COTOVIA_IN_TXT_PATH = res + '.txt'
    COTOVIA_IN_TXT_PATH_ISO = 'iso8859-1' + res + '.txt'
    COTOVIA_OUT_PRE_PATH = 'iso8859-1' + res + '.pre'
    COTOVIA_OUT_PRE_PATH_UTF8 = 'utf8' + res + '.pre'

    with open(COTOVIA_IN_TXT_PATH, 'w') as f:
        f.write(text + '\n')

    # UTF-8 to ISO8859-1
    subprocess.run(["iconv", "-f", "utf-8", "-t", "iso8859-1", COTOVIA_IN_TXT_PATH, "-o", COTOVIA_IN_TXT_PATH_ISO], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
    subprocess.run(["cotovia", "-i", COTOVIA_IN_TXT_PATH_ISO, "-p"], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
    subprocess.run(["iconv", "-f", "iso8859-1", "-t", "utf-8", COTOVIA_OUT_PRE_PATH, "-o", COTOVIA_OUT_PRE_PATH_UTF8], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)

    segs = []
    try:
        with open(COTOVIA_OUT_PRE_PATH_UTF8, 'r') as f:
            segs = [line.rstrip() for line in f]
    except:
        print("ERROR: Couldn't read cotovia output")

    subprocess.run(["rm", COTOVIA_IN_TXT_PATH, COTOVIA_IN_TXT_PATH_ISO, COTOVIA_OUT_PRE_PATH, COTOVIA_OUT_PRE_PATH_UTF8], stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)

    return segs

def text_preprocess(text):
    cotovia_preproc_text = to_cotovia(text)

    # Convert list to string
    cotovia_preproc_text_res = ' '.join(cotovia_preproc_text)

    # Add final punctuation if missing
    if cotovia_preproc_text_res[-1] not in string.punctuation:
        cotovia_preproc_text_res += '.'

    return cotovia_preproc_text_res

def main():
    parser = argparse.ArgumentParser(description='Cotovía text normalisation')
    parser.add_argument('text', type=str, help='Text to synthetize')
    parser.add_argument('model_path', type=str, help='Absolute path to the model checkpoint.pth')
    parser.add_argument('config_path', type=str, help='Absolute path to the model config.json')

    args = parser.parse_args()

    print("Text before preprocessing: ", args.text)
    text = text_preprocess(args.text)
    print("Text after preprocessing: ", text)

    synthesizer = Synthesizer(
        args.model_path, args.config_path, None, None, None, None,
    )

    # Step 1: Extract the first word from the text
    first_word = args.text.split()[0] if args.text.split() else "audio"
    first_word = sanitize_filename(first_word)  # Sanitize to make it a valid filename

    # Step 2: Use synthesizer's built-in function to synthesize and save the audio
    wavs = synthesizer.tts(text)
    filename = f"{first_word}.wav"
    synthesizer.save_wav(wavs, filename)

    print(f"Audio file saved as: {filename}")

if __name__ == "__main__":
    main()

This Python code takes an input text, normalizes it using Cotovía’s front-end, synthesizes speech from the normalized text, and saves the synthetic output speech as a .wav file.

A more advanced version, including additional text preprocessing, can be found in the script synthesize.py, avaliable in this repository. You can use this script to synthesise speech from an input text as follows:

python synthesize.py text model_path config_path

Training

Hyperparameter

The model is based on VITS proposed by Kim et al. The following hyperparameters were set in the coqui framework.

HyperparameterValue
Modelvits
Batch Size48
Eval Batch Size16
Mixed Precisiontrue
Window Length1024
Hop Length256
FTT size1024
Num Mels80
Phonemizernull
Phoneme Languagenull
Text Cleanersnull
Formatternos_grafemas
Optimizeradam
Adam betas(0.8, 0.99)
Adam eps1e-09
Adam weight decay0.01
Learning Rate Gen0.0002
Lr. scheduler GenExponentialLR
Lr. scheduler Gamma Gen0.999875
Learning Rate Disc0.0002
Lr. scheduler DiscExponentialLR
Lr. scheduler Gamma Disc0.999875

The model was trained for 160,000 steps.

The nos_grafemas formatter is a modification of the LJSpeech formatter with one extra column for the normalized input (extended numbers and acronyms).

Additional information

Authors

Antonio Moscoso.

Contact information

For further information, send an email to [email protected]

Licensing Information

Apache License, Version 2.0

Funding

This research was produced within the framework of the Proxecto Nós, funded by the Ministry for Digital Transformation and Public Administration and the Recovery, Transformation, and Resilience Plan – Funded by the European Union – NextGenerationEU, as part of the Ilenia Project with reference 2022/TL22/00215336, and previously “The Nós project: Galician in the society and economy of Artificial Intelligence”, resulting from the agreement 2021-CP080 between the Xunta de Galicia and the University of Santiago de Compostela, and thanks to the Investigo program, within the National Recovery, Transformation and Resilience Plan, within the framework of the European Recovery Fund (NextGenerationEU).

Citation information

If you use this model, please cite as follows:

Moscoso, Antonio. 2024. Nos_TTS-brais-vits-graphemes. URL: https://huggingface.co/proxectonos/Nos_TTS-brais-vits-graphemes

Quellen

1 Quelle
Hugging FacePrimärVersion 644925d6d3e2d21b7a144e38773a33fab9fb52ae
huggingface.co/proxectonos/Nos_TTS-brais-vits-graphemes/tree/644925d6d3e2d21b7a144e38773a33fab9fb52ae

Verifiziert 29. Aug.

Modellartefakte

1 Artefakt

brais.pth

pth · 952 MB · SHA-256 71b19fe67430…cbe5 · Hugging Face

Download file

Quellenauszüge

2 Auszüge

--- extra_gated_heading: >- This repository is publicly accessible, but you have to accept the Terms and Conditions to access its files and content. extra_gated_description: >- ## **Terms and Conditions of Use** ### Agreement These Terms and Conditions govern the use of the Galician text-to-speech (TTS) model Nos_TTS-brais-vits-graphemes based on artificial neural networks developed within the framework of the Nós Project of the University of Santiago de Compostela (hereinafter, "Holder"). The model is available for download and use under the Apache License, Version 2.0. By downloading or using the model, the user (hereinafter, "User") agrees to these terms. The use of the models also implies compliance with privacy policies and any additional regulations associated with the download repository. ### Purpose The TTS model is designed for research and development of applications related to TTS technology in Galician. ### License The model is made available under the Apache License, Version 2.0, which allows its use, modification, and distribution, provided the license terms are respected, including proper acknowledgement of the Holder as the original creator. ### Permitted Use The model may be used to generate synthetic speech in Galician according to the terms of the aforementioned License.Users are responsible for complying with applicable laws and respecting third-party rights when using the model. ### Restrictions Users agree not to: - Use the model for illegal activities or any activity that may infringe intellectual property or other third-party rights, including, but not limited to, its use to promote disinformation, hate speech or breaches of privacy. - Claim that the model was developed by entities other than the Holder. ### Disclaimer The model is provided "as is" without any warranty of any kind. The Holder shall not be liable for any direct, indirect, or consequential damages resulting from the use or inability to use the model and does not guarantee the absence of bias or errors in the generated content. ### Amendments to the Terms These Terms may be updated by the Holder at any time. The latest version will be available in the repository where the model is hosted. This document is a legal contract between you and the dataset provider. By accessing and using the model, you acknowledge and a...

Source context: 57 downloads · 0 likes · Pipeline text-to-speech · Library coqui · Repo proxectonos/Nos_TTS-brais-vits-graphemes