diff --git a/src/helm/benchmark/config_registry.py b/src/helm/benchmark/config_registry.py index c5f75a62df..cfa5725d60 100644 --- a/src/helm/benchmark/config_registry.py +++ b/src/helm/benchmark/config_registry.py @@ -1,5 +1,5 @@ import os -from importib import resources +from importlib import resources from helm.benchmark.model_deployment_registry import register_model_deployments_from_path from helm.benchmark.model_metadata_registry import register_model_metadata_from_path diff --git a/src/helm/benchmark/metrics/efficiency_metrics.py b/src/helm/benchmark/metrics/efficiency_metrics.py index 2bd62c110b..a8a6cd0b8b 100644 --- a/src/helm/benchmark/metrics/efficiency_metrics.py +++ b/src/helm/benchmark/metrics/efficiency_metrics.py @@ -1,7 +1,7 @@ from typing import Dict, List, Optional import json -from importib import resources +from importlib import resources from helm.common.hierarchical_logger import hlog from helm.benchmark.adaptation.request_state import RequestState diff --git a/src/helm/benchmark/presentation/contamination.py b/src/helm/benchmark/presentation/contamination.py index 1bf2f93887..5ec810f9e3 100644 --- a/src/helm/benchmark/presentation/contamination.py +++ b/src/helm/benchmark/presentation/contamination.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import List, Optional import dacite -from importib import resources +from importlib import resources import yaml from helm.common.hierarchical_logger import htrack, hlog diff --git a/src/helm/benchmark/presentation/schema.py b/src/helm/benchmark/presentation/schema.py index 6ee28d6c78..620075256b 100644 --- a/src/helm/benchmark/presentation/schema.py +++ b/src/helm/benchmark/presentation/schema.py @@ -6,7 +6,7 @@ from inspect import cleandoc import mako.template import yaml -from importib import resources +from importlib import resources from helm.common.general import hlog from helm.benchmark.metrics.metric_name import MetricName @@ -238,7 +238,7 @@ def get_adapter_fields() -> List[Field]: # Unfortunately there is no standard library support for getting docstrings of class fields, # so we have to do the parsing outselves. Fortunately, the parsing is quite straightforward. adapter_spec_path = resources.files(_ADAPTER_SPEC_PACKAGE).joinpath(_ADAPTER_SPEC_FILENAME) - with open(adapter_spec_path, "r") as f: + with adapter_spec_path.open("r") as f: contents = f.read() module_node = ast.parse(contents) adapter_spec_node = [ @@ -271,7 +271,7 @@ def get_adapter_fields() -> List[Field]: def get_default_schema_path() -> str: - return resources.files(SCHEMA_YAML_PACKAGE).joinpath(SCHEMA_CLASSIC_YAML_FILENAME) + return str(resources.files(SCHEMA_YAML_PACKAGE).joinpath(SCHEMA_CLASSIC_YAML_FILENAME)) def read_schema(schema_path: str) -> Schema: diff --git a/src/helm/benchmark/server.py b/src/helm/benchmark/server.py index cd9d534c01..181dd31d1c 100644 --- a/src/helm/benchmark/server.py +++ b/src/helm/benchmark/server.py @@ -4,7 +4,7 @@ """ import argparse -from importib import resources +from importlib import resources import json from os import path import urllib diff --git a/src/helm/tokenizers/yalm_tokenizer_data/yalm_tokenizer.py b/src/helm/tokenizers/yalm_tokenizer_data/yalm_tokenizer.py index 8ef299b746..ae3f5bdd4c 100644 --- a/src/helm/tokenizers/yalm_tokenizer_data/yalm_tokenizer.py +++ b/src/helm/tokenizers/yalm_tokenizer_data/yalm_tokenizer.py @@ -1,5 +1,5 @@ # mypy: check_untyped_defs = False -from importib import resources +from importlib import resources from helm.common.optional_dependencies import handle_module_not_found_error