मैं प्रति पंक्ति एक वाक्य के साथ लगभग 170K लाइनों वाली फ़ाइल का उपयोग करके एक word2vec मॉडल को प्रशिक्षित करने की कोशिश कर रहा हूं।1002 वाक्यों के बाद gensim का उपयोग करके Word2vec प्रशिक्षण स्वैपिंग शुरू होता है
मुझे लगता है कि मैं एक विशेष उपयोग केस का प्रतिनिधित्व कर सकता हूं क्योंकि "वाक्यों" शब्दकोष शब्दों के बजाय मनमाने ढंग से तार हैं। प्रत्येक वाक्य (रेखा) में लगभग 100 शब्द होते हैं और प्रत्येक "शब्द" में लगभग 20 वर्ण होते हैं, जैसे "/"
और संख्याओं के साथ।
प्रशिक्षण कोड बहुत सरल है:
# as shown in http://rare-technologies.com/word2vec-tutorial/
import gensim, logging, os
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
class MySentences(object):
def __init__(self, dirname):
self.dirname = dirname
def __iter__(self):
for fname in os.listdir(self.dirname):
for line in open(os.path.join(self.dirname, fname)):
yield line.split()
current_dir = os.path.dirname(os.path.realpath(__file__))
# each line represents a full chess match
input_dir = current_dir+"/../fen_output"
output_file = current_dir+"/../learned_vectors/output.model.bin"
sentences = MySentences(input_dir)
model = gensim.models.Word2Vec(sentences,workers=8)
बात है, चीजों को जल्दी ऊपर 100K वाक्य (मेरी रैम तेजी से ऊपर जा रहा है), लेकिन फिर मैं रैम से बाहर चलाने के लिए और मैं देख सकता हूँ मेरे पीसी है करने के लिए वास्तविक काम स्वैपिंग शुरू कर दी, और प्रशिक्षण रोक दिया गया। मेरे पास बहुत सी रैम उपलब्ध नहीं है, केवल 4 जीबी और word2vec
स्वैप करना शुरू करने से पहले इसका उपयोग करता है।
मुझे लगता है कि मैं सही ढंग से OpenBLAS numpy से जुड़ा हुआ है:
blas_info:
libraries = ['blas']
library_dirs = ['/usr/lib']
language = f77
lapack_info:
libraries = ['lapack']
library_dirs = ['/usr/lib']
language = f77
atlas_threads_info:
NOT AVAILABLE
blas_opt_info:
libraries = ['openblas']
library_dirs = ['/usr/lib']
language = f77
openblas_info:
libraries = ['openblas']
library_dirs = ['/usr/lib']
language = f77
lapack_opt_info:
libraries = ['lapack', 'blas']
library_dirs = ['/usr/lib']
language = f77
define_macros = [('NO_ATLAS_INFO', 1)]
openblas_lapack_info:
NOT AVAILABLE
lapack_mkl_info:
NOT AVAILABLE
atlas_3_10_threads_info:
NOT AVAILABLE
atlas_info:
NOT AVAILABLE
atlas_3_10_info:
NOT AVAILABLE
blas_mkl_info:
NOT AVAILABLE
mkl_info:
NOT AVAILABLE
मेरा प्रश्न है: इस एक मशीन है कि उपलब्ध रैम का एक बहुत (नहीं मिला है पर उम्मीद है कि इसका क्या numpy.show_config()
मुझसे कहता है मेरी तरह) और मुझे मॉडल को छोटे टुकड़ों में अधिक रैम या ट्रेन करना चाहिए? या ऐसा लगता है कि मेरा सेटअप ठीक से कॉन्फ़िगर नहीं किया गया है (या मेरा कोड अक्षम है)?
अग्रिम धन्यवाद।