Skip to content

Commit 84aa29f

Browse files
authored
Merge branch 'opendatahub-io:main' into main
2 parents d308ab1 + 833706b commit 84aa29f

20 files changed

Lines changed: 1034 additions & 248 deletions

File tree

.coderabbit.yaml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
language: en-US
2+
tone_instructions: ''
3+
early_access: false
4+
enable_free_tier: true
5+
reviews:
6+
profile: chill
7+
request_changes_workflow: false
8+
high_level_summary: true
9+
high_level_summary_placeholder: '@coderabbitai summary'
10+
high_level_summary_in_walkthrough: true
11+
auto_title_placeholder: '@coderabbitai'
12+
auto_title_instructions: ''
13+
review_status: true
14+
commit_status: true
15+
fail_commit_status: false
16+
collapse_walkthrough: true
17+
changed_files_summary: true
18+
sequence_diagrams: false
19+
assess_linked_issues: true
20+
related_issues: true
21+
related_prs: true
22+
suggested_labels: true
23+
auto_apply_labels: false
24+
suggested_reviewers: true
25+
auto_assign_reviewers: false
26+
poem: false
27+
labeling_instructions: []
28+
path_filters: []
29+
path_instructions: []
30+
abort_on_close: true
31+
disable_cache: false
32+
auto_review:
33+
enabled: true
34+
auto_incremental_review: true
35+
ignore_title_keywords: []
36+
labels: []
37+
drafts: false
38+
base_branches: []
39+
finishing_touches:
40+
docstrings:
41+
enabled: true
42+
unit_tests:
43+
enabled: true
44+
tools:
45+
ast-grep:
46+
rule_dirs: []
47+
util_dirs: []
48+
essential_rules: true
49+
packages: []
50+
shellcheck:
51+
enabled: true
52+
ruff:
53+
enabled: true
54+
markdownlint:
55+
enabled: true
56+
github-checks:
57+
enabled: true
58+
timeout_ms: 90000
59+
languagetool:
60+
enabled: true
61+
enabled_rules: []
62+
disabled_rules: []
63+
enabled_categories: []
64+
disabled_categories: []
65+
enabled_only: false
66+
level: default
67+
biome:
68+
enabled: true
69+
hadolint:
70+
enabled: true
71+
swiftlint:
72+
enabled: true
73+
phpstan:
74+
enabled: true
75+
level: default
76+
golangci-lint:
77+
enabled: true
78+
yamllint:
79+
enabled: true
80+
gitleaks:
81+
enabled: true
82+
checkov:
83+
enabled: true
84+
detekt:
85+
enabled: true
86+
eslint:
87+
enabled: true
88+
rubocop:
89+
enabled: true
90+
buf:
91+
enabled: true
92+
regal:
93+
enabled: true
94+
actionlint:
95+
enabled: true
96+
pmd:
97+
enabled: true
98+
cppcheck:
99+
enabled: true
100+
semgrep:
101+
enabled: true
102+
circleci:
103+
enabled: true
104+
clippy:
105+
enabled: true
106+
sqlfluff:
107+
enabled: true
108+
prismaLint:
109+
enabled: true
110+
pylint:
111+
enabled: true
112+
oxc:
113+
enabled: true
114+
shopifyThemeCheck:
115+
enabled: true
116+
luacheck:
117+
enabled: true
118+
brakeman:
119+
enabled: true
120+
dotenvLint:
121+
enabled: true
122+
chat:
123+
auto_reply: true
124+
integrations:
125+
jira:
126+
usage: auto
127+
linear:
128+
usage: auto
129+
knowledge_base:
130+
opt_out: false
131+
web_search:
132+
enabled: true
133+
learnings:
134+
scope: auto
135+
issues:
136+
scope: auto
137+
jira:
138+
usage: auto
139+
project_keys: []
140+
linear:
141+
usage: auto
142+
team_keys: []
143+
pull_requests:
144+
scope: auto
145+
code_generation:
146+
docstrings:
147+
language: en-US
148+
path_instructions: []
149+
unit_tests:
150+
path_instructions: []

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV BIN_DIR="$HOME_DIR/.local/bin"
1212
ENV PATH="$PATH:$BIN_DIR"
1313

