Giter Club home page Giter Club logo

Comments (4)

padeoe avatar padeoe commented on September 16, 2024

It was the bug of OpenCLaP BERT models. I opened an issue at their github repo 4 months ago, but they didn't fix it. You may see the warning when you save the models:

2019-11-05 16:06:53 - train model - INFO - Epoch 2, train Loss: 475.4495771, eval acc: 0.8539215686274509, eval loss: 286.7390137
Saving vocabulary to model/vocab.txt: vocabulary indices are not consecutive. Please check that the vocabulary is not corrupted!

It's caused by some white space lines in vocab.txt, my code will load the vocab.txt with no problem, but when I save it to the final model, the vocabulary indexes are broken which leads to bad performance.

You can fix it by copy the original vocab.txt to your final model:

cp OpenCLaP/vocab.txt model/vocab.txt

from cail2019.

bruce1408 avatar bruce1408 commented on September 16, 2024

I use already learned 民事文书BERT as my pretrained model downloaded from https://github.com/thunlp/OpenCLaP
And I set fp16=False
I train the model with your code. The training is good.
I copy some information from the train.log
image
But it turns out the acc of the prediction is 0.53 as I run the main.py and judger.py
Does the saving model has some problems?

I have also met the problem that you mentioned, do you solve this ?

from cail2019.

bruce1408 avatar bruce1408 commented on September 16, 2024

It was the bug of OpenCLaP BERT models. I opened an issue at their github repo 4 months ago, but they didn't fix it. You may see the warning when you save the models:

2019-11-05 16:06:53 - train model - INFO - Epoch 2, train Loss: 475.4495771, eval acc: 0.8539215686274509, eval loss: 286.7390137
Saving vocabulary to model/vocab.txt: vocabulary indices are not consecutive. Please check that the vocabulary is not corrupted!

It's caused by some white space lines in vocab.txt, my code will load the vocab.txt with no problem, but when I save it to the final model, the vocabulary indexes are broken which leads to bad performance.

You can fix it by copy the original vocab.txt to your final model:

cp OpenCLaP/vocab.txt model/vocab.txt

It was the bug of OpenCLaP BERT models. I opened an issue at their github repo 4 months ago, but they didn't fix it. You may see the warning when you save the models:

2019-11-05 16:06:53 - train model - INFO - Epoch 2, train Loss: 475.4495771, eval acc: 0.8539215686274509, eval loss: 286.7390137
Saving vocabulary to model/vocab.txt: vocabulary indices are not consecutive. Please check that the vocabulary is not corrupted!

It's caused by some white space lines in vocab.txt, my code will load the vocab.txt with no problem, but when I save it to the final model, the vocabulary indexes are broken which leads to bad performance.

You can fix it by copy the original vocab.txt to your final model:

cp OpenCLaP/vocab.txt model/vocab.txt

Can you provide a complete vocab.txt file ? thx!

from cail2019.

padeoe avatar padeoe commented on September 16, 2024

Just use the original vocab.txt in the pretrained models. Copy it into output model directory.

from cail2019.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.