yzhangcs / parser

:rocket: State-of-the-art parsers for natural language.
https://parser.yzhang.site/
MIT License
827 stars 139 forks source link

MemoryError while using fasttext embeddings #56

Closed zeeshansayyed closed 3 years ago

zeeshansayyed commented 3 years ago

I was trying to use biaffine_dependency.py with 300 dimensional fastText embeddings. I get the following traceback


2021-01-02 04:28:36 INFO Building the fields
Traceback (most recent call last):
  File "~supar/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "~/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "~/supar/cmds/biaffine_dependency.py", line 46, in <module>
    main()
  File "~/supar/cmds/biaffine_dependency.py", line 42, in main
    parse(parser)
  File "~/supar/cmds/cmd.py", line 54, in parse
    parser = Parser.build(**args)
  File "~/supar/parsers/dependency.py", line 270, in build
    WORD.build(train, args.min_freq, (Embedding.load(args.embed, args.unk) if args.embed else None))
  File "~/supar/utils/embedding.py", line 36, in load
    tokens, vectors = zip(*[(s[0], list(map(float, s[1:])))
  File "~/supar/utils/embedding.py", line 36, in <listcomp>
    tokens, vectors = zip(*[(s[0], list(map(float, s[1:])))
MemoryError```

I have tried to reduce the batch-size too. And I am sure that the machine I am using has a lot of memory, so that's not a problem either. Any help would be appreciated.
yzhangcs commented 3 years ago

@zeeshansayyed Please refer to this issue: https://github.com/yzhangcs/parser/issues/36#issuecomment-668644846.

zeeshansayyed commented 3 years ago

Thanks. Much appreciated.