make_triton_model_repo.sh 10.5 KB
Newer Older
1
#!/bin/bash
2 3
wget -O models.zip "https://ssmt.iiit.ac.in/uploads/data_mining/models.zip" --no-check-certificate
wget "https://cdn.iiit.ac.in/cdn/ssmt.iiit.ac.in/uploads/data_mining/HimangY-oneMT-Models-V1.zip" --no-check-certificate
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
4
unzip models.zip
5
unzip HimangY-oneMT-Models-V1.zip
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
6 7
python3 -m venv ./ssmt_ct2
source ./ssmt_ct2/bin/activate
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
pip install -U pip wheel; pip install ctranslate2 "OpenNMT-py==1.2.0"
cd HimangY-oneMT-Models-V1
ct2-opennmt-py-converter --model_path 150001.pt --output_dir en-hi; mv 150001.src en-hi.src
ct2-opennmt-py-converter --model_path 150002.pt --output_dir hi-en; mv 150002.src hi-en.src
ct2-opennmt-py-converter --model_path 150003.pt --output_dir en-te; mv 150003.src en-te.src
ct2-opennmt-py-converter --model_path 150004.pt --output_dir te-en; mv 150004.src te-en.src
ct2-opennmt-py-converter --model_path 150005.pt --output_dir hi-te; mv 150005.src hi-te.src
ct2-opennmt-py-converter --model_path 150006.pt --output_dir te-hi; mv 150006.src te-hi.src
ct2-opennmt-py-converter --model_path 150007.pt --output_dir hi-ur; mv 150007.src hi-ur.src
ct2-opennmt-py-converter --model_path 150008.pt --output_dir ur-hi; mv 150008.src ur-hi.src
# ct2-opennmt-py-converter --model_path 150009.pt --output_dir hi-gu; mv 150009.src hi-gu.src
ct2-opennmt-py-converter --model_path 150010.pt --output_dir gu-hi; mv 150010.src gu-hi.src
# ct2-opennmt-py-converter --model_path 150011.pt --output_dir hi-pa; mv 150011.src hi-pa.src
ct2-opennmt-py-converter --model_path 150013.pt --output_dir hi-or; mv 150013.src hi-or.src
ct2-opennmt-py-converter --model_path 150014.pt --output_dir or-hi; mv 150014.src or-hi.src
ct2-opennmt-py-converter --model_path 150015.pt --output_dir hi-ta; mv 150015.src hi-ta.src
ct2-opennmt-py-converter --model_path 150017.pt --output_dir hi-kn; mv 150017.src hi-kn.src
ct2-opennmt-py-converter --model_path 150018.pt --output_dir kn-hi; mv 150018.src kn-hi.src
ct2-opennmt-py-converter --model_path 150019.pt --output_dir ta-te; mv 150019.src ta-te.src
ct2-opennmt-py-converter --model_path 150020.pt --output_dir te-ta; mv 150020.src te-ta.src
cd ../models
ct2-opennmt-py-converter --model_path 1.pt --output_dir en-hi; mv 1.src en-hi.src
ct2-opennmt-py-converter --model_path 2.pt --output_dir hi-en; mv 2.src hi-en.src
# ct2-opennmt-py-converter --model_path 3.pt --output_dir en-te; mv 3.src en-te.src
ct2-opennmt-py-converter --model_path 4.pt --output_dir te-en; mv 4.src te-en.src
ct2-opennmt-py-converter --model_path 6.pt --output_dir hi-te; mv 6.src hi-te.src
ct2-opennmt-py-converter --model_path 7.pt --output_dir te-hi; mv 7.src te-hi.src
ct2-opennmt-py-converter --model_path 8.pt --output_dir en-gu; mv 8.src en-gu.src
ct2-opennmt-py-converter --model_path 9.pt --output_dir gu-en; mv 9.src gu-en.src
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
37
cd ..
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
mkdir himangy_triton_repo
cd himangy_triton_repo
cp -r ../triton_models/nmt .
cp -r ../triton_models/demuxer .
cp -r ../triton_models/tokenizer .
cp -r ../triton_models/model_ct2 himangy-en-hi;mv ../HimangY-oneMT-Models-V1/en-hi himangy-en-hi/1/translator;mv ../HimangY-oneMT-Models-V1/en-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-en-hi/' himangy-en-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'en', 'hi'/" himangy-en-hi/1/model.py
cp -r ../triton_models/model_ct2 himangy-hi-en;mv ../HimangY-oneMT-Models-V1/hi-en himangy-hi-en/1/translator;mv ../HimangY-oneMT-Models-V1/hi-en.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-en/' himangy-hi-en/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'en'/" himangy-hi-en/1/model.py
cp -r ../triton_models/model_ct2 himangy-en-te;mv ../HimangY-oneMT-Models-V1/en-te himangy-en-te/1/translator;mv ../HimangY-oneMT-Models-V1/en-te.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-en-te/' himangy-en-te/config.pbtxt;sed -i "s/input_lang, output_lang/'en', 'te'/" himangy-en-te/1/model.py
cp -r ../triton_models/model_ct2 himangy-te-en;mv ../HimangY-oneMT-Models-V1/te-en himangy-te-en/1/translator;mv ../HimangY-oneMT-Models-V1/te-en.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-te-en/' himangy-te-en/config.pbtxt;sed -i "s/input_lang, output_lang/'te', 'en'/" himangy-te-en/1/model.py
cp -r ../triton_models/model_ct2 himangy-hi-te;mv ../HimangY-oneMT-Models-V1/hi-te himangy-hi-te/1/translator;mv ../HimangY-oneMT-Models-V1/hi-te.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-te/' himangy-hi-te/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'te'/" himangy-hi-te/1/model.py
cp -r ../triton_models/model_ct2 himangy-te-hi;mv ../HimangY-oneMT-Models-V1/te-hi himangy-te-hi/1/translator;mv ../HimangY-oneMT-Models-V1/te-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-te-hi/' himangy-te-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'te', 'hi'/" himangy-te-hi/1/model.py
cp -r ../triton_models/model_ct2 himangy-hi-ur;mv ../HimangY-oneMT-Models-V1/hi-ur himangy-hi-ur/1/translator;mv ../HimangY-oneMT-Models-V1/hi-ur.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-ur/' himangy-hi-ur/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'ur'/" himangy-hi-ur/1/model.py
cp -r ../triton_models/model_ct2 himangy-ur-hi;mv ../HimangY-oneMT-Models-V1/ur-hi himangy-ur-hi/1/translator;mv ../HimangY-oneMT-Models-V1/ur-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-ur-hi/' himangy-ur-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'ur', 'hi'/" himangy-ur-hi/1/model.py
cp -r ../triton_models/model_onmt himangy-hi-gu;mv ../HimangY-oneMT-Models-V1/150009.pt himangy-hi-gu/1/translator.pt;mv ../HimangY-oneMT-Models-V1/150009.src tokenizer/1/bpe_src/hi-gu.src;sed -i 's/model_name/himangy-hi-gu/' himangy-hi-gu/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'gu'/" himangy-hi-gu/1/model.py
cp -r ../triton_models/model_ct2 himangy-gu-hi;mv ../HimangY-oneMT-Models-V1/gu-hi himangy-gu-hi/1/translator;mv ../HimangY-oneMT-Models-V1/gu-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-gu-hi/' himangy-gu-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'gu', 'hi'/" himangy-gu-hi/1/model.py
cp -r ../triton_models/model_onmt himangy-hi-pa;mv ../HimangY-oneMT-Models-V1/150011.pt himangy-hi-pa/1/translator.pt;mv ../HimangY-oneMT-Models-V1/150011.src tokenizer/1/bpe_src/hi-pa.src;sed -i 's/model_name/himangy-hi-pa/' himangy-hi-pa/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'pa'/" himangy-hi-pa/1/model.py
cp -r ../triton_models/model_ct2 himangy-hi-or;mv ../HimangY-oneMT-Models-V1/hi-or himangy-hi-or/1/translator;mv ../HimangY-oneMT-Models-V1/hi-or.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-or/' himangy-hi-or/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'or'/" himangy-hi-or/1/model.py
cp -r ../triton_models/model_ct2 himangy-or-hi;mv ../HimangY-oneMT-Models-V1/or-hi himangy-or-hi/1/translator;mv ../HimangY-oneMT-Models-V1/or-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-or-hi/' himangy-or-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'or', 'hi'/" himangy-or-hi/1/model.py
# cp -r ../triton_models/model_ct2 himangy-hi-ta;mv ../HimangY-oneMT-Models-V1/hi-ta himangy-hi-ta/1/translator;mv ../HimangY-oneMT-Models-V1/hi-ta.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-ta/' himangy-hi-ta/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'ta'/" himangy-hi-ta/1/model.py
cp -r ../triton_models/model_ct2 himangy-hi-kn;mv ../HimangY-oneMT-Models-V1/hi-kn himangy-hi-kn/1/translator;mv ../HimangY-oneMT-Models-V1/hi-kn.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-kn/' himangy-hi-kn/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'kn'/" himangy-hi-kn/1/model.py
cp -r ../triton_models/model_ct2 himangy-kn-hi;mv ../HimangY-oneMT-Models-V1/kn-hi himangy-kn-hi/1/translator;mv ../HimangY-oneMT-Models-V1/kn-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-kn-hi/' himangy-kn-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'kn', 'hi'/" himangy-kn-hi/1/model.py
# cp -r ../triton_models/model_ct2 himangy-ta-te;mv ../HimangY-oneMT-Models-V1/ta-te himangy-ta-te/1/translator;mv ../HimangY-oneMT-Models-V1/ta-te.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-ta-te/' himangy-ta-te/config.pbtxt;sed -i "s/input_lang, output_lang/'ta', 'te'/" himangy-ta-te/1/model.py
# cp -r ../triton_models/model_ct2 himangy-te-ta;mv ../HimangY-oneMT-Models-V1/te-ta himangy-te-ta/1/translator;mv ../HimangY-oneMT-Models-V1/te-ta.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-te-ta/' himangy-te-ta/config.pbtxt;sed -i "s/input_lang, output_lang/'te', 'ta'/" himangy-te-ta/1/model.py
# cp -r ../triton_models/model_ct2 himangy-en-hi;mv ../models/en-hi himangy-en-hi/1/translator;mv ../models/en-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-en-hi/' himangy-en-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'en', 'hi'/" himangy-en-hi/1/model.py
# cp -r ../triton_models/model_ct2 himangy-hi-en;mv ../models/hi-en himangy-hi-en/1/translator;mv ../models/hi-en.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-en/' himangy-hi-en/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'en'/" himangy-hi-en/1/model.py
# cp -r ../triton_models/model_onnmt himangy-en-te;mv ../models/3.pt himangy-en-te/1/translator.pt;mv ../models/3.src tokenizer/1/bpe_src/en-te.src;sed -i 's/model_name/himangy-en-te/' himangy-en-te/config.pbtxt;sed -i "s/input_lang, output_lang/'en', 'te'/" himangy-en-te/1/model.py
# cp -r ../triton_models/model_ct2 himangy-te-en;mv ../models/te-en himangy-te-en/1/translator;mv ../models/te-en.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-te-en/' himangy-te-en/config.pbtxt;sed -i "s/input_lang, output_lang/'te', 'en'/" himangy-te-en/1/model.py
# cp -r ../triton_models/model_ct2 himangy-hi-te;mv ../models/hi-te himangy-hi-te/1/translator;mv ../models/hi-te.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-hi-te/' himangy-hi-te/config.pbtxt;sed -i "s/input_lang, output_lang/'hi', 'te'/" himangy-hi-te/1/model.py
# cp -r ../triton_models/model_ct2 himangy-te-hi;mv ../models/te-hi himangy-te-hi/1/translator;mv ../models/te-hi.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-te-hi/' himangy-te-hi/config.pbtxt;sed -i "s/input_lang, output_lang/'te', 'hi'/" himangy-te-hi/1/model.py
cp -r ../triton_models/model_ct2 himangy-en-gu;mv ../models/en-gu himangy-en-gu/1/translator;mv ../models/en-gu.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-en-gu/' himangy-en-gu/config.pbtxt;sed -i "s/input_lang, output_lang/'en', 'gu'/" himangy-en-gu/1/model.py
cp -r ../triton_models/model_ct2 himangy-gu-en;mv ../models/gu-en himangy-gu-en/1/translator;mv ../models/gu-en.src tokenizer/1/bpe_src;sed -i 's/model_name/himangy-gu-en/' himangy-gu-en/config.pbtxt;sed -i "s/input_lang, output_lang/'gu', 'en'/" himangy-gu-en/1/model.py
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
69
cd ..
70
deactivate
71
rm -rf ssmt_ct2;rm -rf HimangY-oneMT-Models-V1;rm -rf models;rm -f models.zip;rm -f HimangY-oneMT-Models-V1.zip