Skip to content

Commit

Permalink
fix(LAB-3307): export LLM_STATIC
Browse files Browse the repository at this point in the history
  • Loading branch information
paulruelle committed Dec 23, 2024
1 parent a04217a commit 112d4f8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/kili/adapters/kili_api_gateway/asset/operations_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def list_assets(
project_info = get_project(
self.graphql_client, filters.project_id, ("inputType", "jsonInterface")
)
if project_info["inputType"] in {"VIDEO", "LLM_RLHF", "LLM_INSTR_FOLLOWING"}:
if project_info["inputType"] in {
"VIDEO",
"LLM_RLHF",
"LLM_INSTR_FOLLOWING",
"LLM_STATIC",
}:
yield from self.list_assets_split(filters, fields, options, project_info)
return

Expand Down
7 changes: 6 additions & 1 deletion src/kili/adapters/kili_api_gateway/label/operations_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ def list_labels(
project_info = get_project(
self.graphql_client, filters.project_id, ("inputType", "jsonInterface")
)
if project_info["inputType"] in {"VIDEO", "LLM_RLHF", "LLM_INSTR_FOLLOWING"}:
if project_info["inputType"] in {
"VIDEO",
"LLM_RLHF",
"LLM_INSTR_FOLLOWING",
"LLM_STATIC",
}:
yield from self.list_labels_split(filters, fields, options, project_info)
return

Expand Down
2 changes: 1 addition & 1 deletion src/kili/llm/services/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def export( # pylint: disable=too-many-arguments, too-many-locals
return LLMStaticExporter(kili_api_gateway).export(
cleaned_assets, project_id, project["jsonInterface"]
)
if input_type == "LLM_INSTR_FOLLOWING":
if input_type in ["LLM_STATIC", "LLM_INSTR_FOLLOWING"]:
return LLMDynamicExporter(kili_api_gateway).export(cleaned_assets, project["jsonInterface"])
raise ValueError(f'Project Input type "{input_type}" cannot be used for llm exports.')

Expand Down
7 changes: 4 additions & 3 deletions src/kili/llm/services/export/dynamic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Handle LLM_INSTR_FOLLOWING project exports."""
"""Handle LLM_INSTR_FOLLOWING & LLM_STATIC project exports."""

import logging
from typing import Dict, List, Union
Expand Down Expand Up @@ -32,7 +32,7 @@


class LLMDynamicExporter:
"""Handle exports of LLM_RLHF projects."""
"""Handle exports of LLM_STATIC and LLM_INSTR_FOLLOWING projects."""

def __init__(self, kili_api_gateway: KiliAPIGateway):
self.kili_api_gateway = kili_api_gateway
Expand Down Expand Up @@ -228,7 +228,8 @@ def _format_comparison_annotation(annotation, completions, job, obfuscated_model
break

if model_id is None:
raise ValueError(f"Failed to found model of annotation {annotation['id']}")
# FIXME : model_id can be null on LLM_STATIC
return None

iteration = 0
for _comparison_code, comparison_note in job["content"]["options"].items():
Expand Down

0 comments on commit 112d4f8

Please sign in to comment.