Skip to content

Commit

Permalink
Merge branch 'main' into ayushmishra/batch-score-oss
Browse files Browse the repository at this point in the history
  • Loading branch information
novaturient95 authored Sep 23, 2024
2 parents 3743042 + 12755ea commit 8d858d4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from aml_benchmark.utils.exceptions import swallow_all_exceptions
from aml_benchmark.utils.aml_run_utils import str2bool
from aml_benchmark.utils.exceptions import BenchmarkUserException
from aml_benchmark.utils.constants import AuthenticationType, get_endpoint_type
from aml_benchmark.utils.constants import AuthenticationType, get_api_type, get_endpoint_type
from aml_benchmark.utils.error_definitions import BenchmarkUserError
from azureml._common._error_definition.azureml_error import AzureMLError

Expand Down Expand Up @@ -307,7 +307,7 @@ def main(

config_dict = {
"api": {
"type": "completion",
"type": get_api_type(merged_scoring_url),
"response_segment_size": response_segment_size
},
"authentication": authentication_dict,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,36 @@ class IntermediateNames:
_DEFAULT_URL_TYPE = "azureml_online_endpoint"


class ApiType():
"""Api Type."""

Unknown = 'unknown'
Completion = 'completion'
ChatCompletion = 'chat_completion'


COMPLETION_API_SUFFIX_LIST = ["v1/completions"]
CHAT_COMPLETION_API_SUFFIX_LIST = ["v1/chat/completions"]
DEFAULT_API_TYPE = ApiType.Completion
API_TYPE_MAPPING = {
ApiType.Completion: COMPLETION_API_SUFFIX_LIST,
ApiType.ChatCompletion: CHAT_COMPLETION_API_SUFFIX_LIST
}


def get_api_type(url: str) -> str:
"""Get the api type for a given endpoint URL.
:param url: The URL of the endpoint.
:return: API type of the endpoint.
"""
return next((
api_type for api_type, suffixes in API_TYPE_MAPPING.items()
if any(suffix in url for suffix in suffixes)),
DEFAULT_API_TYPE
)


def get_endpoint_type(url: str) -> str:
"""
Get the endpoint type for a given endpoint URL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ RUN /bin/bash -c "source /opt/miniconda/etc/profile.d/conda.sh && \
pip install --upgrade pip && \
pip install -r requirements.txt && \
pip install db-copilot-tool==0.0.8 &&\
pip install cryptography==42.0.5 langchain==0.1.11 idna==3.7 sqlparse==0.5.0 gunicorn==22.0.0 Werkzeug==3.0.3 requests==2.32.0 azure-identity==1.16.1"
pip install cryptography==43.0.1 langchain==0.1.11 idna==3.7 sqlparse==0.5.0 gunicorn==22.0.0 Werkzeug==3.0.3 requests==2.32.0 azure-identity==1.16.1"

# Fix vunerabilities
RUN /bin/bash -c "source /opt/miniconda/etc/profile.d/conda.sh && \
conda activate /opt/miniconda && \
pip install cryptography==42.0.5 idna==3.7 sqlparse==0.5.0 gunicorn==22.0.0 tqdm==4.66.3 requests==2.32.0 azure-identity==1.16.1 urllib3==2.2.2 certifi==2024.07.04&& \
pip install cryptography==43.0.1 idna==3.7 sqlparse==0.5.0 gunicorn==22.0.0 tqdm==4.66.3 requests==2.32.0 azure-identity==1.16.1 urllib3==2.2.2 certifi==2024.07.04&& \
conda deactivate"

# Install certificates and other utilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ RUN pip install 'Werkzeug>=3.0.3' \

# To resolve CVE-2024-5480 vulnerability issue for torch < 2.2.2
RUN pip install 'torch>=2.2.2'
# To resolve vulnerability issue
RUN pip install 'opencv-python-headless==4.8.1.78'

RUN pip freeze

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ outputs:
type: path
description: Json file to which UX is serialized to for viewing in static AzureML Studio UI
code: ../src
environment: azureml://registries/azureml/environments/responsibleai-vision/versions/6
environment: azureml://registries/azureml/environments/responsibleai-vision/versions/7
command: >-
python ./rai_vision_insights.py
--task_type ${{inputs.task_type}}
Expand Down
2 changes: 1 addition & 1 deletion assets/responsibleai/vision/jobs/fetch_fridge_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ outputs:
model_output_path:
type: path
code: ./src_fridge/
environment: azureml://registries/azureml/environments/responsibleai-vision/versions/6
environment: azureml://registries/azureml/environments/responsibleai-vision/versions/7
command: >-
python ./fetch_image_model.py
--model_base_name ${{inputs.model_base_name}}
Expand Down

0 comments on commit 8d858d4

Please sign in to comment.