yzhangcs / parser

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

Global variable access Exception in data utils #135

Closed yochail closed 5 months ago

yochail commented 7 months ago

Environment: OS Name: Microsoft Windows 11 Enterprise Version 10.0.22621 Build 22621 Python: 3.9.18 Conda: 23.5.2 Supar: latest (installed from GitHub) Torch 2.1.1 see full env packages: requirements.txt

running code from readme:

>>> from supar import Parser
>>> con = Parser.load('con-crf-en')
>>> con.predict(['I', 'saw', 'Sarah', 'with', 'a', 'telescope', '.'], verbose=False)[0].pretty_print()

return the exception:

multiprocess.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "C:\Users\yolehman\AppData\Local\miniconda3\envs\SuparTest\lib\site-packages\multiprocess\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "C:\Users\yolehman\work\dev\OpenSource\parser\supar\utils\data.py", line 177, in numericalize
    sentences = global_transform((debinarize(fs, sentence) for sentence in sentences))
NameError: name 'global_transform' is not defined
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\yolehman\work\dev\OpenSource\parser\supar\models\const\crf\parser.py", line 89, in predict
    return super().predict(**Config().update(locals()))
  File "C:\Users\yolehman\work\dev\OpenSource\parser\supar\parser.py", line 409, in predict
    data.build(batch_size=batch_size,
  File "C:\Users\yolehman\work\dev\OpenSource\parser\supar\utils\data.py", line 186, in build
    self.sentences = binarize((r.get() for r in results), fbin, merge=True)[1]['sentences']
  File "C:\Users\yolehman\work\dev\OpenSource\parser\supar\utils\fn.py", line 252, in binarize
    for file in data:
  File "C:\Users\yolehman\work\dev\OpenSource\parser\supar\utils\data.py", line 186, in <genexpr>
    self.sentences = binarize((r.get() for r in results), fbin, merge=True)[1]['sentences']
  File "C:\Users\yolehman\AppData\Local\miniconda3\envs\SuparTest\lib\site-packages\multiprocess\pool.py", line 771, in get
    raise self._value
NameError: name 'global_transform' is not defined
yzhangcs commented 7 months ago

@yochail Hi, sorry for my late reply. But I can not reproduce this bug on my Linux machine, could you give me more details on your envs?

Hairmore commented 7 months ago

we have the same problem and i'm also under windows env. Maybe it's because of the env

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 5 months ago

This issue was closed because it has been inactive for 7 days since being marked as stale.