ESPnet Model Zoo
Project description
ESPnet Model Zoo
Utilities managing the pretrained models created by ESPnet.
- Zenodo community: https://zenodo.org/communities/espnet/
- Registered models: table.csv
Install
pip install torch
pip install espnet_model_zoo
Obtain a model
>>> from espnet_model_zoo.downloader import ModelDownloader
>>> d = ModelDownloader("~/.cache/espnet") # Specify cachedir
>>> d = ModelDownloader() # <module_dir> is used as cachedir by default
To obtain a model, you need to give a model in the form of <user_name/model_name>
>>> d.download_and_unpack("kamo-naoyuki/mini_an4_asr_train_raw_bpe_valid.acc.best")
{"asr_train_config": <config path>, "asr_model_file": <model path>, ...}
Note that if the model already exists, you can skip downloading and unpacking.
You can also get a model with certain conditions.
>>> d.download_and_unpack(task="asr", corpus="wsj")
If multiple models are found with the condition, the last model is selected. You can also specify the condition using "version" option.
>>> d.download_and_unpack(task="asr", corpus="wsj", version=-1) # Get the last model
>>> d.download_and_unpack(task="asr", corpus="wsj", version=-2) # Get previous model
You can also obtain it from the URL directly.
>>> d.download_and_unpack("https://zenodo.org/record/...")
[...]
Query model names
You can view the model names from our Zenodo community, https://zenodo.org/communities/espnet/,
or using query(). All information are written in table.csv.
>>> d.query("name")
[...]
You can also show them with specifying certain conditions.
>>> d.query("name", task="asr")
[...]
Command line tools
-
espnet_model_zoo_query# Query model name espnet_model_zoo_query --condition task=asr --condition corpus=wsj # Query the other key espnet_model_zoo_query --key url --condition task=asr --condition corpus=wsj
-
espnet_model_zoo_downloadespnet_model_zoo_download <model_name> # Print the path of the downloaded file espnet_model_zoo_download --unpack true <model_name> # Print the path of unpacked files
-
espnet_model_zoo_uploadexport ACCESS_TOKEN=<access_token> espnet_zenodo_upload \ --file <packed_model> \ --title <title> \ --description <description> \ --creator_name <your-git-account>
Use a pretrained model for inference
ASR
>>> import soundfile
>>> from espnet_model_zoo.downloader import ModelDownloader
>>> from espnet2.bin.asr_inference import Speech2Text
>>> d = ModelDownloader()
>>> speech2text = Speech2Text(**d.download_and_unpack("user_name/model_name"))
>>> speech, rate = soundfile.read("speech.wav")
>>> speech2text(speech)
[(text, token, token_int, hypothesis object), ...]
TTS
>>> import soundfile
>>> from espnet_model_zoo.downloader import ModelDownloader
>>> from espnet2.bin.tts_inference import Text2Speech
>>> d = ModelDownloader()
>>> text2speech = Text2Speech(**d.download_and_unpack("user_name/model_name"))
>>> retval = text2speech("foobar")
>>> speech = retval[0]
>>> soundfile.write("out.wav", speech.numpy(), text2speech.fs, "PCM_16")
Register your model
-
Upload your model to Zenodo
You need to signup to Zenodo and create an access token to upload models. You can upload your own model by using
espnet_model_zoo_uploadcommand freely, but we normally upload a model using recipes. -
Create a Pull Request to modify table.csv
You need to append your record at the last line.
-
(Administrator does) Increment the third version number of setup.py, e.g. 0.0.3 -> 0.0.4
-
(Administrator does) Release new version
Update your model
If your model has some troubles, please modify the record at Zenodo directly or reupload a corrected file using espnet_zenodo_upload as another record.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file espnet_model_zoo-0.0.0a4.tar.gz.
File metadata
- Download URL: espnet_model_zoo-0.0.0a4.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c99b29e4de68e6d02218c0b26ff0b6ecee0d609f26c2d82bd497ec644defa1aa
|
|
| MD5 |
882a7d96deeb424f18241802fdad1b6b
|
|
| BLAKE2b-256 |
36e94c1c66ee1ff79f951373be4bc7f0d632fa595ff5f3acd703476644fc2693
|
File details
Details for the file espnet_model_zoo-0.0.0a4-py3-none-any.whl.
File metadata
- Download URL: espnet_model_zoo-0.0.0a4-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4d628e34befe983a1193b0694dcbb2e76d73e6abde486c6abbf6d72db965459
|
|
| MD5 |
d8cb0f5838b0eb91b908da3c9f3669cf
|
|
| BLAKE2b-256 |
0246512203f3d19e120f6fb87483604b512608746354ffebd83612356d42dc77
|