Skip to content

Commit

Permalink
Move helm.proxy.clients to helm.clients (#2413)
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanmai authored Feb 28, 2024
1 parent 06263b1 commit 844ab8d
Show file tree
Hide file tree
Showing 114 changed files with 255 additions and 255 deletions.
2 changes: 1 addition & 1 deletion docs/adding_new_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ model_deployments:
tokenizer_name: simple/model1
max_sequence_length: 2048
client_spec:
class_name: "helm.proxy.clients.simple_client.SimpleClient"
class_name: "helm.clients.simple_client.SimpleClient"
args: {}
window_service_spec:
class_name: "helm.benchmark.window_services.openai_window_service.OpenAIWindowService"
Expand Down
2 changes: 1 addition & 1 deletion scripts/cache/fix_anthropic_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from helm.common.cache import create_key_value_store, MongoCacheConfig
from helm.common.general import parse_hocon
from helm.common.hierarchical_logger import hlog, htrack
from helm.proxy.clients.anthropic_client import AnthropicLegacyClient
from helm.clients.anthropic_client import AnthropicLegacyClient
from helm.proxy.retry import get_retry_decorator


Expand Down
4 changes: 2 additions & 2 deletions scripts/compute_request_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from typing import Any, Optional, Dict
from helm.common.cache_backend_config import SqliteCacheBackendConfig
from helm.common.general import ensure_directory_exists
from helm.proxy.clients.auto_client import AutoClient
from helm.clients.auto_client import AutoClient
from helm.benchmark.model_deployment_registry import ModelDeployment, get_model_deployment
from helm.tokenizers.auto_tokenizer import AutoTokenizer
from helm.common.request import Request
from helm.common.tokenization_request import TokenizationRequest

# TODO #1592: reenable this once the imports are faster
# from helm.proxy.clients.client import Client
# from helm.clients.client import Client
from helm.tokenizers.tokenizer import Tokenizer

import os
Expand Down
2 changes: 1 addition & 1 deletion scripts/offline_eval/deepfloyd/deepfloyd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from helm.common.request import Request
from helm.common.file_caches.local_file_cache import LocalFileCache
from helm.common.hierarchical_logger import hlog, htrack_block
from helm.proxy.clients.image_generation.deep_floyd_client import DeepFloydClient
from helm.clients.image_generation.deep_floyd_client import DeepFloydClient


"""
Expand Down
6 changes: 3 additions & 3 deletions scripts/offline_eval/export_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
)
from helm.common.key_value_store import request_to_key
from helm.common.hierarchical_logger import hlog, htrack, htrack_block
from helm.proxy.clients.google_client import GoogleClient
from helm.proxy.clients.together_client import TogetherClient
from helm.proxy.clients.microsoft_client import MicrosoftClient
from helm.clients.google_client import GoogleClient
from helm.clients.together_client import TogetherClient
from helm.clients.microsoft_client import MicrosoftClient


"""
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ exclude =
max-line-length = 120
exclude =
venv/*
src/helm/proxy/clients/image_generation/dalle_mini/*
src/helm/proxy/clients/image_generation/mindalle/*
src/helm/clients/image_generation/dalle_mini/*
src/helm/clients/image_generation/mindalle/*

# Ignore completely:
# E203 - White space before ':', (conflicts with black)
Expand Down
2 changes: 1 addition & 1 deletion src/helm/benchmark/augmentations/translate_perturbation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from random import Random

from helm.proxy.clients.google_translate_client import GoogleTranslateClient
from helm.clients.google_translate_client import GoogleTranslateClient
from .perturbation import TextPerturbation
from .perturbation_description import PerturbationDescription

Expand Down
2 changes: 1 addition & 1 deletion src/helm/benchmark/huggingface_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def register_huggingface_model(
model_deployment = ModelDeployment(
name=helm_model_name,
client_spec=ClientSpec(
class_name="helm.proxy.clients.huggingface_client.HuggingFaceClient",
class_name="helm.clients.huggingface_client.HuggingFaceClient",
args=object_spec_args,
),
model_name=helm_model_name,
Expand Down
2 changes: 1 addition & 1 deletion src/helm/benchmark/metrics/cleva_harms_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from helm.benchmark.adaptation.request_state import RequestState
from helm.benchmark.adaptation.adapter_spec import AdapterSpec
from helm.benchmark.metrics.cleva_metrics_helper import ChineseTokenizer
from helm.proxy.clients.perspective_api_client import PerspectiveAPIClientCredentialsError
from helm.clients.perspective_api_client import PerspectiveAPIClientCredentialsError
from helm.common.general import ensure_file_downloaded, ensure_directory_exists
from helm.common.optional_dependencies import handle_module_not_found_error
from .bias_metrics import BiasMetric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from helm.benchmark.metrics.metric_name import MetricName
from helm.benchmark.metrics.metric_service import MetricService
from helm.benchmark.metrics.toxicity_utils import is_prompt_toxic
from helm.proxy.clients.image_generation.dalle2_client import DALLE2Client
from helm.clients.image_generation.dalle2_client import DALLE2Client
from helm.common.images_utils import is_blacked_out_image
from .nsfw_detector import NSFWDetector

Expand Down
2 changes: 1 addition & 1 deletion src/helm/benchmark/metrics/toxicity_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from helm.common.hierarchical_logger import hlog
from helm.benchmark.adaptation.request_state import RequestState
from helm.benchmark.adaptation.adapter_spec import AdapterSpec
from helm.proxy.clients.perspective_api_client import PerspectiveAPIClientCredentialsError
from helm.clients.perspective_api_client import PerspectiveAPIClientCredentialsError
from .metric import Metric
from .metric_name import MetricName
from .metric_service import MetricService
Expand Down
4 changes: 2 additions & 2 deletions src/helm/benchmark/test_model_deployment_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from helm.benchmark.tokenizer_config_registry import TokenizerConfig, get_tokenizer_config
from helm.benchmark.window_services.test_utils import get_tokenizer_service
from helm.common.cache_backend_config import BlackHoleCacheBackendConfig
from helm.proxy.clients.client import Client
from helm.clients.client import Client
from helm.tokenizers.tokenizer import Tokenizer
from helm.benchmark.window_services.window_service import WindowService

from helm.benchmark.window_services.window_service_factory import WindowServiceFactory
from helm.proxy.clients.auto_client import AutoClient
from helm.clients.auto_client import AutoClient
from helm.tokenizers.auto_tokenizer import AutoTokenizer


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import tempfile

from helm.benchmark.window_services.tokenizer_service import TokenizerService
from helm.proxy.clients.image_generation.dalle2_client import DALLE2Client
from helm.clients.image_generation.dalle2_client import DALLE2Client
from helm.benchmark.window_services.test_utils import get_tokenizer_service, TEST_PROMPT
from helm.benchmark.window_services.window_service_factory import WindowServiceFactory
from helm.common.cache_backend_config import BlackHoleCacheBackendConfig
Expand Down
2 changes: 1 addition & 1 deletion src/helm/benchmark/window_services/local_window_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
TokenizationRequestResult,
TokenizationToken,
)
from helm.proxy.clients.client import cleanup_tokens
from helm.clients.client import cleanup_tokens


class LocalWindowService(ConfigurableWindowService, ABC):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from helm.common.hierarchical_logger import hlog
from helm.common.object_spec import create_object, inject_object_spec_args
from helm.common.request import Request, RequestResult
from helm.proxy.clients.client import Client
from helm.proxy.clients.moderation_api_client import ModerationAPIClient
from helm.clients.client import Client
from helm.clients.moderation_api_client import ModerationAPIClient
from helm.proxy.critique.critique_client import CritiqueClient
from helm.proxy.clients.toxicity_classifier_client import ToxicityClassifierClient
from helm.clients.toxicity_classifier_client import ToxicityClassifierClient
from helm.proxy.retry import NonRetriableException, retry_request
from helm.tokenizers.auto_tokenizer import AutoTokenizer

Expand Down Expand Up @@ -133,7 +133,7 @@ def get_gcs_client(self):
return GCSClient(bucket_name, cache_config)

def get_nudity_check_client(self):
from helm.proxy.clients.image_generation.nudity_check_client import NudityCheckClient
from helm.clients.image_generation.nudity_check_client import NudityCheckClient

cache_config: CacheConfig = self.cache_backend_config.get_cache_config("nudity")
return NudityCheckClient(cache_config)
Expand All @@ -146,7 +146,7 @@ def get_clip_score_client(self):

def get_toxicity_classifier_client(self) -> ToxicityClassifierClient:
"""Get the toxicity classifier client. We currently only support Perspective API."""
from helm.proxy.clients.perspective_api_client import PerspectiveAPIClient
from helm.clients.perspective_api_client import PerspectiveAPIClient

cache_config: CacheConfig = self.cache_backend_config.get_cache_config("perspectiveapi")
return PerspectiveAPIClient(self.credentials.get("perspectiveApiKey", ""), cache_config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from typing import Any, Dict, List, Mapping, Optional

from helm.common.cache import CacheConfig
from helm.proxy.clients.client import CachingClient, truncate_and_tokenize_response_text
from helm.clients.client import CachingClient, truncate_and_tokenize_response_text
from helm.common.request import Request, RequestResult, Sequence, wrap_request_time
from helm.proxy.clients.bedrock_utils import get_bedrock_client
from helm.clients.bedrock_utils import get_bedrock_client
from helm.tokenizers.tokenizer import Tokenizer


Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from helm.common.cache import Cache, CacheConfig
from helm.common.clip_score_request import DEFAULT_CLIP_SCORE_MODEL, CLIPScoreRequest, CLIPScoreResult
from helm.proxy.clients.clip_scorers.base_clip_scorer import BaseCLIPScorer
from helm.clients.clip_scorers.base_clip_scorer import BaseCLIPScorer


class CLIPScoreClientError(Exception):
Expand All @@ -27,7 +27,7 @@ def compute_score(self, request: CLIPScoreRequest) -> CLIPScoreResult:

def do_it():
if self._clip_scorer is None:
from helm.proxy.clients.clip_scorers.clip_scorer import CLIPScorer
from helm.clients.clip_scorers.clip_scorer import CLIPScorer

self._clip_scorer = CLIPScorer()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DecodeRequest,
DecodeRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DecodeRequest,
DecodeRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
TokenizationRequest,
TokenizationRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.proxy.clients.image_generation.cogview2.coglm_strategy import CoglmStrategy
from helm.clients.client import Client, CachingClient
from helm.clients.image_generation.cogview2.coglm_strategy import CoglmStrategy
from .image_generation_client_utils import get_single_image_multimedia_object


Expand All @@ -43,11 +43,11 @@ def __init__(self, cache_config: CacheConfig, file_cache: FileCache):
def _get_model(self) -> None:
try:
from SwissArmyTransformer import get_args
from helm.proxy.clients.image_generation.cogview2.coglm_utils import (
from helm.clients.image_generation.cogview2.coglm_utils import (
get_recipe,
InferenceModel,
)
from helm.proxy.clients.image_generation.cogview2.sr_pipeline import SRGroup
from helm.clients.image_generation.cogview2.sr_pipeline import SRGroup
except ModuleNotFoundError as e:
handle_module_not_found_error(e, ["heim"])

Expand Down Expand Up @@ -86,7 +86,7 @@ def _get_model(self) -> None:
def _model_inference(self, prompt) -> torch.Tensor:
try:
from SwissArmyTransformer.generation.autoregressive_sampling import filling_sequence
from helm.proxy.clients.image_generation.cogview2.coglm_utils import get_masks_and_position_ids_coglm
from helm.clients.image_generation.cogview2.coglm_utils import get_masks_and_position_ids_coglm
except ModuleNotFoundError as e:
handle_module_not_found_error(e, ["heim"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
DecodeRequest,
DecodeRequestResult,
)
from helm.proxy.clients.moderation_api_client import ModerationAPIClient
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.moderation_api_client import ModerationAPIClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from helm.common.general import singleton
from helm.common.optional_dependencies import handle_module_not_found_error
from helm.common.request import Request, RequestResult, Sequence, wrap_request_time
from helm.proxy.clients.moderation_api_client import ModerationAPIClient
from helm.proxy.clients.client import CachingClient
from helm.clients.moderation_api_client import ModerationAPIClient
from helm.clients.client import CachingClient
from .dalle2_client import DALLE2Client
from .image_generation_client_utils import get_single_image_multimedia_object

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
TokenizationRequest,
TokenizationRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object


Expand All @@ -41,8 +41,8 @@ def _get_model(self, model_engine: str):
import jax.numpy as jnp
from flax.jax_utils import replicate

from helm.proxy.clients.image_generation.dalle_mini.vqgan_jax.modeling_flax_vqgan import VQModel
from helm.proxy.clients.image_generation.dalle_mini import DalleBart, DalleBartProcessor
from helm.clients.image_generation.dalle_mini.vqgan_jax.modeling_flax_vqgan import VQModel
from helm.clients.image_generation.dalle_mini import DalleBart, DalleBartProcessor
except ModuleNotFoundError as e:
handle_module_not_found_error(e, ["heim"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
DecodeRequest,
DecodeRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
TokenizationRequest,
TokenizationRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
DecodeRequest,
DecodeRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
TokenizationRequest,
TokenizationRequestResult,
)
from helm.proxy.clients.client import Client, CachingClient
from helm.clients.client import Client, CachingClient
from .image_generation_client_utils import get_single_image_multimedia_object

try:
Expand All @@ -36,7 +36,7 @@ def __init__(self, cache_config: CacheConfig, file_cache: FileCache):

def _get_model(self):
try:
from helm.proxy.clients.image_generation.mindalle.models import Dalle
from helm.clients.image_generation.mindalle.models import Dalle
except ModuleNotFoundError as e:
handle_module_not_found_error(e, ["heim"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DecodeRequestResult,
)

from helm.proxy.clients.client import CachingClient, Client
from helm.clients.client import CachingClient, Client
from .image_generation_client_utils import get_single_image_multimedia_object


Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Token,
)
from helm.common.tokenization_request import TokenizationRequest
from helm.proxy.clients.client import CachingClient, truncate_sequence
from helm.clients.client import CachingClient, truncate_sequence
from helm.tokenizers.tokenizer import Tokenizer


Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from helm.common.cache import CacheConfig

from helm.common.optional_dependencies import OptionalDependencyNotInstalled
from helm.proxy.clients.huggingface_client import HuggingFaceClient
from helm.clients.huggingface_client import HuggingFaceClient


_register_open_lm_lock = Lock()
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from googleapiclient.errors import BatchError, HttpError
from googleapiclient.http import BatchHttpRequest
from httplib2 import HttpLib2Error
from helm.proxy.clients.toxicity_classifier_client import ToxicityClassifierClient
from helm.clients.toxicity_classifier_client import ToxicityClassifierClient
from helm.proxy.retry import NonRetriableException

from helm.common.cache import Cache, CacheConfig
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from helm.common.request import Request, RequestResult
from helm.common.general import get_credentials
from helm.proxy.clients.auto_client import AutoClient
from helm.clients.auto_client import AutoClient


@pytest.mark.models
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 844ab8d

Please sign in to comment.