Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(LMES): Support custom template and prompt #404

Merged

Conversation

yhwang
Copy link
Collaborator

@yhwang yhwang commented Feb 7, 2025

Expand the LMEvalJob CRD to support custom templates and system prompts. This is mainly for custom unitxt task recipes. Now, users can use the template and systemPrompt fields under the taskRecipes to specify the custom template and system prompt.

@yhwang yhwang requested a review from ruivieira February 7, 2025 19:33
@ruivieira ruivieira self-assigned this Feb 10, 2025
@ruivieira ruivieira added the kind/enhancement New feature or request label Feb 10, 2025
@ruivieira ruivieira added this to the ODH 2.25 milestone Feb 10, 2025
@yhwang yhwang force-pushed the custom-template-prompt branch from 539a94c to 586ad4b Compare February 10, 2025 19:25
@yhwang
Copy link
Collaborator Author

yhwang commented Feb 10, 2025

Instead of calling mkdir in the Dockerfile.lmes-job, the driver creates the folders for custom unitxt catalogs. This would minimize the changes in the Dockerfile.

@yhwang yhwang force-pushed the custom-template-prompt branch 2 times, most recently from a1e87dd to a4aef9b Compare February 13, 2025 23:24
@yhwang
Copy link
Collaborator Author

yhwang commented Feb 13, 2025

Tried to refactor the testing code in the driver_test.go. I believe it's in better shape now.

@yhwang yhwang force-pushed the custom-template-prompt branch from a4aef9b to 01733ba Compare February 19, 2025 04:59
@yhwang
Copy link
Collaborator Author

yhwang commented Feb 19, 2025

Here is a sample LMEvalJob with a custom template and custom system prompt:

apiVersion: trustyai.opendatahub.io/v1alpha1
kind: LMEvalJob
metadata:
  name: custom-card-template
  namespace: tas
spec:
  allowOnline: true
  allowCodeExecution: true
  model: hf
  modelArgs:
  - name: pretrained
    value: google/flan-t5-base
  taskList:
    taskRecipes:
    - template:
        ref: tp_0
      systemPrompt:
        ref: sp_0
      card:
        name: "cards.wnli"
    custom:
      templates:
      - name: tp_0
        value: |
          {
              "__type__": "input_output_template",
              "input_format": "{text_a_type}: {text_a}\n{text_b_type}: {text_b}",
              "output_format": "{label}",
              "target_prefix": "The {type_of_relation} class is ",
              "instruction": "Given a {text_a_type} and {text_b_type} classify the {type_of_relation} of the {text_b_type} to one of {classes}.",
              "postprocessors": [
                  "processors.take_first_non_empty_line",
                  "processors.lower_case_till_punc"
              ]
          }
      systemPrompts:
      - name: sp_0
        value: "Be concise. At every point give the shortest acceptable answer."
  logSamples: true

The template.ref points to the custom template's name under the taskList.custom.templates. In this way, a custom artifact can be used by multiple taskRecipes.

@ruivieira
Copy link
Member

/retest

Expand the LMEvalJob CRD to support custom templates and system prompts.
This is mainly for custom unitxt task recipes. Now, users can use the
`template` and `systemPrompt` fields under the `taskRecipes` to specify
the custom template and system prompt.

Signed-off-by: Yihong Wang <[email protected]>
@yhwang yhwang force-pushed the custom-template-prompt branch from 01733ba to ccd0ea2 Compare February 19, 2025 17:07
Copy link

@kiersten-stokes kiersten-stokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to making the custom elements re-usable. This will be super helpful for future features like custom benchmarks

Copy link

openshift-ci bot commented Feb 19, 2025

@kiersten-stokes: changing LGTM is restricted to collaborators

In response to this:

+1 to making the custom elements re-usable. This will be super helpful for future features like custom benchmarks

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci bot added the lgtm label Feb 19, 2025
Copy link

openshift-ci bot commented Feb 19, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kiersten-stokes, ruivieira

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

github-actions bot commented Feb 19, 2025

PR image build and manifest generation completed successfully!

📦 PR image: quay.io/trustyai/trustyai-service-operator-ci:ccd0ea2c1a05e7872831f3503848a6c286b0ad55

📦 LMES driver image: quay.io/trustyai/ta-lmes-driver:ccd0ea2c1a05e7872831f3503848a6c286b0ad55

📦 LMES job image: quay.io/trustyai/ta-lmes-job:ccd0ea2c1a05e7872831f3503848a6c286b0ad55

📦 Guardrails orchestrator image: quay.io/trustyai/ta-guardrails-orchestrator:ccd0ea2c1a05e7872831f3503848a6c286b0ad55

🗂️ CI manifests

devFlags:
  manifests:
    - contextDir: config
      sourcePath: ''
      uri: https://api.github.com/repos/trustyai-explainability/trustyai-service-operator-ci/tarball/operator-ccd0ea2c1a05e7872831f3503848a6c286b0ad55

Copy link

openshift-ci bot commented Feb 19, 2025

@yhwang: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/trustyai-service-operator-e2e ccd0ea2 link true /test trustyai-service-operator-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@ruivieira ruivieira merged commit 6551b6a into trustyai-explainability:main Feb 19, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants