-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format of input gold_label_dictionary for dependency parser #2575
Comments
@Tarotis can you post your training script? |
Some outputs from training:
Detailed error:
|
Can you try using this corpus instead: corpus = UD_ENGLISH()
dictionary = corpus.make_label_dictionary("dependency") Does it work then? |
No, I receive the same error as with my own data. |
I just tested this script on current master branch and it runs: from flair.datasets import UD_ENGLISH
from flair.embeddings import StackedEmbeddings, FlairEmbeddings
from flair.models import DependencyParser
from flair.trainers import ModelTrainer
corpus = UD_ENGLISH()
dependency_dictionary = corpus.make_label_dictionary("dependency")
embeddings = StackedEmbeddings(embeddings=[FlairEmbeddings('news-forward-fast'),
FlairEmbeddings('news-backward-fast')])
tagger = DependencyParser(lstm_hidden_size=512,
token_embeddings=embeddings,
relations_dictionary=dependency_dictionary,
tag_type="dependency")
trainer = ModelTrainer(tagger, corpus)
trainer.train('models/resources/taggers/example-dependency',
use_final_model_for_eval=True,
learning_rate=0.1,
mini_batch_size=8,
max_epochs=20,
) |
Ah wait, I get this error during the evaluation. I'll check. |
First I did a reinstall, but neither old nor new scripts worked.
Now all the models run smoothly and the predictions work as well. I still think there could be a bug within those functions, but I wouldn't know why it appears only on my side. |
Hello,
I am currently trying to implement the DependencyParser for a corpus in the conllu format. It runs smoothly until it hits the evaluation function, where I receive the following error:
TypeError: unsupported format string passed to Tensor.__format__
This is both with leaving the gold_label_dictionary empty (is marked as "optional" in the class), or with feeding it a label-dictionary. What needs to be my input in order for the parser to run?
I feel also a little bit unsecure regarding the format of the input corpus. Did I understand correctly that the parser only takes the token and the deprel-feature as input, leaving aside upos and "head"?
Looking forward to your help and exploring more about the dependency parser, thanks for implementing it!
The text was updated successfully, but these errors were encountered: