make_triton_model_repo.sh 2.3 KB
Newer Older
1
#!/bin/bash
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
2 3
MODELS_URL=$1
QUANTIZATION=$2
4
wget -O models.zip $MODELS_URL --no-check-certificate
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
5 6 7 8 9
unzip models.zip
python3 -m venv ./ssmt_ct2
source ./ssmt_ct2/bin/activate
pip install ctranslate2 "OpenNMT-py==1.2.0"
cd models
10 11 12 13 14 15 16 17
ct2-opennmt-py-converter --model_path 1.pt --output_dir ./1_ct2
ct2-opennmt-py-converter --model_path 2.pt --output_dir ./2_ct2
# ct2-opennmt-py-converter --model_path 3.pt --output_dir ./3_ct2
ct2-opennmt-py-converter --model_path 4.pt --output_dir ./4_ct2
ct2-opennmt-py-converter --model_path 6.pt --output_dir ./6_ct2
ct2-opennmt-py-converter --model_path 7.pt --output_dir ./7_ct2
ct2-opennmt-py-converter --model_path 8.pt --output_dir ./8_ct2
ct2-opennmt-py-converter --model_path 9.pt --output_dir ./9_ct2
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
18 19 20 21 22 23 24 25 26 27 28 29 30
cd ..
mkdir ssmt_triton_repo
cd ssmt_triton_repo
cp -r ../triton_models/ssmt_pipeline .
cp -r ../triton_models/ssmt_model_demuxer .
cp -r ../triton_models/ssmt_tokenizer .
cp -r ../models/*.src ssmt_tokenizer/1/bpe_src
cp -r ../triton_models/ssmt_template_model_repo ssmt_1_ct2
cp -r ../models/1_ct2 ssmt_1_ct2/1/translator
sed -i 's/model_name/ssmt_1_ct2/' ssmt_1_ct2/config.pbtxt
cp -r ../triton_models/ssmt_template_model_repo ssmt_2_ct2
cp -r ../models/2_ct2 ssmt_2_ct2/1/translator
sed -i 's/model_name/ssmt_2_ct2/' ssmt_2_ct2/config.pbtxt
31 32 33
# cp -r ../triton_models/ssmt_template_model_repo ssmt_3_ct2
# cp -r ../models/3_ct2 ssmt_3_ct2/1/translator
# sed -i 's/model_name/ssmt_3_ct2/' ssmt_3_ct2/config.pbtxt
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
cp -r ../triton_models/ssmt_template_model_repo ssmt_4_ct2
cp -r ../models/4_ct2 ssmt_4_ct2/1/translator
sed -i 's/model_name/ssmt_4_ct2/' ssmt_4_ct2/config.pbtxt
cp -r ../triton_models/ssmt_template_model_repo ssmt_6_ct2
cp -r ../models/6_ct2 ssmt_6_ct2/1/translator
sed -i 's/model_name/ssmt_6_ct2/' ssmt_6_ct2/config.pbtxt
cp -r ../triton_models/ssmt_template_model_repo ssmt_7_ct2
cp -r ../models/7_ct2 ssmt_7_ct2/1/translator
sed -i 's/model_name/ssmt_7_ct2/' ssmt_7_ct2/config.pbtxt
cp -r ../triton_models/ssmt_template_model_repo ssmt_8_ct2
cp -r ../models/8_ct2 ssmt_8_ct2/1/translator
sed -i 's/model_name/ssmt_8_ct2/' ssmt_8_ct2/config.pbtxt
cp -r ../triton_models/ssmt_template_model_repo ssmt_9_ct2
cp -r ../models/9_ct2 ssmt_9_ct2/1/translator
sed -i 's/model_name/ssmt_9_ct2/' ssmt_9_ct2/config.pbtxt
cd ..
50
source ./ssmt_ct2/bin/activate
Nikhilesh Bhatnagar's avatar
Nikhilesh Bhatnagar committed
51 52 53
rm -rf ssmt_ct2
rm -f models.zip
rm -rf models