Skip to content

Charity333333333/PI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PI

Requirement

pip install fairseq==0.10.2
conda install scikit-learn
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch

Dataset

[English-German]

[Chinese-English]

Model Checkpoints

[English-German]

[Chinese-English]

Usage

1.Download Dataset (already processed using fairseq), Model Checkpoints.

2.Training:

# From English to German
fairseq-train data-bin/en --user-dir . --max-tokens 4096   \
              --task parameter_inheritance_task --lang-pairs en-de,en-em,en-iw,en-no  \
              --arch parameter_inheritance_model  \
              --optimizer adam --adam-eps 1e-06 --adam-betas '(0.9,0.98)' --clip-norm 1.0  \
              --lr-scheduler inverse_sqrt --stop-min-lr 1e-9 --warmup-init-lr 1e-7 --warmup-updates 8000 \
              --lr 5e-4 --criterion label_smoothed_cross_entropy --label-smoothing 0.1 --dropout 0.1 \
              --attention-dropout 0.3 --weight-decay 0.0 --max-tokens 4096 --update-freq 8 --fp16 \
              --save-dir checkpoints/en --tensorboard-logdir checkpoints/en  --log-format

# From Chinese to English 
fairseq-train data-bin/zh--user-dir . --max-tokens 4096   \
              --task parameter_inheritance_task --lang-pairs zh-en,zh-ed,zh-sp,zh-th  \
              --arch parameter_inheritance_model  \
              --optimizer adam --adam-eps 1e-06 --adam-betas '(0.9,0.98)' --clip-norm 1.0  \
              --lr-scheduler inverse_sqrt --stop-min-lr 1e-9 --warmup-init-lr 1e-7 --warmup-updates 8000 \
              --lr 5e-4 --criterion label_smoothed_cross_entropy --label-smoothing 0.1 --dropout 0.1 \
              --attention-dropout 0.3 --weight-decay 0.0 --max-tokens 4096 --update-freq 8 --fp16 \
              --save-dir checkpoints/zh --tensorboard-logdir checkpoints/zh  --log-format

3.Decoding:

# From English to German
fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs en-de,en-em,en-no,en-iw  --source-lang en --target-lang de \
               --max-tokens 4096 --beam 4 --lenpen 0.6  --quiet \
               --path $model_path > generate/en2de.txt

fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs en-de,en-em,en-no,en-iw   --source-lang en --target-lang em \
               --max-tokens 4096 --beam 4 --lenpen 0.6  --quiet \
               --path $model_path > generate/en2em.txt

fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs en-de,en-em,en-no,en-iw   --source-lang en --target-lang no \
               --max-tokens 4096 --beam 4 --lenpen 0.6  --quiet \
               --path $model_path > generate/en2no.txt
               
fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs en-de,en-em,en-no,en-iw   --source-lang en --target-lang iw \
               --max-tokens 4096 --beam 4 --lenpen 0.6  --quiet \
               --path $model_path > generate/en2iw.txt

# From Chinese to English
fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs zh-en,zh-ed,zh-sp,zh-th  --source-lang zh --target-lang en \
               --max-tokens 4096 --quiet \
               --path $model_path > generate/zh2en.txt
         
fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs zh-en,zh-ed,zh-sp,zh-th  --source-lang zh --target-lang ed \
               --max-tokens 4096 --quiet \
               --path $model_path > generate/zh2ed.txt
               
fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs zh-en,zh-ed,zh-sp,zh-th  --source-lang zh --target-lang sp \
               --max-tokens 4096 --quiet \
               --path $model_path > generate/zh2sp.txt
               
fairseq-generate $data_path --user-dir . --task parameter_inheritance_task \
               --lang-pairs zh-en,zh-ed,zh-sp,zh-th  --source-lang zh --target-lang th \
               --max-tokens 4096 --quiet \
               --path $model_path > generate/zh2th.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages