marian-nmt / marian

Fast Neural Machine Translation in C++
https://marian-nmt.github.io
Other
1.2k stars 226 forks source link

CPU-only translation command #67

Closed geovedi closed 7 years ago

geovedi commented 7 years ago

Hi,

I have some model trained using GPU (see #63) and would like to do CPU-only translation, but couldn't get the right command to reproduce GPU translation result.

These are the commands I used and the results I get...

Commands

GPU

$ head -n 100 data/dev.bpe.en | ./bin/amun -c model/model.npz.dev.npz.amun.yml -b 12 -n \
    --gpu-threads 1 --cpu-threads 0 --mini-batch 1 --maxi-batch 100 \
    --log-progress 0 > data/dev.bpe.en.id.beam12.gpu

[Sat May 6 20:25:47 2017] (I) Options: allow-unk: false
beam-size: 12
cpu-threads: 0
devices: [0]
gpu-threads: 1
log-info: true
log-progress: false
max-length: 500
maxi-batch: 100
mini-batch: 1
n-best: false
no-debpe: false
normalize: true
relative-paths: false
return-alignment: false
scorers:
  F0:
    path: model/model.npz.dev.npz
    type: Nematus
show-weights: false
softmax-filter:
  []
source-vocab: model/vocab.en.yml
target-vocab: model/vocab.id.yml
weights:
  F0: 1
wipo: false

[Sat May 6 20:25:47 2017] (I) Loading scorers...
[Sat May 6 20:25:47 2017] (I) Loading model model/model.npz.dev.npz onto gpu 0
[Sat May 6 20:25:47 2017] (I) Reading from stdin
[Sat May 6 20:25:47 2017] (I) Setting CPU thread count to 0
[Sat May 6 20:25:47 2017] (I) Setting GPU thread count to 1
[Sat May 6 20:25:47 2017] (I) Total number of threads: 1
[Sat May 6 20:25:47 2017] (I) Reading input
[Sat May 6 20:25:49 2017] (I) Total time:  1.978809s wall, 1.750000s user + 0.240000s system = 1.990000s CPU (100.6%)

CPU

$ head -n 100 data/dev.bpe.en | ./bin/amun -c model/model.npz.dev.npz.amun.yml -b 12 -n \
    --gpu-threads 0 --cpu-threads 4 --mini-batch 1 --maxi-batch 100 \
    --log-progress 0 > data/dev.bpe.en.id.beam12.cpu

[Sat May 6 20:24:30 2017] (I) Options: allow-unk: false
beam-size: 12
cpu-threads: 4
devices: [0]
gpu-threads: 0
log-info: true
log-progress: false
max-length: 500
maxi-batch: 100
mini-batch: 1
n-best: false
no-debpe: false
normalize: true
relative-paths: false
return-alignment: false
scorers:
  F0:
    path: model/model.npz.dev.npz
    type: Nematus
show-weights: false
softmax-filter:
  []
source-vocab: model/vocab.en.yml
target-vocab: model/vocab.id.yml
weights:
  F0: 1
wipo: false

[Sat May 6 20:24:30 2017] (I) Loading scorers...
[Sat May 6 20:24:30 2017] (I) Loading model model/model.npz.dev.npz
[Sat May 6 20:24:30 2017] (I) Reading from stdin
[Sat May 6 20:24:30 2017] (I) Setting CPU thread count to 4
[Sat May 6 20:24:30 2017] (I) Setting GPU thread count to 0
[Sat May 6 20:24:30 2017] (I) Total number of threads: 4
[Sat May 6 20:24:30 2017] (I) Reading input
[Sat May 6 20:24:53 2017] (I) Total time:  23.514136s wall, 92.290000s user + 0.060000s system = 92.350000s CPU (392.7%)

Results

GPU

$ head -n 5 dev.bpe.en.id.beam12.gpu
ada sebuah ap■ ar■ tem■ en me■ w■ ah karena melihat Con■ ch■ a B■ ay di San Sebastian di mana David Moyes hampir tinggal ■.
Danilo ■, yang menggantikan Willi■ am Car■ val■ ho melawan Wales ■, kuat dan e■ fi■ sien dalam peran lini tengah yang memegang ■, namun memiliki batas maju ■.
FIFA akan bertemu mit■ ra kom■ er■ sial ter■ kem■ uka bulan depan setelah tiga di antaranya meningkatkan tekanan untuk re■ formasi besar terhadap badan pemer■ in■ tahan sepak bola menyusul ser■ angkaian sk■ andal kor■ up■ si ■.
pertama ■, saat bermain untuk Ajax ia diberi larangan tujuh pertandingan karena men■ engg■ el■ amkan gi■ gi ke O■ t■ man Bak■ kal PSV ■.
Gu■ in■ ea ■, yang dipaksa untuk menjamu d■ asi mereka melawan N■ am■ i■ bia di Mar■ o■ ko karena larangan E■ bola ■, adalah korban 2 ■-■ 0 di Cas■ ab■ l■ anc■ a untuk juga maju dengan cara yang meyakinkan ■.

CPU

head -n 5 dev.bpe.en.id.beam12.cpu 
larangan ada Long there there there sports there there there there there there there there sports there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there there 20■ back David David David hay■
Danilo Morata me 71 Bastian melanjutkan Esteban Willi■ ame makan Samuel Bastian Vinales Esteban Boateng menghadapi Danilo normal digantikan Willi■ ho Willi■ sen lawan Ces■ aul melawan Wales gro■ raja Danilo Alvaro Boateng Car■ val■ ho menghadapi Mex■ ujan Danilo Pic masuk lawan Willi■ am Willi■ em Guar■ chez berhadapan iknya menghadapi Willi■ rique Marco Morata turun Danilo ■, Danilo turun melawan Danilo Mathieu Mathieu masuk Danilo Mathieu Mathieu Mathieu to membela Bastian zi saat turun un Mathieu turun Im■ dimainkan Ces■ ving jantung Mahrez Danilo Mathieu Mathieu Mathieu Mathieu Mathieu Mathieu Mathieu Mathieu Mathieu Mathieu
FIFA isl menit SEA Torabika entry ujan ujan mengecewakan mengikuti pemusatan badan Komite asian oping ujan mengikuti asian bad■ anj■ ait■ ban direction oping ujan vak■ BTN mengikuti Desmosedici pramusim mengantongi badan berikut negaranya water asian asian Commun■ ation Abdul Soccer three force three mengembangkan water fast force fast asian Games bulan hel■ nasional tiga libur mengikuti Desmosedici korban ujan rasi■ struk■ tivitas jantung apik angkat water fast Desmosedici vak■ konsist■ fast ujan vak■ pit jantung ujan terbukti ering menyusul ren■ dec■ tukan badan basket istan mengikuti pos■ mot■ retar■ istan formasi 78 2-3 99 bulan berselang mengikuti field double month bulan menyusul imb■ auan par■ star kets mencuri 72 mengikuti eu■ rise angkaian technical mengikuti ering mengikuti PON Torabika Golden asian RC213V vak■ istan mengikuti pelatnas ujan mengikuti
Jan ven Jan Bro■ ban well pergelangan kaki Maulana Toni ban Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Bro■ fol■ io chi Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni Toni
Gu■ in■ ea Angel■ tie memaksa Gu■ in■ ea Rey Hadi pertandingan cadangan Dom■ subs -2 hi■ ham Rodri■ vir■ bia Brun■ bia Aaron berarti gia Francesco Francesco Francesco Francesco Gu■ idol■ in Albion ikat gia Cla■ Cla■ gia Glas■ gia ampton Pre■ stu■ bia igi Oxlade burg ampton Walter Hamburg Gianluigi No■ ell■ ous ally Les api sejak Dou■ emo■ ski Mathieu Cre■ organi■ est ■); Mathieu dem■ akal Mathieu Mathieu Brun■ bia November bia Borussia Gu■ idol■ burg Borussia Dou■ emo■ bia hamstring Ronald Gu■ eye can Gu■ idol■ erang games sburg euro ala Au■ ize italian gia Chamberlain dipaksa break FC ston inter■ wan■ sico mark hon■ gia gia gia agre■ atri■ gia Rodri■ gia demonstr■ guay Lucas CS saat Mathieu nor■ gia Dou■ eko gia j UE■ engladbach UE■ Gu■ aut■ one Gu■ in■ ea burg Verona mendorong Gu■ idol■

