Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Replicate demo and API #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Links:
- [Paper](https://dl.fbaipublicfiles.com/seamless/seamless_m4t_paper.pdf)
- [Demo](https://seamless.metademolab.com/)
- [🤗 Hugging Face space](https://huggingface.co/spaces/facebook/seamless_m4t)
- [Replicate Demo and API](https://replicate.com/cjwbw/seamless_communication)

# Quick Start
## Installation
Expand Down
20 changes: 20 additions & 0 deletions cog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Configuration for Cog ⚙️
# Reference: https://github.com/replicate/cog/blob/main/docs/yaml.md

build:
gpu: true
system_packages:
- "ffmpeg"
python_version: "3.10"
python_packages:
- "fairseq2==0.1.0"
- "git+https://github.com/facebookresearch/seamless_communication"
- "huggingface_hub==0.16.4"
- "torch==2.0.1"
- "torchaudio==2.0.2"
- "librosa==0.10.1"
- "soundfile==0.12.1"
- ipython
run:
- apt-get update && apt-get install libsndfile1 -y
predict: "predict.py:Predictor"
253 changes: 253 additions & 0 deletions lang_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
# Language dict
language_code_to_name = {
"afr": "Afrikaans",
"amh": "Amharic",
"arb": "Modern Standard Arabic",
"ary": "Moroccan Arabic",
"arz": "Egyptian Arabic",
"asm": "Assamese",
"ast": "Asturian",
"azj": "North Azerbaijani",
"bel": "Belarusian",
"ben": "Bengali",
"bos": "Bosnian",
"bul": "Bulgarian",
"cat": "Catalan",
"ceb": "Cebuano",
"ces": "Czech",
"ckb": "Central Kurdish",
"cmn": "Mandarin Chinese",
"cym": "Welsh",
"dan": "Danish",
"deu": "German",
"ell": "Greek",
"eng": "English",
"est": "Estonian",
"eus": "Basque",
"fin": "Finnish",
"fra": "French",
"gaz": "West Central Oromo",
"gle": "Irish",
"glg": "Galician",
"guj": "Gujarati",
"heb": "Hebrew",
"hin": "Hindi",
"hrv": "Croatian",
"hun": "Hungarian",
"hye": "Armenian",
"ibo": "Igbo",
"ind": "Indonesian",
"isl": "Icelandic",
"ita": "Italian",
"jav": "Javanese",
"jpn": "Japanese",
"kam": "Kamba",
"kan": "Kannada",
"kat": "Georgian",
"kaz": "Kazakh",
"kea": "Kabuverdianu",
"khk": "Halh Mongolian",
"khm": "Khmer",
"kir": "Kyrgyz",
"kor": "Korean",
"lao": "Lao",
"lit": "Lithuanian",
"ltz": "Luxembourgish",
"lug": "Ganda",
"luo": "Luo",
"lvs": "Standard Latvian",
"mai": "Maithili",
"mal": "Malayalam",
"mar": "Marathi",
"mkd": "Macedonian",
"mlt": "Maltese",
"mni": "Meitei",
"mya": "Burmese",
"nld": "Dutch",
"nno": "Norwegian Nynorsk",
"nob": "Norwegian Bokm\u00e5l",
"npi": "Nepali",
"nya": "Nyanja",
"oci": "Occitan",
"ory": "Odia",
"pan": "Punjabi",
"pbt": "Southern Pashto",
"pes": "Western Persian",
"pol": "Polish",
"por": "Portuguese",
"ron": "Romanian",
"rus": "Russian",
"slk": "Slovak",
"slv": "Slovenian",
"sna": "Shona",
"snd": "Sindhi",
"som": "Somali",
"spa": "Spanish",
"srp": "Serbian",
"swe": "Swedish",
"swh": "Swahili",
"tam": "Tamil",
"tel": "Telugu",
"tgk": "Tajik",
"tgl": "Tagalog",
"tha": "Thai",
"tur": "Turkish",
"ukr": "Ukrainian",
"urd": "Urdu",
"uzn": "Northern Uzbek",
"vie": "Vietnamese",
"xho": "Xhosa",
"yor": "Yoruba",
"yue": "Cantonese",
"zlm": "Colloquial Malay",
"zsm": "Standard Malay",
"zul": "Zulu",
}
LANGUAGE_NAME_TO_CODE = {v: k for k, v in language_code_to_name.items()}

# Source langs: S2ST / S2TT / ASR don't need source lang
# T2TT / T2ST use this
text_source_language_codes = [
"afr",
"amh",
"arb",
"ary",
"arz",
"asm",
"azj",
"bel",
"ben",
"bos",
"bul",
"cat",
"ceb",
"ces",
"ckb",
"cmn",
"cym",
"dan",
"deu",
"ell",
"eng",
"est",
"eus",
"fin",
"fra",
"gaz",
"gle",
"glg",
"guj",
"heb",
"hin",
"hrv",
"hun",
"hye",
"ibo",
"ind",
"isl",
"ita",
"jav",
"jpn",
"kan",
"kat",
"kaz",
"khk",
"khm",
"kir",
"kor",
"lao",
"lit",
"lug",
"luo",
"lvs",
"mai",
"mal",
"mar",
"mkd",
"mlt",
"mni",
"mya",
"nld",
"nno",
"nob",
"npi",
"nya",
"ory",
"pan",
"pbt",
"pes",
"pol",
"por",
"ron",
"rus",
"slk",
"slv",
"sna",
"snd",
"som",
"spa",
"srp",
"swe",
"swh",
"tam",
"tel",
"tgk",
"tgl",
"tha",
"tur",
"ukr",
"urd",
"uzn",
"vie",
"yor",
"yue",
"zsm",
"zul",
]
TEXT_SOURCE_LANGUAGE_NAMES = sorted(
[language_code_to_name[code] for code in text_source_language_codes]
)

# Target langs:
# S2ST / T2ST
s2st_target_language_codes = [
"eng",
"arb",
"ben",
"cat",
"ces",
"cmn",
"cym",
"dan",
"deu",
"est",
"fin",
"fra",
"hin",
"ind",
"ita",
"jpn",
"kor",
"mlt",
"nld",
"pes",
"pol",
"por",
"ron",
"rus",
"slk",
"spa",
"swe",
"swh",
"tel",
"tgl",
"tha",
"tur",
"ukr",
"urd",
"uzn",
"vie",
]
S2ST_TARGET_LANGUAGE_NAMES = sorted(
[language_code_to_name[code] for code in s2st_target_language_codes]
)
Loading