xlang-ai / UnifiedSKG

[EMNLP 2022] Unifying and multi-tasking structured knowledge grounding with language models
https://arxiv.org/abs/2201.05966
Apache License 2.0
549 stars 58 forks source link

The saved model folder do not contain config.json. #22

Closed eyuansu62 closed 2 years ago

eyuansu62 commented 2 years ago

When I try to eval the model using my saved checkpoint, it points to "'t5-model' is the correct path to a directory containing a config.json file". I realize the saved model folder does not contain config.json. How can I figure it out?

Timothyxxx commented 2 years ago

Hi,

I'm confused... Could you explain more about what exactly did you do and what causes the error exactly?

Hope we can help! Thanks

eyuansu62 commented 2 years ago

在我训好一个模型以后,我发现保存的checkpoint文件夹里并没有config.json这个文件。 因此我想用我保存的ckpt去eval模型的时候,就会报错找不过config.json这个文件。报错如下:


OSError: Can't load config for 't5-model'. Make sure that:                                                                                                                                            

- 't5-model' is a correct model identifier listed on 'https://huggingface.co/models'                                                                                                                  

- or 't5-model' is the correct path to a directory containing a config.json file 
- ```
ChenWu98 commented 2 years ago

Hi,

I think the answer to this question can be useful for a broader audience, so forgive me for replying in English.

In general, there are two ways to test a pretrained model.

  1. The first one is quite general: you can 1) initialize the model in the same way as training and then 2) load the pretrained weights as is done here: https://github.com/HKUNLP/UnifiedSKG/blob/7a2de6d31bfd5d69a4d71bd8f6ce92bf2b8d7a3b/train.py#L149

  2. The second one is a little bit hack: you can use the same command as training while removing the --overwrite_output_dir flag and setting --num_train_epochs 0. It works because it will load the previous best checkpoint but not continue training.

Further questions are welcome!

eyuansu62 commented 2 years ago

It works! Thanks!! :)

Timothyxxx commented 2 years ago

You're welcome, contact us if you have further problem!🥰