Questions tagged [flair]

A very simple framework for state-of-the-art NLP. Developed by Humboldt University of Berlin and friends.


Flair is:

  • A powerful NLP library. Flair allows you to apply our state-of-the-art natural language processing (NLP) models to your text, such as named entity recognition (NER), part-of-speech tagging (PoS), sense disambiguation and classification.

  • Multilingual. Thanks to the Flair community, we support a rapidly growing number of languages. We also now include 'one model, many languages' taggers, i.e. single models that predict PoS or NER tags for input text in various languages.

  • A text embedding library. Flair has simple interfaces that allow you to use and combine different word and document embeddings, including our proposed Flair embeddings, BERT embeddings and ELMo embeddings.

  • A PyTorch NLP framework. Our framework builds directly on PyTorch, making it easy to train your own models and experiment with new approaches using Flair embeddings and classes.

61 questions
7
votes
2 answers

Error in installing python package Flair, about a dependent package not hosted in PyPI

I am trying to install flair. It is throwing below error when executing below command: pip install flair ERROR: Packages installed from PyPI cannot depend on packages which are not also hosted on PyPI. tiny-tokenizer depends on SudachiDict_core@…
Irshad Ali
  • 1,153
  • 1
  • 13
  • 39
5
votes
1 answer

Flair Framework with PyTorch - OverflowError: int too big to convert

I'm trying to train a named entity recognition model with Flair Framework (https://github.com/flairNLP/flair), with this embedding: TransformerWordEmbeddings('emilyalsentzer/Bio_ClinicalBERT'). However, it always failed with OverflowError: int too…
gunturbudi
  • 51
  • 1
5
votes
0 answers

RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu

import asyncio import torch import os import pandas as pd from flair.data import Sentence from flair.embeddings import FlairEmbeddings, DocumentPoolEmbeddings, WordEmbeddings device = torch.device("cpu") print(device) # first, declare how you…
Karthick Aravindan
  • 1,042
  • 3
  • 12
  • 19
3
votes
1 answer

Running Flair embeddings parallel

I have a list containing millions of sentences for which I need embeddings. I am using Flair for this purpose. The problem seems like it should be embarrassingly parallel. But when I try to optimize, I get either no increase in performance, or it…
NicolaiF
  • 1,283
  • 1
  • 20
  • 44
3
votes
0 answers

Flair en-sentiment model loading fails when not connected to the internet

The following code fails for me when I do not have a working internet connection, with the error message that I have detailed below. I have tried a lot of things including configuring and checking the .flair folder and the .cache folder that the…
Rahul P
  • 2,493
  • 2
  • 17
  • 31
3
votes
0 answers

Flair training german NER model: Dev, f1 score almost 0.0, why the model doesn't learn?

I trained my NER model first with Spacy with the micro F1 score 64.7% (8 classes). Next step I wanted to train Flair, hoping to get better results. Of course the spacy format data would be convert to proper Flair corpus with some custom codes. Info…
Xia
  • 43
  • 5
3
votes
1 answer

ModuleNotFoundError: No module named 'flair'

I have installed flair library via the following command !pip install flair but when i tries to import it, it will generate error like "ModuleNotFoundError: No module named 'flair'" Code: import torch import numpy as np from flair.data import…
Juned Ansari
  • 5,035
  • 7
  • 56
  • 89
2
votes
2 answers

ERROR: Failed building wheel for sentencepiece while installing flair on python 3.10

While installing flair using pip install flair in python 3.10 virtual environment on mac-os Ventura, I get the following error: ERROR: Failed building wheel for sentencepiece Seperately installing sentencepeice using pip install sentenpeice did not…
Deepak Tatyaji Ahire
  • 4,883
  • 2
  • 13
  • 35
2
votes
1 answer

Why do I get a TypeError while trying to import flair?

In the environment which I use as a kernel, 'TR-ML', flair=0.8 is installed which I confirm via conda list after activating the environment. Only code I use is import flair When I run the code, I get a very long error. Here are the first few lines…
Kutay Eroglu
  • 73
  • 1
  • 5
2
votes
0 answers

Failing to Install Flair Python library through pip

I am trying to install flair library for a python project on my Macbook M1. https://pypi.org/project/flair/ But when I run pip3 install flair on my terminal, here is the output: DEPRECATION: Configuring installation scheme with distutils config…
2
votes
1 answer

How to get generate compound sentiment score using flair python

I have recently been learning how to use flair for sentiment analysis in python. I have previously been using vaderSentiment. I have been saving the sentiment scores as a compound score (ranging between -1 and 1, with -1 being most negative, 0 being…
BarryBBenson
  • 71
  • 1
  • 6
2
votes
1 answer

cuda out of memory problem in gpu in google colab

I am trying to run code to get stacked embedding from flair and bert and I am getting the following error. one of the suggestion was to reduce the batch size, but how to pass the data in batches? here is the code and error. from tqdm import tqdm ##…
shankar
  • 39
  • 4
2
votes
1 answer

An error occured while installing flair and pytorch with pipenv in windows with Pycharm

I am having problems installing the python packages flair and pytorch via pipenv and have not been able to resolve this issue yet. Since I am trying to version my python git repository with Pipfile + Pipfile.lock instead of requirements.txt this is…
chiemNZ
  • 21
  • 2
1
vote
0 answers

After the training of the train set in Python, the value of accurancy, recall and f1-score is 0

I am using the Flair library in python for a Fake News Detection problem, using an RNN-based algorithm. The code does not give errors, but the training phase is excessively slow and also at the end of that phase the metrics used for evaluation…
1
vote
1 answer

Fine tuning flair ner model

I am trying to fine tune flair ner model using these lines of code: embedding_types = [WordEmbeddings('glove'), WordEmbeddings('extvec'), WordEmbeddings('crawl'),] embeddings =…
1
2 3 4 5