Giter Site home page Giter Site logo

fairseqapi's Introduction

fairseqAPI

Small example use of the fairseq python library

This is a proof of concept of how the fairseq python library can be used for tts, given that the examples on HuggingFace and the repo are either unclear, or broken.

Installation

(This installation should work for python versions 3.8 through 3.10. version 3.11 is not yet supported. Run python --version to view current installation)

  • clone this repository to your local machine and cd into it
git clone https://github.com/Alex23rodriguez/fairseqAPI.git
cd fairseqAPI
  • clone facebook's fairseq repository, as there are many modules that we use. Notice that we change the name to avoid confision between the module and the repo folder.
git clone --depth 1 https://github.com/pytorch/fairseq fairseq_repo

NOTE: this is different from pip install fairseq, which installs the CLI tool, not the python module. Check out their repo for more info.

  • install the required modules
    • it is recommended to create a virtual envirenment before installing requirements: python -m venv venv && source venv/bin/activate
pip install -r requirements.txt

Usage

downloading models

Once the setup is done, we can move on to downloading a model from Hugging Face. Given that I personally use this for Russian, the model defaults to this one (note that the example on HG's website is currently broken)

  • to download the russian tts model, simply run the following command:
python download_hf_model.py
  • to download any other model, pass it as a commandline argument
python download_hf_model.py facebook/tts_transformer-ru-cv7_css10
  • note that models are typically heavy, which is why we only want to do this step once

using models

To use tts, simply call tts.py with the corresponding commandline arguments (python tts.py -h for more info).

python tts.py Здравствуйте, это пробный запуск. До свидание.
  • output defaults to ./out/out.wav
    • to play the output from the terminal install sox and use play out/out.wav
    • sox can also be used to change the speed of the recording: sox input.wav output.wav tempo 1.33

fairseqapi's People

Contributors

alex23rodriguez avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.