-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Hello,
First thanks to everyone for creating this great package.
I followed https://huggingface.co/flair/ner-french tutorial to train the model and got an import error related to the dataset when running the model.
I am using flair 0.14, and python 3.11 on windows.
To Reproduce
from flair.data import Corpus
from flair.datasets import WIKINER_FRENCH
from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
# 1. get the corpus
corpus: Corpus = WIKINER_FRENCH()
# 2. what tag do we want to predict?
tag_type = 'ner'
# 3. make the tag dictionary from the corpus
tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
# 4. initialize each embedding we use
embedding_types = [
# GloVe embeddings
WordEmbeddings('fr'),
# contextual string embeddings, forward
FlairEmbeddings('fr-forward'),
# contextual string embeddings, backward
FlairEmbeddings('fr-backward'),
]
# embedding stack consists of Flair and GloVe embeddings
embeddings = StackedEmbeddings(embeddings=embedding_types)
# 5. initialize sequence tagger
from flair.models import SequenceTagger
tagger = SequenceTagger(hidden_size=256,
embeddings=embeddings,
tag_dictionary=tag_dictionary,
tag_type=tag_type)
# 6. initialize trainer
from flair.trainers import ModelTrainer
trainer = ModelTrainer(tagger, corpus)
# 7. run training
trainer.train('resources/taggers/ner-french',
train_with_dev=True,
max_epochs=150)Expected behavior
I would expect the tutorial script to work and be able to train the model.
Logs and Stack traces
from flair.datasets import WIKINER_FRENCH
ImportError: cannot import name 'WIKINER_FRENCH' from 'flair.datasets'
Screenshots
No response
Additional Context
No response
Environment
Versions:
Flair
0.14.0
Pytorch
2.5.1+cpu
Transformers
4.46.1
GPU
False
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working