From 4f381b352c0e467b5870a97d41cb66b487a2c503 Mon Sep 17 00:00:00 2001 From: Jingze Shi Date: Fri, 24 Jan 2025 18:37:20 +0800 Subject: [PATCH] Fixed bug of import url_to_fs from fsspec (#507) (#512) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed bug of import url_to_fs from fsspec (#507) * Add a try catch as import depend on fsspec version * Fixed code quality --------- Co-authored-by: Clémentine Fourrier <22726840+clefourrier@users.noreply.github.com> --- src/lighteval/logging/evaluation_tracker.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lighteval/logging/evaluation_tracker.py b/src/lighteval/logging/evaluation_tracker.py index af5784bc..585d7423 100644 --- a/src/lighteval/logging/evaluation_tracker.py +++ b/src/lighteval/logging/evaluation_tracker.py @@ -34,7 +34,6 @@ import torch from datasets import Dataset, load_dataset from datasets.utils.metadata import MetadataConfigs -from fsspec import url_to_fs from huggingface_hub import DatasetCard, DatasetCardData, HfApi, HFSummaryWriter, hf_hub_url from lighteval.logging.info_loggers import ( @@ -53,6 +52,11 @@ if is_nanotron_available(): from nanotron.config import GeneralArgs # type: ignore +try: + from fsspec import url_to_fs +except ImportError: + from fsspec.core import url_to_fs + class EnhancedJSONEncoder(json.JSONEncoder): """