Skip to content

Commit 3b3ffc0

Browse files
authored
Support Prompt Schemas for Local Models with Task Names (#1110)
# Support Prompt Schemas for Local Models with Task Names In gradio, we'll surface a way for users to use the local model parsers we've created. When they do that, we want the names to be closer to the task name instead of the parser class name. We need to update the promptUtils so that the PromptSchemas are correct for those names. ## Testing: - Updated hf parser registry to ``` automatic_speech_recognition = ( HuggingFaceAutomaticSpeechRecognitionTransformer() ) AIConfigRuntime.register_model_parser( automatic_speech_recognition, "Automatic Speech Recognition (Local)" ) image_to_text = HuggingFaceImage2TextTransformer() AIConfigRuntime.register_model_parser( image_to_text, "Image-to-Text (Local)" ) text_to_image = HuggingFaceText2ImageDiffusor() AIConfigRuntime.register_model_parser( text_to_image, "Text-to-Image (Local)" ) text_to_speech = HuggingFaceText2SpeechTransformer() AIConfigRuntime.register_model_parser( text_to_speech, "Text-to-Speech (Local)" ) text_generation = HuggingFaceTextGenerationTransformer() AIConfigRuntime.register_model_parser( text_generation, "Text Generation (Local)" ) text_summarization = HuggingFaceTextSummarizationTransformer() AIConfigRuntime.register_model_parser( text_summarization, "Summarization (Local)" ) text_translation = HuggingFaceTextTranslationTransformer() AIConfigRuntime.register_model_parser( text_translation, "Translation (Local)" ) ``` Then point to that parser file for the editor. Then, ensured each parser shows up with (Local) name and the prompt schemas are correct
2 parents 0447f15 + b8af9b1 commit 3b3ffc0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

python/src/aiconfig/editor/client/src/utils/promptUtils.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const PROMPT_SCHEMAS: Record<string, PromptSchema> = {
8282
"dall-e-2": DalleImageGenerationParserPromptSchema,
8383
"dall-e-3": DalleImageGenerationParserPromptSchema,
8484

85-
"ClaudeBedrockModelParser": ClaudeBedrockPromptSchema,
85+
ClaudeBedrockModelParser: ClaudeBedrockPromptSchema,
8686

8787
HuggingFaceImage2TextRemoteInference:
8888
HuggingFaceImage2TextRemoteInferencePromptSchema,
@@ -149,6 +149,15 @@ export const PROMPT_SCHEMAS: Record<string, PromptSchema> = {
149149
"Text Generation": HuggingFaceTextGenerationRemoteInferencePromptSchema,
150150
Summarization: HuggingFaceTextSummarizationRemoteInferencePromptSchema,
151151
Translation: HuggingFaceTextTranslationRemoteInferencePromptSchema,
152+
153+
"Automatic Speech Recognition (Local)":
154+
HuggingFaceAutomaticSpeechRecognitionPromptSchema,
155+
"Image-to-Text (Local)": HuggingFaceImage2TextTransformerPromptSchema,
156+
"Text-to-Image (Local)": HuggingFaceText2ImageDiffusorPromptSchema,
157+
"Text-to-Speech (Local)": HuggingFaceText2SpeechTransformerPromptSchema,
158+
"Text Generation (Local)": HuggingFaceTextGenerationTransformerPromptSchema,
159+
"Summarization (Local)": HuggingFaceTextSummarizationTransformerPromptSchema,
160+
"Translation (Local)": HuggingFaceTextGenerationTransformerPromptSchema,
152161
};
153162

154163
export type PromptInputSchema =

0 commit comments

Comments
 (0)