You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to load 840B+300d GloVe using mz.embedding.load_from_file. However, it utilizes more than 60+ GB memory, which looks abnormal.
frompathlibimportPathimportmatchzooasmz_glove_6B_embedding_url="http://nlp.stanford.edu/data/glove.6B.zip"_glove_840B_embedding_url="http://nlp.stanford.edu/data/glove.840B.300d.zip"defload_glove_embedding(dimension: int=50, size="6B") ->mz.embedding.Embedding:
""" Return the pretrained glove embedding. :param dimension: the size of embedding dimension, the value can only be 50, 100, or 300. :return: The :class:`mz.embedding.Embedding` object. """file_name='glove.{}.{}d.txt'.format(size, dimension)
file_path= (Path(mz.USER_DATA_DIR) /'glove').joinpath(file_name)
ifnotfile_path.exists():
ifsize=="6B":
url=_glove_6B_embedding_urlelifsize=="840B":
url=_glove_840B_embedding_urlelse:
raiseValueError("Incorrect Size for GloVe: %d"%size)
mz.utils.get_file('glove_embedding',
url,
extract=True,
cache_dir=mz.USER_DATA_DIR,
cache_subdir='glove')
returnmz.embedding.load_from_file(file_path=str(file_path), mode='glove')
embedding=load_glove_embedding(300, "840B")
Describe your attempts
The TF version matchzoo uses pandas to read the GloVe file, and requires much less memory.
The text was updated successfully, but these errors were encountered:
Describe the Question
I tried to load 840B+300d GloVe using
mz.embedding.load_from_file
. However, it utilizes more than 60+ GB memory, which looks abnormal.Describe your attempts
The TF version matchzoo uses pandas to read the GloVe file, and requires much less memory.
The text was updated successfully, but these errors were encountered: