allenai / kb

KnowBert -- Knowledge Enhanced Contextual Word Representations
Apache License 2.0
371 stars 50 forks source link

Fine tuning KnowBert for downstream tasks #25

Open xuuuluuu opened 4 years ago

xuuuluuu commented 4 years ago

Hi, I am trying to run the below code for fine-tuning KnowBert for Tcred dataset:

allennlp train --file-friendly-logging --include-package kb.include_all \ training_config/downstream/tacred.jsonnet -s OUTPUT_DIRECTORY

I met several errors, I was able to resolve some of them. But not sure how to deal with the below error:

Traceback (most recent call last): File "/home/xu_lu/.local/bin/allennlp", line 10, in sys.exit(run()) File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/run.py", line 18, in run main(prog="allennlp") File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/commands/init.py", line 102, in main args.func(args) File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/commands/train.py", line 116, in train_model_from_args args.cache_prefix) File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/commands/train.py", line 160, in train_model_from_file cache_directory, cache_prefix) File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/commands/train.py", line 226, in train_model validation_iterator=pieces.validation_iterator) File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/training/trainer.py", line 725, in from_params params.assert_empty(cls.name) File "/home/xu_lu/.local/lib/python3.7/site-packages/allennlp/common/params.py", line 405, in assert_empty raise ConfigurationError("Extra parameters passed to {}: {}".format(class_name, self.params)) allennlp.common.checks.ConfigurationError: "Extra parameters passed to Trainer: {'gradient_accumulation_batch_size': 32}" 2020-08-20 15:59:20,126 - INFO - allennlp.models.archival - removing temporary unarchived model dir at /tmp/tmprz5qhl43

My current environment has passed the tests and I am able to run the example to embed the sentences.

matt-peters commented 4 years ago

I think this might be the installed version of allennlp - can you check that this branch is installed? git+git://github.com/matt-peters/allennlp.git@2d7ba1cb108428aaffe2dce875648253b44cb5ba

Try

pip uninstall allennlp
pip install git+git://github.com/matt-peters/allennlp.git@2d7ba1cb108428aaffe2dce875648253b44cb5ba
xhay-p commented 3 years ago

I am also facing a similar issue, on trying the above-mentioned solution, I got,

Could not find a tag or branch '2d7ba1cb108428aaffe2dce875648253b44cb5ba', assuming commit.