Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError in parsing using genia #118

Open
blackbirt-5 opened this issue Jul 1, 2021 · 1 comment
Open

ValueError in parsing using genia #118

blackbirt-5 opened this issue Jul 1, 2021 · 1 comment

Comments

@blackbirt-5
Copy link

Hi,

I am interested in the parsing field of nlp and am studying sciBERT. In parsing using genia, ValueError was raised as shown in the attached file.
How can I solve this?

Many thanks!

ps) Other TASKs run fine.

2021-07-01 12:51:39,366 - INFO - allennlp.training.trainer - Training
0%| | 1/896 [00:04<1:00:43, 4.07s/it]
Traceback (most recent call last):
File "/home/centos/miniconda3/envs/test_38/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/centos/miniconda3/envs/test_38/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/centos/ML/src/allennlp/allennlp/run.py", line 21, in
run()
File "/home/centos/ML/src/allennlp/allennlp/run.py", line 18, in run
main(prog="allennlp")
File "/home/centos/ML/src/allennlp/allennlp/commands/init.py", line 102, in main
args.func(args)
File "/home/centos/ML/src/allennlp/allennlp/commands/train.py", line 117, in train_model_from_args
train_model_from_file(args.param_path,
File "/home/centos/ML/src/allennlp/allennlp/commands/train.py", line 163, in train_model_from_file
return train_model(params,
File "/home/centos/ML/src/allennlp/allennlp/commands/train.py", line 252, in train_model
metrics = trainer.train()
File "/home/centos/ML/src/allennlp/allennlp/training/trainer.py", line 539, in train
train_metrics = self._train_epoch(epoch)
File "/home/centos/ML/src/allennlp/allennlp/training/trainer.py", line 372, in _train_epoch
raise ValueError("nan loss encountered")
ValueError: nan loss encountered

error

@fan-hd
Copy link

fan-hd commented Oct 31, 2021

Hi,

I am interested in the parsing field of nlp and am studying sciBERT. In parsing using genia, ValueError was raised as shown in the attached file. How can I solve this?

Many thanks!

ps) Other TASKs run fine.

2021-07-01 12:51:39,366 - INFO - allennlp.training.trainer - Training 0%| | 1/896 [00:04<1:00:43, 4.07s/it] Traceback (most recent call last): File "/home/centos/miniconda3/envs/test_38/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/centos/miniconda3/envs/test_38/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/centos/ML/src/allennlp/allennlp/run.py", line 21, in run() File "/home/centos/ML/src/allennlp/allennlp/run.py", line 18, in run main(prog="allennlp") File "/home/centos/ML/src/allennlp/allennlp/commands/init.py", line 102, in main args.func(args) File "/home/centos/ML/src/allennlp/allennlp/commands/train.py", line 117, in train_model_from_args train_model_from_file(args.param_path, File "/home/centos/ML/src/allennlp/allennlp/commands/train.py", line 163, in train_model_from_file return train_model(params, File "/home/centos/ML/src/allennlp/allennlp/commands/train.py", line 252, in train_model metrics = trainer.train() File "/home/centos/ML/src/allennlp/allennlp/training/trainer.py", line 539, in train train_metrics = self._train_epoch(epoch) File "/home/centos/ML/src/allennlp/allennlp/training/trainer.py", line 372, in _train_epoch raise ValueError("nan loss encountered") ValueError: nan loss encountered

error

This occurs me too.
For me, this ERROR is caused by the implementation of masked_log_softmax defined in allennlp.nn.
The eps=1e-45 is still too small to avoid nans.
You can use a bigger eps; eps=1e-37 does work on my machine.
Or use an implementation from higher version of allennlp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants