Skip to content

Commit

Permalink
Revert "[HF][fix] Use ParameterizedModelParser instead of ModelParser"
Browse files Browse the repository at this point in the history
  • Loading branch information
rossdanlm authored and Rossdan Craig [email protected] committed Jan 11, 2024
1 parent 1f1421b commit 823241b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
import torch
from transformers import pipeline, Pipeline
from aiconfig_extension_hugging_face.local_inference.util import get_hf_model

from aiconfig import ModelParser, InferenceOptions
from aiconfig.callback import CallbackEvent
from aiconfig.default_parsers.parameterized_model_parser import ParameterizedModelParser
from aiconfig.model_parser import InferenceOptions
from aiconfig.schema import Prompt, Output, ExecuteResult, Attachment

if TYPE_CHECKING:
from aiconfig import AIConfigRuntime


class HuggingFaceAutomaticSpeechRecognitionTransformer(ParameterizedModelParser):
class HuggingFaceAutomaticSpeechRecognitionTransformer(ModelParser):
"""
Model Parser for HuggingFace ASR (Automatic Speech Recognition) models.
"""
Expand Down Expand Up @@ -87,7 +85,7 @@ async def deserialize(
await aiconfig.callback_manager.run_callbacks(CallbackEvent("on_deserialize_complete", __name__, {"output": completion_data}))
return completion_data

async def run_inference(self, prompt: Prompt, aiconfig: "AIConfigRuntime", options: InferenceOptions, parameters: Dict[str, Any]) -> List[Output]:
async def run(self, prompt: Prompt, aiconfig: "AIConfigRuntime", options: InferenceOptions, parameters: Dict[str, Any]) -> list[Output]:
await aiconfig.callback_manager.run_callbacks(
CallbackEvent(
"on_run_start",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

from aiconfig_extension_hugging_face.local_inference.util import get_hf_model

from aiconfig import ModelParser, InferenceOptions
from aiconfig.callback import CallbackEvent
from aiconfig.default_parsers.parameterized_model_parser import ParameterizedModelParser
from aiconfig.model_parser import InferenceOptions
from aiconfig.schema import (
Attachment,
ExecuteResult,
Expand All @@ -25,7 +24,7 @@
from aiconfig import AIConfigRuntime


class HuggingFaceImage2TextTransformer(ParameterizedModelParser):
class HuggingFaceImage2TextTransformer(ModelParser):
def __init__(self):
"""
Returns:
Expand Down Expand Up @@ -118,7 +117,7 @@ async def deserialize(
await aiconfig.callback_manager.run_callbacks(CallbackEvent("on_deserialize_complete", __name__, {"output": completion_params}))
return completion_params

async def run_inference(self, prompt: Prompt, aiconfig: "AIConfigRuntime", options: InferenceOptions, parameters: Dict[str, Any]) -> List[Output]:
async def run(self, prompt: Prompt, aiconfig: "AIConfigRuntime", options: InferenceOptions, parameters: Dict[str, Any]) -> list[Output]:
await aiconfig.callback_manager.run_callbacks(
CallbackEvent(
"on_run_start",
Expand Down

0 comments on commit 823241b

Please sign in to comment.