From 1dc2962a333f66a49c15cc0fcd233a78c84521e7 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 22 Oct 2024 08:48:08 -0700 Subject: [PATCH] kill reward scoring --- llama_stack/apis/reward_scoring/__init__.py | 7 --- .../apis/reward_scoring/reward_scoring.py | 55 ------------------- 2 files changed, 62 deletions(-) delete mode 100644 llama_stack/apis/reward_scoring/__init__.py delete mode 100644 llama_stack/apis/reward_scoring/reward_scoring.py diff --git a/llama_stack/apis/reward_scoring/__init__.py b/llama_stack/apis/reward_scoring/__init__.py deleted file mode 100644 index 7ea62c241..000000000 --- a/llama_stack/apis/reward_scoring/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -from .reward_scoring import * # noqa: F401 F403 diff --git a/llama_stack/apis/reward_scoring/reward_scoring.py b/llama_stack/apis/reward_scoring/reward_scoring.py deleted file mode 100644 index 9d689f232..000000000 --- a/llama_stack/apis/reward_scoring/reward_scoring.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -from typing import List, Protocol, Union - -from llama_models.schema_utils import json_schema_type, webmethod - -from pydantic import BaseModel - -from llama_models.llama3.api.datatypes import * # noqa: F403 - - -@json_schema_type -class ScoredMessage(BaseModel): - message: Message - score: float - - -@json_schema_type -class DialogGenerations(BaseModel): - dialog: List[Message] - sampled_generations: List[Message] - - -@json_schema_type -class ScoredDialogGenerations(BaseModel): - dialog: List[Message] - scored_generations: List[ScoredMessage] - - -@json_schema_type -class RewardScoringRequest(BaseModel): - """Request to score a reward function. A list of prompts and a list of responses per prompt.""" - - dialog_generations: List[DialogGenerations] - model: str - - -@json_schema_type -class RewardScoringResponse(BaseModel): - """Response from the reward scoring. Batch of (prompt, response, score) tuples that pass the threshold.""" - - scored_generations: List[ScoredDialogGenerations] - - -class RewardScoring(Protocol): - @webmethod(route="/reward_scoring/score") - def reward_score( - self, - dialog_generations: List[DialogGenerations], - model: str, - ) -> Union[RewardScoringResponse]: ...