Skip to content

Commit

Permalink
regenerate code
Browse files Browse the repository at this point in the history
  • Loading branch information
SBrandeis committed Jan 26, 2024
1 parent 077a88f commit 1b9c6e2
Show file tree
Hide file tree
Showing 27 changed files with 909 additions and 983 deletions.
62 changes: 30 additions & 32 deletions packages/tasks/src/tasks/audio-classification/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,50 @@
*
* Using src/scripts/inference-codegen
*/

/**
* Inputs for Audio Classification inference
*/
export interface AudioClassificationInput {
/**
* The input audio data
*/
data: unknown;
/**
* Additional inference parameters
*/
parameters?: AudioClassificationParameters;
[property: string]: unknown;
/**
* The input audio data
*/
data: unknown;
/**
* Additional inference parameters
*/
parameters?: AudioClassificationParameters;
[property: string]: unknown;
}

/**
* Additional inference parameters
*
* Additional inference parameters for Audio Classification
*/
export interface AudioClassificationParameters {
/**
* The function to apply to the model outputs in order to retrieve the scores.
*/
functionToApply?: AudioClassificationOutputTransform;
/**
* When specified, limits the output to the top K most probable classes.
*/
topK?: number;
[property: string]: unknown;
/**
* The function to apply to the model outputs in order to retrieve the scores.
*/
functionToApply?: AudioClassificationOutputTransform;
/**
* When specified, limits the output to the top K most probable classes.
*/
topK?: number;
[property: string]: unknown;
}

export type AudioClassificationOutputTransform = "sigmoid" | "softmax" | "none";

