huggingface / setfit

Efficient few-shot learning with Sentence Transformers
https://hf.co/docs/setfit
Apache License 2.0
2.23k stars 220 forks source link

AttributeError: module 'pyarrow.lib' has no attribute 'ListViewType' #534

Open firmai opened 4 months ago

firmai commented 4 months ago

I have been struggling with this for two days, any help would be appreciated. Python 3.10

from setfit import SetFitModel
from huggingface_hub import login

access_token_read = "cccxxxccc"

# Authenticate with the Hugging Face Hub
login(token=access_token_read)

# Load the models from the Hugging Face Hub
trainer_relv = SetFitModel.from_pretrained("snowdere/trainer_relevance")
trainer_trust = SetFitModel.from_pretrained("snowdere/trainer_trust")
trainer_sent = SetFitModel.from_pretrained("snowdere/trainer_sent")
trainer_topic = SetFitModel.from_pretrained("snowdere/trainer_topic")

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[6], line 1
----> 1 from setfit import SetFitModel
      2 from huggingface_hub import login
      4 access_token_read = "ccsddsds"

File /opt/conda/lib/python3.10/site-packages/setfit/__init__.py:7
      4 import os
      5 import warnings
----> 7 from .data import get_templated_dataset, sample_dataset
      8 from .model_card import SetFitModelCardData
      9 from .modeling import SetFitHead, SetFitModel

File /opt/conda/lib/python3.10/site-packages/setfit/data.py:5
      3 import pandas as pd
      4 import torch
----> 5 from datasets import Dataset, DatasetDict, load_dataset
      6 from torch.utils.data import Dataset as TorchDataset
      8 from . import logging

File /opt/conda/lib/python3.10/site-packages/datasets/__init__.py:18
      1 # ruff: noqa
      2 # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
      3 #
   (...)
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     16 __version__ = "2.19.0"
---> 18 from .arrow_dataset import Dataset
     19 from .arrow_reader import ReadInstruction
     20 from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder

File /opt/conda/lib/python3.10/site-packages/datasets/arrow_dataset.py:76
     73 from tqdm.contrib.concurrent import thread_map
     75 from . import config
---> 76 from .arrow_reader import ArrowReader
     77 from .arrow_writer import ArrowWriter, OptimizedTypedSequence
     78 from .data_files import sanitize_patterns

File /opt/conda/lib/python3.10/site-packages/datasets/arrow_reader.py:29
     26 from typing import TYPE_CHECKING, List, Optional, Union
     28 import pyarrow as pa
---> 29 import pyarrow.parquet as pq
     30 from tqdm.contrib.concurrent import thread_map
     32 from .download.download_config import DownloadConfig

File /opt/conda/lib/python3.10/site-packages/pyarrow/parquet/__init__.py:20
      1 # Licensed to the Apache Software Foundation (ASF) under one
      2 # or more contributor license agreements.  See the NOTICE file
      3 # distributed with this work for additional information
   (...)
     17 
     18 # flake8: noqa
---> 20 from .core import *

File /opt/conda/lib/python3.10/site-packages/pyarrow/parquet/core.py:33
     30 import pyarrow as pa
     32 try:
---> 33     import pyarrow._parquet as _parquet
     34 except ImportError as exc:
     35     raise ImportError(
     36         "The pyarrow installation is not built with support "
     37         f"for the Parquet file format ({str(exc)})"
     38     ) from None

File /opt/conda/lib/python3.10/site-packages/pyarrow/_parquet.pyx:1, in init pyarrow._parquet()

AttributeError: module 'pyarrow.lib' has no attribute 'ListViewType'

setfit: 1.0.3 transformers: 4.41.2 lingua-language-detector: 2.0.2 polars: 0.20.31 lightning: None google-cloud-bigquery: 3.24.0 shapely: 2.0.4 pyarrow: 16.0.0

aaron-v19 commented 2 months ago

I also faced the same problem, i still didn't find a final solution . I just used the following code as a temporary solution , I found this on stack overflow somewhere

!pip install pyarrow==15.0.2