Giter Club home page Giter Club logo

Comments (8)

markus-eberts avatar markus-eberts commented on July 28, 2024 1

Hi ZengYoufeng,
the corresponding vocabulary file is already included for the models we trained on the CoNLL04, ADE and SciERC datasets (under "./data/models" after executing "./scripts/fetch_models.sh"). If you want to train a model from-scratch, you should have a look at the "transformers" (https://github.com/huggingface/transformers) library we are using. You can either specify one of the pre-trained BERT models included in "transformers" as both the "model_path" and "tokenizer_path" (e.g. "bert-base-cased" as in "configs/example_train.conf") or point "model_path" and "tokenizer_path" to a directory that contains model weights or a vocabulary file respectively.

from spert.

markus-eberts avatar markus-eberts commented on July 28, 2024 1

Did you train your own model on the self-built dataset or where is 'pytorch_model.bin' from? You should use the same 'vocab.txt' file that was used while training 'pytorch_model.bin'.

from spert.

markus-eberts avatar markus-eberts commented on July 28, 2024 1

You should use the same 'vocab.txt' file that was used during training. In your case, this is probably the one located in 'data/models/conll04'. So just set 'tokenizer_path' in 'example_eval.conf' to point to 'data/models/conll04'. This is not a vocabulary file specifically created for the CoNLL04 dataset, but the rather generic 'bert-base-cased' vocabulary (see the transformers library documentation).

from spert.

 avatar commented on July 28, 2024 1

Did you train your own model on the self-built dataset or where is 'pytorch_model.bin' from? You should use the same 'vocab.txt' file that was used while training 'pytorch_model.bin'.

I have trained my own model on the self-built dataset on the same training settings of the CoNLL04 dataset. Then, I got three files, 'pytorch_model.bin', 'config.json' and 'extra.state', respectively. However, I can't find the file 'vocab.txt'. Therefore, I cannot execute the command 'python ./spert.py eval --config configs/example_eval.conf'. I want to know how to get the file 'vocab.txt' that fits self-built dataset.

Please refer to the use of huggingface/transformers!!!!!!

from spert.

ZengYoufeng avatar ZengYoufeng commented on July 28, 2024

Hi ZengYoufeng,
the corresponding vocabulary file is already included for the models we trained on the CoNLL04, ADE and SciERC datasets (under "./data/models" after executing "./scripts/fetch_models.sh"). If you want to train a model from-scratch, you should have a look at the "transformers" (https://github.com/huggingface/transformers) library we are using. You can either specify one of the pre-trained BERT models included in "transformers" as both the "model_path" and "tokenizer_path" (e.g. "bert-base-cased" as in "configs/example_train.conf") or point "model_path" and "tokenizer_path" to a directory that contains model weights or a vocabulary file respectively.

Thanks for your answer, I have got the trained model 'pytorch_model.bin' with self-built dataset, but I cannot execute the command 'python ./spert.py eval --config configs/example_eval.conf' successfully due to the lack of the file 'vocab.txt'. Now I want to know how to generate a vocabulary file that fits self-built dataset for evaluation. Hope you can give me some detailed guidance, I will be grateful!

from spert.

ZengYoufeng avatar ZengYoufeng commented on July 28, 2024

Did you train your own model on the self-built dataset or where is 'pytorch_model.bin' from? You should use the same 'vocab.txt' file that was used while training 'pytorch_model.bin'.

I have trained my own model on the self-built dataset on the same training settings of the CoNLL04 dataset. Then, I got three files, 'pytorch_model.bin', 'config.json' and 'extra.state', respectively. However, I can't find the file 'vocab.txt'. Therefore, I cannot execute the command 'python ./spert.py eval --config configs/example_eval.conf'. I want to know how to get the file 'vocab.txt' that fits self-built dataset.

from spert.

ZengYoufeng avatar ZengYoufeng commented on July 28, 2024

I understand that the file 'vocab.txt' is related to the language representation model, not to the dataset. I observed that the vocabulary files corresponding to the three datasets were different, so I misunderstood that the vocabulary file corresponds to the dataset and was generated by it. I'm so sorry for the misunderstanding and thank you very much for your kind help.

from spert.

markus-eberts avatar markus-eberts commented on July 28, 2024

No need to be sorry, I'm glad I could help you. The vocabulary files differ because we used SciBERT, which is accompanied by its own vocabulary, instead of BERT-Base-Cased for the SciERC dataset. The ADE and CoNLL04 models were trained using the same BERT-Base-Cased vocabulary.

from spert.

Related Issues (20)

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.