Comments (7)
Sometimes the embeddings cannot read the saved tokenizer correctly. I add some lines in train.py
to fix this issue.
from ace.
Still have error using the updated train.py. Here is the error message:
[2022-07-29 21:50:39,054 INFO] loading file https://s3.amazonaws.com/models.huggingface.co/bert/xlnet-large-cased-spiece.model from cache at C:\Users\ebb/.cache\torch\transformers\5b125ba222ff82664771f63cd8fac9696c24b403fc1ab720d537fe2ceaaf0576.8b10bd978b5d01c21303cc761fc9ecd464419b3bf921864a355ba807cfbfafa8
Traceback (most recent call last):
File ".\train.py", line 206, in <module>
embedding.add_special_tokens
File "C:\Users\ebb\.conda\envs\ace_py37\lib\site-packages\torch\nn\modules\module.py", line 585, in __getattr__
type(self).__name__, name))
AttributeError: 'TransformerWordEmbeddings' object has no attribute 'add_special_tokens'
I had if '/' in name: name = name.split('/')[-1]
, otherwise I have the error in issue #42
from ace.
Oops, this line is not needed in the code, fixed it.
from ace.
Another error:
2022-08-01 17:33:40,842 Reading data from datasets\mytest
2022-08-01 17:33:40,843 Train: datasets\mytest\doc_train.txt
2022-08-01 17:33:40,844 Dev: None
2022-08-01 17:33:40,844 Test: None
Traceback (most recent call last):
File ".\train.py", line 368, in <module>
train_eval_result, train_loss = student.evaluate(loader,out_path=Path('outputs/train.'+config.config['model_name']+'.'+tar_file_name+'.conllu'),embeddings_storage_mode="none",prediction_mode=True)
File "C:\Users\ebb\ACE\flair\models\sequence_tagger_model.py", line 2212, in evaluate
features = self.forward(batch,prediction_mode=prediction_mode)
File "C:\Users\ebb\ACE\flair\models\sequence_tagger_model.py", line 818, in forward
self.embeddings.embed(sentences,embedding_mask=self.selection)
File "C:\Users\ebb\ACE\flair\embeddings.py", line 184, in embed
embedding.embed(sentences)
File "C:\Users\ebb\ACE\flair\embeddings.py", line 97, in embed
self._add_embeddings_internal(sentences)
File "C:\Users\ebb\ACE\flair\embeddings.py", line 2943, in _add_embeddings_internal
self.add_document_embeddings_v2(sentences, max_sequence_length = model_max_length, batch_size = 32 if not hasattr(self,'doc_batch_size') else self.doc_batch_size)
File "C:\Users\ebb\ACE\flair\embeddings.py", line 3570, in add_document_embeddings_v2
for doc_pos, doc_sent in enumerate(sentence.doc):
AttributeError: 'Sentence' object has no attribute 'doc'
EDIT (debug info): self.name='/home/yongjiang.jy/.flair/embeddings/en-xlmr-first-docv2_10epoch_1batch_4accumulate_0.000005lr_10000lrrate_eng_monolingual_nocrf_fast_norelearn_sentbatch_sentloss_finetune_nodev_saving_ner5/roberta-large' and sentence.batch_pos={}, thus runs the else branch and sentence=
Sentence: "-DOCSTART-" - 1 Tokens, has no doc attribute.
from ace.
I didn't consider the scenario for document-level ACE for prediction. I add some tricks in train.py
to fix it, you may try it. Moreover, you can also change the test file in the conll 03 dataset to your own testing file (doc_train.txt
) and use the --test
command for prediction. Note: --test
command works if you want to predict only thousands of sentences. If you want to predict millions of sentences, I still suggest using --parse
command since it is more CPU memory friendly.
from ace.
Sorry, I still have the same error as before AttributeError: 'Sentence' object has no attribute 'doc'
. See the debug info in the previous post.
from ace.
Using the latest code and running python .\train.py --config .\config\doc_ner_best.yaml --batch_size 1 --parse --target_dir .\datasets\mytest --keep_order
on Windows 10, Python 3.7, no GPU, I have another error:
Setting embedding mask to the best action: tensor([1., 1., 0., 1., 0., 0., 1., 0., 0., 1., 1., 1.])
2022-08-19 10:56:10,298 Reading data from datasets\mytest
2022-08-19 10:56:10,298 Train: datasets\mytest\doc_train.txt
2022-08-19 10:56:10,298 Dev: None
2022-08-19 10:56:10,299 Test: None
Traceback (most recent call last):
File ".\train.py", line 379, in <module>
corpus_data = trainer.assign_corpus(corpus = corpus.train, set_name= args.set_name, corpus_name = args.corpus_name, train_with_doc = True, pretrained_file_dict = config.config['ReinforcementTrainer']['pretrained_file_dict'])
File "C:\Users\ACE\flair\trainers\reinforcement_trainer.py", line 1402, in assign_corpus
corpus.reset_sentence_count
AttributeError: 'Subset' object has no attribute 'reset_sentence_count
from ace.
Related Issues (20)
- Requirements.txt versions HOT 3
- Confuse about the SDP dataset HOT 2
- Is GPU required? HOT 4
- Test result comparison without vs with document-level features HOT 18
- Embeddings Availability HOT 3
- Testing on my own data file HOT 1
- Using your best model for inference for NER in production HOT 4
- Missing B-ORG but with I-ORG and E-ORG HOT 2
- Test PTB Dependency Parsing Model HOT 9
- How to apply ACE model as a parser tool for DM parsing? HOT 3
- Change the directory of downloading HOT 1
- How many embeds are connected? HOT 4
- ERROR: No matching distribution found for nltk==7.1.2 HOT 3
- bdb.BdbQuit error while training conll 2003 HOT 1
- Error when loading custom dataset HOT 5
- Memory requirements for a new model HOT 3
- Segmentation Fault (core dumped) HOT 3
- Install fails all python versions tested 3.6 3.7 3.8 3.9 3.10 3.11. Repo Unusable.
- can you share the weight for semantic dependency parsing?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ace.