2015-04-25 6 views
5

Moses मशीन अनुवाद मॉडल बनाने के लिए एक सॉफ्टवेयर है। और KenLM डिफैक्टो भाषा मॉडल सॉफ़्टवेयर है जो उपयोग करता है।विशाल भाषा मॉडल के साथ मशीन अनुवाद मॉडल को कैसे ट्यून करें?

मैं पाठ के 16GB के साथ एक textfile है और मैं इसे इस तरह के रूप में एक भाषा मॉडल बनाने के लिए उपयोग करें:

bin/lmplz -o 5 <text > text.arpa 

परिणामी फ़ाइल (text.arpa) 38GB है। binarized भाषा मॉडल (text.binary) 71GB करने के लिए बढ़ता है

bin/build_binary text.arpa text.binary 

और: तो मैं जैसे भाषा मॉडल binarized।

moses में, अनुवाद मॉडल को प्रशिक्षण देने के बाद, आपको MERT एल्गोरिदम का उपयोग करके मॉडल के वजन को ट्यून करना चाहिए। और यह आसानी से https://github.com/moses-smt/mosesdecoder/blob/master/scripts/training/mert-moses.pl के साथ किया जा सकता है।

एमईआरटी छोटे भाषा मॉडल के साथ ठीक काम करता है लेकिन बड़े भाषा मॉडल के साथ, इसे समाप्त होने में काफी दिन लगते हैं।

मैं एक गूगल खोज किया था और KenLM के फिल्टर है, जो एक छोटे आकार के लिए भाषा मॉडल फिल्टर करने के लिए वादा किया पाया: https://kheafield.com/code/kenlm/filter/

लेकिन मैं यह कैसे काम करने के लिए के रूप में पता कर रहा हूँ। आदेश मदद देता है:

$ ~/moses/bin/filter 
Usage: /home/alvas/moses/bin/filter mode [context] [phrase] [raw|arpa] [threads:m] [batch_size:m] (vocab|model):input_file output_file 

copy mode just copies, but makes the format nicer for e.g. irstlm's broken 
    parser. 
single mode treats the entire input as a single sentence. 
multiple mode filters to multiple sentences in parallel. Each sentence is on 
    a separate line. A separate file is created for each sentence by appending 
    the 0-indexed line number to the output file name. 
union mode produces one filtered model that is the union of models created by 
    multiple mode. 

context means only the context (all but last word) has to pass the filter, but 
    the entire n-gram is output. 

phrase means that the vocabulary is actually tab-delimited phrases and that the 
    phrases can generate the n-gram when assembled in arbitrary order and 
    clipped. Currently works with multiple or union mode. 

The file format is set by [raw|arpa] with default arpa: 
raw means space-separated tokens, optionally followed by a tab and arbitrary 
    text. This is useful for ngram count files. 
arpa means the ARPA file format for n-gram language models. 

threads:m sets m threads (default: conccurrency detected by boost) 
batch_size:m sets the batch size for threading. Expect memory usage from this 
    of 2*threads*batch_size n-grams. 

There are two inputs: vocabulary and model. Either may be given as a file 
    while the other is on stdin. Specify the type given as a file using 
    vocab: or model: before the file name. 

For ARPA format, the output must be seekable. For raw format, it can be a 
    stream i.e. /dev/stdout 

लेकिन जब मैं निम्नलिखित की कोशिश की, यह अटक और करता हो जाता है कुछ भी नहीं:

$ ~/moses/bin/filter union lm.en.binary lm.filter.binary 
Assuming that lm.en.binary is a model file 
Reading lm.en.binary 
----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100 

एक binarization के बाद भाषा मॉडल के लिए क्या करना चाहिए? ट्यूनिंग करते समय कंप्यूटिंग लोड को कम करने के लिए बड़े भाषा मॉडल में हेरफेर करने के लिए कोई अन्य कदम है?

बड़ी एलएम फ़ाइल पर ट्यून करने का सामान्य तरीका क्या है?

केनएलएम के फ़िल्टर का उपयोग कैसे करें?

(https://www.mail-archive.com/[email protected]/msg12089.html बारे में अधिक जानकारी)

+0

क्या आप वाकई भाषा मॉडल हैं जो एमईआरटी को धीमा कर देता है? मैं एसएमटी के लिए काफी नया हूं, लेकिन किसी कारण से मैं अनुवाद मॉडल के आकार को और अधिक समस्याग्रस्त होने की उम्मीद करूंगा। और इसे 'प्रशिक्षण/फ़िल्टर-मॉडल-दिए गए इनपुट.पीएल' के साथ तय किया जा सकता है। – scozy

+0

हां, यह एक बड़ा भाषा मॉडल है जो एमईआरटी धीमा कर देता है। मैंने एलएम के विभिन्न आकारों के साथ प्रयास किया है। – alvas

उत्तर

0

कैसे की KenLM

cat small_vocabulary_one_word_per_line.txt \ 
    | filter single \ 
     "model:LM_large_vocab.arpa" \ 
      output_LM_small_vocab. 

नोट filter आदेश का उपयोग करने के लिए उत्तर देना: कि singleunion या copy के साथ बदलें जा सकता है। यदि आप बिना तर्क के filter बाइनरी चलाते हैं तो प्रिंटिंग की सहायता में और पढ़ें।

संबंधित मुद्दे