Skip to content

Commit

Permalink
stuff that should be moved back to other PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Feb 12, 2024
1 parent 18d9bee commit 41ccfcc
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/tasks/src/default-widget-inputs.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { WidgetExample } from "./widget-example";
import type { PipelineType } from "./pipelines";
import type { WidgetType } from "./pipelines";

type LanguageCode = string;

type PerLanguageMapping = Map<PipelineType, string[] | WidgetExample[]>;
type PerLanguageMapping = Map<WidgetType, string[] | WidgetExample[]>;

/// NOTE TO CONTRIBUTORS:
///
Expand Down
4 changes: 2 additions & 2 deletions packages/tasks/src/library-to-tasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ModelLibraryKey } from "./model-libraries";
import type { PipelineType } from "./pipelines";
import type { WidgetType } from "./pipelines";

/**
* Mapping from library name (excluding Transformers) to its supported tasks.
Expand All @@ -8,7 +8,7 @@ import type { PipelineType } from "./pipelines";
* This mapping is generated automatically by "python-api-export-tasks" action in huggingface/api-inference-community repo upon merge.
* Ref: https://github.com/huggingface/api-inference-community/pull/158
*/
export const LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS: Partial<Record<ModelLibraryKey, PipelineType[]>> = {
export const LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS: Partial<Record<ModelLibraryKey, WidgetType[]>> = {
"adapter-transformers": ["question-answering", "text-classification", "token-classification"],
allennlp: ["question-answering"],
asteroid: [
Expand Down
1 change: 0 additions & 1 deletion packages/tasks/src/snippets/curl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const curlSnippets: Partial<Record<PipelineType, (model: ModelData, acces
"zero-shot-classification": snippetZeroShotClassification,
translation: snippetBasic,
summarization: snippetBasic,
conversational: snippetBasic,
"feature-extraction": snippetBasic,
"text-generation": snippetBasic,
"text2text-generation": snippetBasic,
Expand Down
8 changes: 0 additions & 8 deletions packages/tasks/src/snippets/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ const inputsTranslation = () => `"Меня зовут Вольфганг и я
const inputsSummarization = () =>
`"The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."`;

const inputsConversational = () =>
`{
"past_user_inputs": ["Which movie is the best ?"],
"generated_responses": ["It is Die Hard for sure."],
"text": "Can you explain why ?"
}`;

const inputsTableQuestionAnswering = () =>
`{
"query": "How many stars does the transformers repository have?",
Expand Down Expand Up @@ -96,7 +89,6 @@ const modelInputSnippets: {
"audio-to-audio": inputsAudioToAudio,
"audio-classification": inputsAudioClassification,
"automatic-speech-recognition": inputsAutomaticSpeechRecognition,
conversational: inputsConversational,
"document-question-answering": inputsVisualQuestionAnswering,
"feature-extraction": inputsFeatureExtraction,
"fill-mask": inputsFillMask,
Expand Down
1 change: 0 additions & 1 deletion packages/tasks/src/snippets/js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export const jsSnippets: Partial<Record<PipelineType, (model: ModelData, accessT
"zero-shot-classification": snippetZeroShotClassification,
translation: snippetBasic,
summarization: snippetBasic,
conversational: snippetBasic,
"feature-extraction": snippetBasic,
"text-generation": snippetBasic,
"text2text-generation": snippetBasic,
Expand Down
1 change: 0 additions & 1 deletion packages/tasks/src/snippets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export const pythonSnippets: Partial<Record<PipelineType, (model: ModelData) =>
"zero-shot-classification": snippetZeroShotClassification,
translation: snippetBasic,
summarization: snippetBasic,
conversational: snippetBasic,
"feature-extraction": snippetBasic,
"text-generation": snippetBasic,
"text2text-generation": snippetBasic,
Expand Down
5 changes: 1 addition & 4 deletions packages/tasks/src/tasks/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { type PipelineType, PIPELINE_DATA } from "../pipelines";
import { PIPELINE_DATA, PipelineType } from "../pipelines";

import audioClassification from "./audio-classification/data";
import audioToAudio from "./audio-to-audio/data";
import automaticSpeechRecognition from "./automatic-speech-recognition/data";
import conversational from "./conversational/data";
import documentQuestionAnswering from "./document-question-answering/data";
import featureExtraction from "./feature-extraction/data";
import fillMask from "./fill-mask/data";
Expand Down Expand Up @@ -45,7 +44,6 @@ export const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]> = {
"audio-classification": ["speechbrain", "transformers", "transformers.js"],
"audio-to-audio": ["asteroid", "speechbrain"],
"automatic-speech-recognition": ["espnet", "nemo", "speechbrain", "transformers", "transformers.js"],
conversational: ["transformers"],
"depth-estimation": ["transformers", "transformers.js"],
"document-question-answering": ["transformers", "transformers.js"],
"feature-extraction": ["sentence-transformers", "transformers", "transformers.js"],
Expand Down Expand Up @@ -122,7 +120,6 @@ export const TASKS_DATA: Record<PipelineType, TaskData | undefined> = {
"audio-classification": getData("audio-classification", audioClassification),
"audio-to-audio": getData("audio-to-audio", audioToAudio),
"automatic-speech-recognition": getData("automatic-speech-recognition", automaticSpeechRecognition),
conversational: getData("conversational", conversational),
"depth-estimation": getData("depth-estimation", depthEstimation),
"document-question-answering": getData("document-question-answering", documentQuestionAnswering),
"feature-extraction": getData("feature-extraction", featureExtraction),
Expand Down

0 comments on commit 41ccfcc

Please sign in to comment.