1414
RUN apt-get update \
15-
&& apt-get install -y ssh gnupg software-properties-common curl gpg wget vim \
15+
&& apt-get install -y ssh gnupg software-properties-common curl gpg wget vim apache2-utils rsync\
1616
&& apt-get clean autoclean \
1717
&& apt-get autoremove --yes \
1818
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
@@ -35,11 +35,6 @@ RUN curl -sSL "https://github.com/fullstorydev/grpcurl/releases/download/v1.9.2/
3535
&& tar xvf /tmp/grpcurl_1.2.tar.gz --no-same-owner \
3636
&& mv grpcurl /usr/bin/grpcurl
3737

38-
# Install htpasswd
39-
RUN apt-get update && \
40-
apt-get install -y apache2-utils && \
41-
apt-get clean && \
42-
rm -rf /var/lib/apt/lists/*
4338

4439
RUN useradd -ms /bin/bash $USER
4540
USER $USER

tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
)
4343
from utilities.infra import update_configmap_data
4444
from utilities.minio import create_minio_data_connection_secret
45+
from utilities.operator_utils import get_csv_related_images
4546

4647
LOGGER = get_logger(name=__name__)
4748

@@ -517,3 +518,10 @@ def prometheus(admin_client: DynamicClient) -> Prometheus:
517518
), # TODO: Verify SSL with appropriate certs
518519
bearer_token=get_openshift_token(),
519520
)
521+
522+
523+
@pytest.fixture(scope="session")
524+
def related_images_refs(admin_client: DynamicClient) -> set[str]:
525+
related_images = get_csv_related_images(admin_client=admin_client)
526+
related_images_refs = {img["image"] for img in related_images}
527+
return related_images_refs

tests/model_explainability/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
import pytest
44
from kubernetes.dynamic import DynamicClient
5+
from ocp_resources.config_map import ConfigMap
56
from ocp_resources.namespace import Namespace
67
from ocp_resources.persistent_volume_claim import PersistentVolumeClaim
8+
from pytest_testconfig import config as py_config
9+
10+
from tests.model_explainability.trustyai_service.trustyai_service_utils import TRUSTYAI_SERVICE_NAME
711

812

913
@pytest.fixture(scope="class")
@@ -19,3 +23,15 @@ def pvc_minio_namespace(
1923
size="10Gi",
2024
) as pvc:
2125
yield pvc
26+
27+
28+
@pytest.fixture(scope="session")
29+
def trustyai_operator_configmap(
30+
admin_client: DynamicClient,
31+
) -> ConfigMap:
32+
return ConfigMap(
33+
client=admin_client,
34+
namespace=py_config["applications_namespace"],
35+
name=f"{TRUSTYAI_SERVICE_NAME}-operator-config",
36+
ensure_exists=True,
37+
)

tests/model_explainability/lm_eval/conftest.py

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,26 @@
2525

2626
@pytest.fixture(scope="function")
2727
def lmevaljob_hf(
28-
admin_client: DynamicClient, model_namespace: Namespace, patched_trustyai_operator_configmap_allow_online: ConfigMap
28+
request: FixtureRequest,
29+
admin_client: DynamicClient,
30+
model_namespace: Namespace,
31+
patched_trustyai_operator_configmap_allow_online: ConfigMap,
2932
) -> Generator[LMEvalJob, None, None]:
3033
with LMEvalJob(
3134
client=admin_client,
32-
name="test-job",
35+
name=LMEVALJOB_NAME,
3336
namespace=model_namespace.name,
3437
model="hf",
35-
model_args=[{"name": "pretrained", "value": "google/flan-t5-base"}],
36-
task_list={
37-
"custom": {
38-
"systemPrompts": [
39-
{"name": "sp_0", "value": "Be concise. At every point give the shortest acceptable answer."}
40-
],
41-
"templates": [
42-
{
43-
"name": "tp_0",
44-
"value": '{ "__type__": "input_output_template", '
45-
'"input_format": "{text_a_type}: {text_a}\\n'
46-
'{text_b_type}: {text_b}", '
47-
'"output_format": "{label}", '
48-
'"target_prefix": '
49-
'"The {type_of_relation} class is ", '
50-
'"instruction": "Given a {text_a_type} and {text_b_type} '
51-
'classify the {type_of_relation} of the {text_b_type} to one of {classes}.",'
52-
' "postprocessors": [ "processors.take_first_non_empty_line",'
53-
' "processors.lower_case_till_punc" ] }',
54-
}
55-
],
56-
},
57-
"taskRecipes": [
58-
{"card": {"name": "cards.wnli"}, "systemPrompt": {"ref": "sp_0"}, "template": {"ref": "tp_0"}}
59-
],
60-
},
38+
model_args=[{"name": "pretrained", "value": "Qwen/Qwen2.5-0.5B"}],
39+
task_list=request.param.get("task_list"),
6140
log_samples=True,
6241
allow_online=True,
6342
allow_code_execution=True,
43+
system_instruction="Be concise. At every point give the shortest acceptable answer.",
44+
chat_template={
45+
"enabled": True,
46+
},
47+
limit="0.01",
6448
) as job:
6549
yield job
6650

@@ -80,6 +64,7 @@ def lmevaljob_local_offline(
8064
model="hf",
8165
model_args=[{"name": "pretrained", "value": "/opt/app-root/src/hf_home/flan"}],
8266
task_list=request.param.get("task_list"),
67+
limit="0.01",
8368
log_samples=True,
8469
offline={"storage": {"pvcName": "lmeval-data"}},
8570
pod={
@@ -402,6 +387,13 @@ def lmevaljob_hf_pod(admin_client: DynamicClient, lmevaljob_hf: LMEvalJob) -> Ge
402387
yield get_lmevaljob_pod(client=admin_client, lmevaljob=lmevaljob_hf)
403388

404389

390+
@pytest.fixture(scope="function")
391+
def lmevaljob_local_offline_pod(
392+
admin_client: DynamicClient, lmevaljob_local_offline: LMEvalJob
393+
) -> Generator[Pod, Any, Any]:
394+
yield get_lmevaljob_pod(client=admin_client, lmevaljob=lmevaljob_local_offline)
395+
396+
405397
@pytest.fixture(scope="function")
406398
def lmevaljob_vllm_emulator_pod(
407399
admin_client: DynamicClient, lmevaljob_vllm_emulator: LMEvalJob

tests/model_explainability/lm_eval/test_lm_eval.py

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,65 @@
11
import pytest
22

3-
from tests.model_explainability.lm_eval.utils import verify_lmevaljob_running
43
from utilities.constants import Timeout
54

65
LMEVALJOB_COMPLETE_STATE: str = "Complete"
76

87

98
@pytest.mark.parametrize(
10-
"model_namespace",
9+
"model_namespace, lmevaljob_hf",
1110
[
1211
pytest.param(
13-
{"name": "test-lmeval-huggingface"},
14-
)
12+
{"name": "test-lmeval-hf-arc"}, {"task_list": {"taskNames": ["arc_challenge"]}}, id="arc_challenge"
13+
),
14+
pytest.param(
15+
{"name": "test-lmeval-hf-mmlu"},
16+
{"task_list": {"taskNames": ["mmlu_astronomy_generative"]}},
17+
id="mmlu_astronomy_generative",
18+
),
19+
pytest.param({"name": "test-lmeval-hf-hellaswag"}, {"task_list": {"taskNames": ["hellaswag"]}}, id="hellaswag"),
20+
pytest.param(
21+
{"name": "test-lmeval-hf-truthfulqa"}, {"task_list": {"taskNames": ["truthfulqa_gen"]}}, id="truthfulqa_gen"
22+
),
23+
pytest.param(
24+
{"name": "test-lmeval-hf-winogrande"}, {"task_list": {"taskNames": ["winogrande"]}}, id="winogrande"
25+
),
26+
pytest.param(
27+
{"name": "test-lmeval-hf-custom-task"},
28+
{
29+
"task_list": {
30+
"custom": {
31+
"systemPrompts": [
32+
{"name": "sp_0", "value": "Be concise. At every point give the shortest acceptable answer."}
33+
],
34+
"templates": [
35+
{
36+
"name": "tp_0",
37+
"value": '{ "__type__": "input_output_template", '
38+
'"input_format": "{text_a_type}: {text_a}\\n'
39+
'{text_b_type}: {text_b}", '
40+
'"output_format": "{label}", '
41+
'"target_prefix": '
42+
'"The {type_of_relation} class is ", '
43+
'"instruction": "Given a {text_a_type} and {text_b_type} '
44+
'classify the {type_of_relation} of the {text_b_type} to one of {classes}.",'
45+
' "postprocessors": [ "processors.take_first_non_empty_line",'
46+
' "processors.lower_case_till_punc" ] }',
47+
}
48+
],
49+
},
50+
"taskRecipes": [
51+
{"card": {"name": "cards.wnli"}, "systemPrompt": {"ref": "sp_0"}, "template": {"ref": "tp_0"}}
52+
],
53+
}
54+
},
55+
id="custom_task",
56+
),
1557
],
1658
indirect=True,
1759
)
1860
def test_lmeval_huggingface_model(admin_client, model_namespace, lmevaljob_hf_pod):
19-
"""Basic test that verifies that LMEval can run successfully pulling a model from HuggingFace."""
61+
"""Tests that verify running common evaluations (and a custom one) on a model pulled directly from HuggingFace.
62+
On each test we run a different evaluation task, limiting it to 1% of the questions on each eval."""
2063
lmevaljob_hf_pod.wait_for_status(status=lmevaljob_hf_pod.Status.SUCCEEDED, timeout=Timeout.TIMEOUT_20MIN)
2164

2265

@@ -39,10 +82,12 @@ def test_lmeval_local_offline_builtin_tasks_flan_arceasy(
3982
admin_client,
4083
model_namespace,
4184
lmeval_data_downloader_pod,
42-
lmevaljob_local_offline,
85+
lmevaljob_local_offline_pod,
4386
):
4487
"""Test that verifies that LMEval can run successfully in local, offline mode using builtin tasks"""
45-
verify_lmevaljob_running(client=admin_client, lmevaljob=lmevaljob_local_offline)
88+
lmevaljob_local_offline_pod.wait_for_status(
89+
status=lmevaljob_local_offline_pod.Status.SUCCEEDED, timeout=Timeout.TIMEOUT_20MIN
90+
)
4691

4792

4893
@pytest.mark.parametrize(
@@ -72,10 +117,12 @@ def test_lmeval_local_offline_unitxt_tasks_flan_20newsgroups(
72117
admin_client,
73118
model_namespace,
74119
lmeval_data_downloader_pod,
75-
lmevaljob_local_offline,
120+
lmevaljob_local_offline_pod,
76121
):
77122
"""Test that verifies that LMEval can run successfully in local, offline mode using unitxt"""
78-
verify_lmevaljob_running(client=admin_client, lmevaljob=lmevaljob_local_offline)
123+
lmevaljob_local_offline_pod.wait_for_status(
124+
status=lmevaljob_local_offline_pod.Status.SUCCEEDED, timeout=Timeout.TIMEOUT_20MIN
125+
)
79126

80127

81128
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)