After installing 'gliner' using the command "pip install gliner", I received the following message: "Successfully installed flair-0.13.1 gliner-0.1.6" But I encountered the following error message when attempting to load the model with the following code:
from gliner import GLiNER
model = GLiNER.from_pretrained("urchade/gliner_base")
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.11/site-packages/gliner/init.py", line 3, in
from .model import GLiNER
File "/usr/local/lib/python3.11/site-packages/gliner/model.py", line 13, in
from gliner.modules.token_rep import TokenRepLayer
File "/usr/local/lib/python3.11/site-packages/gliner/modules/token_rep.py", line 4, in
from flair.data import Sentence
File "/usr/local/lib/python3.11/site-packages/flair/init.py", line 42, in
from . import ( # noqa: E402 import after setting device
File "/usr/local/lib/python3.11/site-packages/flair/models/init.py", line 1, in
from .clustering import ClusteringModel
File "/usr/local/lib/python3.11/site-packages/flair/models/clustering.py", line 14, in
from flair.embeddings import DocumentEmbeddings
File "/usr/local/lib/python3.11/site-packages/flair/embeddings/init.py", line 13, in
from .document import (
File "/usr/local/lib/python3.11/site-packages/flair/embeddings/document.py", line 16, in
from flair.embeddings.token import FlairEmbeddings, StackedEmbeddings, TokenEmbeddings
File "/usr/local/lib/python3.11/site-packages/flair/embeddings/token.py", line 10, in
import gensim
File "/usr/local/lib/python3.11/site-packages/gensim/init.py", line 11, in
from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils # noqa:F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gensim/corpora/init.py", line 6, in
from .indexedcorpus import IndexedCorpus # noqa:F401 must appear before the other classes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gensim/corpora/indexedcorpus.py", line 14, in
from gensim import interfaces, utils
File "/usr/local/lib/python3.11/site-packages/gensim/interfaces.py", line 19, in
from gensim import utils, matutils
File "/usr/local/lib/python3.11/site-packages/gensim/matutils.py", line 20, in
from scipy.linalg import get_blas_funcs, triu
ImportError: cannot import name 'triu' from 'scipy.linalg' (/usr/local/lib/python3.11/site-packages/scipy/linalg/init.py)
Additionally, when attempting to run "python -c 'import gliner; print(gliner.version)'", I encountered the same ImportError.
After installing 'gliner' using the command "pip install gliner", I received the following message: "Successfully installed flair-0.13.1 gliner-0.1.6" But I encountered the following error message when attempting to load the model with the following code:
from gliner import GLiNER
model = GLiNER.from_pretrained("urchade/gliner_base")
Traceback (most recent call last): File "", line 1, in
File "/usr/local/lib/python3.11/site-packages/gliner/init.py", line 3, in
from .model import GLiNER
File "/usr/local/lib/python3.11/site-packages/gliner/model.py", line 13, in
from gliner.modules.token_rep import TokenRepLayer
File "/usr/local/lib/python3.11/site-packages/gliner/modules/token_rep.py", line 4, in
from flair.data import Sentence
File "/usr/local/lib/python3.11/site-packages/flair/init.py", line 42, in
from . import ( # noqa: E402 import after setting device
File "/usr/local/lib/python3.11/site-packages/flair/models/init.py", line 1, in
from .clustering import ClusteringModel
File "/usr/local/lib/python3.11/site-packages/flair/models/clustering.py", line 14, in
from flair.embeddings import DocumentEmbeddings
File "/usr/local/lib/python3.11/site-packages/flair/embeddings/init.py", line 13, in
from .document import (
File "/usr/local/lib/python3.11/site-packages/flair/embeddings/document.py", line 16, in
from flair.embeddings.token import FlairEmbeddings, StackedEmbeddings, TokenEmbeddings
File "/usr/local/lib/python3.11/site-packages/flair/embeddings/token.py", line 10, in
import gensim
File "/usr/local/lib/python3.11/site-packages/gensim/init.py", line 11, in
from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils # noqa:F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gensim/corpora/init.py", line 6, in
from .indexedcorpus import IndexedCorpus # noqa:F401 must appear before the other classes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gensim/corpora/indexedcorpus.py", line 14, in
from gensim import interfaces, utils
File "/usr/local/lib/python3.11/site-packages/gensim/interfaces.py", line 19, in
from gensim import utils, matutils
File "/usr/local/lib/python3.11/site-packages/gensim/matutils.py", line 20, in
from scipy.linalg import get_blas_funcs, triu
ImportError: cannot import name 'triu' from 'scipy.linalg' (/usr/local/lib/python3.11/site-packages/scipy/linalg/init.py)
Additionally, when attempting to run "python -c 'import gliner; print(gliner.version)'", I encountered the same ImportError.