export type AudioClassificationOutput = AudioClassificationOutputElement[];
;
/**
* Outputs for Audio Classification inference
*/
export interface AudioClassificationOutput {
/**
* The predicted class label (model specific).
*/
label: string;
/**
* The corresponding probability.
*/
score: number;
[property: string]: unknown;
export interface AudioClassificationOutputElement {
/**
* The predicted class label (model specific).
*/
label: string;
/**
* The corresponding probability.
*/
score: number;
[property: string]: unknown;
}
36 changes: 19 additions & 17 deletions packages/tasks/src/tasks/automatic-speech-recognition/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@
*
* Using src/scripts/inference-codegen
*/

/**
* Inputs for Automatic Speech Recognition inference
*/
export interface AutomaticSpeechRecognitionInput {
/**
* The input audio data
*/
data: unknown;
/**
* Additional inference parameters
*/
parameters?: { [key: string]: unknown };
[property: string]: unknown;
/**
* The input audio data
*/
data: unknown;
/**
* Additional inference parameters
*/
parameters?: {
[key: string]: unknown;
};
[property: string]: unknown;
}

export type AutomaticSpeechRecognitionOutput = AutomaticSpeechRecognitionOutputElement[];
;
/**
* Outputs of inference for the Automatic Speech Recognition task
*/
export interface AutomaticSpeechRecognitionOutput {
/**
* The recognized text.
*/
text: string;
[property: string]: unknown;
export interface AutomaticSpeechRecognitionOutputElement {
/**
* The recognized text.
*/
text: string;
[property: string]: unknown;
}
32 changes: 17 additions & 15 deletions packages/tasks/src/tasks/depth-estimation/inference.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@

/**
* Inference code generated from the JSON schema spec in ./spec
*
*
* Using src/scripts/inference-codegen
*/


export type DepthEstimationOutput = unknown[];

/**
* Inputs for Depth Estimation inference
*/
export interface DepthEstimationInput {
/**
* The input image data
*/
data: unknown;
/**
* Additional inference parameters
*/
parameters?: DepthEstimationParameters;
[property: string]: unknown;
/**
* The input image data
*/
data: unknown;
/**
* Additional inference parameters
*/
parameters?: DepthEstimationParameters;
[property: string]: unknown;
}

/**
Expand All @@ -27,9 +29,9 @@ export interface DepthEstimationInput {
* Additional inference parameters for Depth Estimation
*/
export interface DepthEstimationParameters {
/**
* When specified, limits the output to the top K most probable classes.
*/
topK?: number;
[property: string]: unknown;
/**
* When specified, limits the output to the top K most probable classes.
*/
topK?: number;
[property: string]: unknown;
}
155 changes: 76 additions & 79 deletions packages/tasks/src/tasks/document-question-answering/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,104 +3,101 @@
*
* Using src/scripts/inference-codegen
*/

/**
* Inputs for Document Question Answering inference
*/
export interface DocumentQuestionAnsweringInput {
/**
* One (document, question) pair to answer
*/
data: DocumentQuestionAnsweringInputData;
/**
* Additional inference parameters
*/
parameters?: DocumentQuestionAnsweringParameters;
[property: string]: unknown;
/**
* One (document, question) pair to answer
*/
data: DocumentQuestionAnsweringInputData;
/**
* Additional inference parameters
*/
parameters?: DocumentQuestionAnsweringParameters;
[property: string]: unknown;
}

/**
* One (document, question) pair to answer
*/
export interface DocumentQuestionAnsweringInputData {
/**
* The image on which the question is asked
*/
image: unknown;
/**
* A question to ask of the document
*/
question: string;
[property: string]: unknown;
/**
* The image on which the question is asked
*/
image: unknown;
/**
* A question to ask of the document
*/
question: string;
[property: string]: unknown;
}

/**
* Additional inference parameters
*
* Additional inference parameters for Document Question Answering
*/
export interface DocumentQuestionAnsweringParameters {
/**
* If the words in the document are too long to fit with the question for the model, it will
* be split in several chunks with some overlap. This argument controls the size of that
* overlap.
*/
docStride?: number;
/**
* Whether to accept impossible as an answer
*/
handleImpossibleAnswer?: boolean;
/**
* Language to use while running OCR. Defaults to english.
*/
lang?: string;
/**
* The maximum length of predicted answers (e.g., only answers with a shorter length are
* considered).
*/
maxAnswerLen?: number;
/**
* The maximum length of the question after tokenization. It will be truncated if needed.
*/
maxQuestionLen?: number;
/**
* The maximum length of the total sentence (context + question) in tokens of each chunk
* passed to the model. The context will be split in several chunks (using doc_stride as
* overlap) if needed.
*/
maxSeqLen?: number;
/**
* The number of answers to return (will be chosen by order of likelihood). Can return less
* than top_k answers if there are not enough options available within the context.
*/
topK?: number;
/**
* A list of words and bounding boxes (normalized 0->1000). If provided, the inference will
* skip the OCR step and use the provided bounding boxes instead.
*/
wordBoxes?: WordBox[];
[property: string]: unknown;
/**
* If the words in the document are too long to fit with the question for the model, it will
* be split in several chunks with some overlap. This argument controls the size of that
* overlap.
*/
docStride?: number;
/**
* Whether to accept impossible as an answer
*/
handleImpossibleAnswer?: boolean;
/**
* Language to use while running OCR. Defaults to english.
*/
lang?: string;
/**
* The maximum length of predicted answers (e.g., only answers with a shorter length are
* considered).
*/
maxAnswerLen?: number;
/**
* The maximum length of the question after tokenization. It will be truncated if needed.
*/
maxQuestionLen?: number;
/**
* The maximum length of the total sentence (context + question) in tokens of each chunk
* passed to the model. The context will be split in several chunks (using doc_stride as
* overlap) if needed.
*/
maxSeqLen?: number;
/**
* The number of answers to return (will be chosen by order of likelihood). Can return less
* than top_k answers if there are not enough options available within the context.
*/
topK?: number;
/**
* A list of words and bounding boxes (normalized 0->1000). If provided, the inference will
* skip the OCR step and use the provided bounding boxes instead.
*/
wordBoxes?: WordBox[];
[property: string]: unknown;
}

export type WordBox = number[] | string;

export type DocumentQuestionAnsweringOutput = DocumentQuestionAnsweringOutputElement[];
;
/**
* Outputs of inference for the Document Question Answering task
*/
export interface DocumentQuestionAnsweringOutput {
/**
* The answer to the question.
*/
answer: string;
end: number;
/**
* The probability associated to the answer.
*/
score: number;
start: number;
/**
* The index of each word/box pair that is in the answer
*/
words: number[];
[property: string]: unknown;
export interface DocumentQuestionAnsweringOutputElement {
/**
* The answer to the question.
*/
answer: string;
end: number;
/**
* The probability associated to the answer.
*/
score: number;
start: number;
/**
* The index of each word/box pair that is in the answer
*/
words: number[];
[property: string]: unknown;
}
22 changes: 12 additions & 10 deletions packages/tasks/src/tasks/feature-extraction/inference.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@

/**
* Inference code generated from the JSON schema spec in ./spec
*
*
* Using src/scripts/inference-codegen
*/


export type FeatureExtractionOutput = unknown[];

/**
* Inputs for Text Embedding inference
*/
export interface FeatureExtractionInput {
/**
* The text to get the embeddings of
*/
data: string;
/**
* Additional inference parameters
*/
parameters?: { [key: string]: unknown };
[property: string]: unknown;
/**
* The text to get the embeddings of
*/
data: string;
/**
* Additional inference parameters
*/
parameters?: { [key: string]: unknown };
[property: string]: unknown;
}
Loading

0 comments on commit 1b9c6e2

Please sign in to comment.