Reference

$ head -n 5 dev.bpe.id
ada sebuah ap■ ar■ tem■ en me■ w■ ah yang menghad■ ap ke Tel■ uk Con■ ch■ a di San Sebastian tempat David Moyes hampir tinggal ■.
Danilo ■, yang menggantikan Willi■ am Car■ val■ ho melawan Wales ■, kuat dan e■ fi■ sien dalam peran lini tengah ■, namun memiliki bat■ asan untuk maju ■.
FIFA akan bertemu dengan mit■ ra kom■ er■ sial ter■ kem■ uka bulan depan setelah tiga dari mereka meningkatkan tekanan untuk re■ formasi besar terhadap badan sepak bola setelah ser■ angkaian sk■ andal kor■ up■ si ■.
pertama ■, saat bermain untuk Ajax ■, dia diberi larangan tujuh game karena men■ engg■ el■ amkan gi■ g■ inya ke PSV O■ t■ man Bak■ kal ■.
Gu■ in■ ea ■, yang terpaksa menjadi tuan rumah pertandingan melawan N■ am■ i■ bia di Mar■ o■ ko karena larangan E■ bola ■, adalah pemenang 2 ■-■ 0 di Cas■ ab■ l■ anc■ a yang juga maju dengan cara yang meyakinkan ■.
tomekd commented 7 years ago

Do you use layer normalisation in your model?

tomekd commented 7 years ago

If you use the same model as you put in @63, you are. I implemented Layer Normalization but it's still in a different branch.

geovedi commented 7 years ago

yes, it's the same model. what branch are you referring to?

tomekd commented 7 years ago

OK. I've planned to merge th branch today, but I don't know how much time I need to repair the segfault on GPU.

geovedi commented 7 years ago

@tomekd so i did train a new model without --layer-normalization option; i can confirm the translation with CPU works.

geovedi commented 7 years ago

i close this as it is a duplicate to #52

tomekd commented 7 years ago

@geovedi : I've just fixed that.