@huggingface/tasks 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -14
- package/dist/index.cjs +91 -18
- package/dist/index.js +90 -18
- package/dist/scripts/inference-codegen.d.ts +2 -0
- package/dist/scripts/inference-codegen.d.ts.map +1 -0
- package/dist/scripts/inference-tgi-import.d.ts +2 -0
- package/dist/scripts/inference-tgi-import.d.ts.map +1 -0
- package/dist/src/default-widget-inputs.d.ts +6 -0
- package/dist/src/default-widget-inputs.d.ts.map +1 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/library-to-tasks.d.ts +11 -0
- package/dist/src/library-to-tasks.d.ts.map +1 -0
- package/dist/src/local-apps.d.ts +104 -0
- package/dist/src/local-apps.d.ts.map +1 -0
- package/dist/src/model-data.d.ts +144 -0
- package/dist/src/model-data.d.ts.map +1 -0
- package/dist/src/model-libraries-downloads.d.ts +26 -0
- package/dist/src/model-libraries-downloads.d.ts.map +1 -0
- package/dist/src/model-libraries-snippets.d.ts +43 -0
- package/dist/src/model-libraries-snippets.d.ts.map +1 -0
- package/dist/src/model-libraries.d.ts +490 -0
- package/dist/src/model-libraries.d.ts.map +1 -0
- package/dist/src/pipelines.d.ts +404 -0
- package/dist/src/pipelines.d.ts.map +1 -0
- package/dist/src/snippets/curl.d.ts +9 -0
- package/dist/src/snippets/curl.d.ts.map +1 -0
- package/dist/src/snippets/index.d.ts +6 -0
- package/dist/src/snippets/index.d.ts.map +1 -0
- package/dist/src/snippets/inputs.d.ts +3 -0
- package/dist/src/snippets/inputs.d.ts.map +1 -0
- package/dist/src/snippets/js.d.ts +11 -0
- package/dist/src/snippets/js.d.ts.map +1 -0
- package/dist/src/snippets/python.d.ts +14 -0
- package/dist/src/snippets/python.d.ts.map +1 -0
- package/dist/src/snippets/types.d.ts +8 -0
- package/dist/src/snippets/types.d.ts.map +1 -0
- package/dist/src/tasks/audio-classification/data.d.ts +4 -0
- package/dist/src/tasks/audio-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/audio-classification/inference.d.ts +52 -0
- package/dist/src/tasks/audio-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/audio-to-audio/data.d.ts +4 -0
- package/dist/src/tasks/audio-to-audio/data.d.ts.map +1 -0
- package/dist/src/tasks/automatic-speech-recognition/data.d.ts +4 -0
- package/dist/src/tasks/automatic-speech-recognition/data.d.ts.map +1 -0
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +154 -0
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts.map +1 -0
- package/dist/src/tasks/chat-completion/inference.d.ts +254 -0
- package/dist/src/tasks/chat-completion/inference.d.ts.map +1 -0
- package/dist/src/tasks/depth-estimation/data.d.ts +4 -0
- package/dist/src/tasks/depth-estimation/data.d.ts.map +1 -0
- package/dist/src/tasks/depth-estimation/inference.d.ts +36 -0
- package/dist/src/tasks/depth-estimation/inference.d.ts.map +1 -0
- package/dist/src/tasks/document-question-answering/data.d.ts +4 -0
- package/dist/src/tasks/document-question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/document-question-answering/inference.d.ts +111 -0
- package/dist/src/tasks/document-question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/feature-extraction/data.d.ts +4 -0
- package/dist/src/tasks/feature-extraction/data.d.ts.map +1 -0
- package/dist/src/tasks/feature-extraction/inference.d.ts +23 -0
- package/dist/src/tasks/feature-extraction/inference.d.ts.map +1 -0
- package/dist/src/tasks/fill-mask/data.d.ts +4 -0
- package/dist/src/tasks/fill-mask/data.d.ts.map +1 -0
- package/dist/src/tasks/fill-mask/inference.d.ts +63 -0
- package/dist/src/tasks/fill-mask/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-classification/data.d.ts +4 -0
- package/dist/src/tasks/image-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/image-classification/inference.d.ts +52 -0
- package/dist/src/tasks/image-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-feature-extraction/data.d.ts +4 -0
- package/dist/src/tasks/image-feature-extraction/data.d.ts.map +1 -0
- package/dist/src/tasks/image-segmentation/data.d.ts +4 -0
- package/dist/src/tasks/image-segmentation/data.d.ts.map +1 -0
- package/dist/src/tasks/image-segmentation/inference.d.ts +66 -0
- package/dist/src/tasks/image-segmentation/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-to-image/data.d.ts +4 -0
- package/dist/src/tasks/image-to-image/data.d.ts.map +1 -0
- package/dist/src/tasks/image-to-image/inference.d.ts +64 -0
- package/dist/src/tasks/image-to-image/inference.d.ts.map +1 -0
- package/dist/src/tasks/image-to-text/data.d.ts +4 -0
- package/dist/src/tasks/image-to-text/data.d.ts.map +1 -0
- package/dist/src/tasks/image-to-text/inference.d.ts +139 -0
- package/dist/src/tasks/image-to-text/inference.d.ts.map +1 -0
- package/dist/src/tasks/index.d.ts +87 -0
- package/dist/src/tasks/index.d.ts.map +1 -0
- package/dist/src/tasks/mask-generation/data.d.ts +4 -0
- package/dist/src/tasks/mask-generation/data.d.ts.map +1 -0
- package/dist/src/tasks/object-detection/data.d.ts +4 -0
- package/dist/src/tasks/object-detection/data.d.ts.map +1 -0
- package/dist/src/tasks/object-detection/inference.d.ts +63 -0
- package/dist/src/tasks/object-detection/inference.d.ts.map +1 -0
- package/dist/src/tasks/placeholder/data.d.ts +4 -0
- package/dist/src/tasks/placeholder/data.d.ts.map +1 -0
- package/dist/src/tasks/question-answering/data.d.ts +4 -0
- package/dist/src/tasks/question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/question-answering/inference.d.ts +100 -0
- package/dist/src/tasks/question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/reinforcement-learning/data.d.ts +4 -0
- package/dist/src/tasks/reinforcement-learning/data.d.ts.map +1 -0
- package/dist/src/tasks/sentence-similarity/data.d.ts +4 -0
- package/dist/src/tasks/sentence-similarity/data.d.ts.map +1 -0
- package/dist/src/tasks/sentence-similarity/inference.d.ts +32 -0
- package/dist/src/tasks/sentence-similarity/inference.d.ts.map +1 -0
- package/dist/src/tasks/summarization/data.d.ts +4 -0
- package/dist/src/tasks/summarization/data.d.ts.map +1 -0
- package/dist/src/tasks/summarization/inference.d.ts +55 -0
- package/dist/src/tasks/summarization/inference.d.ts.map +1 -0
- package/dist/src/tasks/table-question-answering/data.d.ts +4 -0
- package/dist/src/tasks/table-question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/table-question-answering/inference.d.ts +62 -0
- package/dist/src/tasks/table-question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/tabular-classification/data.d.ts +4 -0
- package/dist/src/tasks/tabular-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/tabular-regression/data.d.ts +4 -0
- package/dist/src/tasks/tabular-regression/data.d.ts.map +1 -0
- package/dist/src/tasks/text-classification/data.d.ts +4 -0
- package/dist/src/tasks/text-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/text-classification/inference.d.ts +52 -0
- package/dist/src/tasks/text-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-generation/data.d.ts +4 -0
- package/dist/src/tasks/text-generation/data.d.ts.map +1 -0
- package/dist/src/tasks/text-generation/inference.d.ts +126 -0
- package/dist/src/tasks/text-generation/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-audio/inference.d.ts +139 -0
- package/dist/src/tasks/text-to-audio/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-image/data.d.ts +4 -0
- package/dist/src/tasks/text-to-image/data.d.ts.map +1 -0
- package/dist/src/tasks/text-to-image/inference.d.ts +68 -0
- package/dist/src/tasks/text-to-image/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-speech/data.d.ts +4 -0
- package/dist/src/tasks/text-to-speech/data.d.ts.map +1 -0
- package/dist/src/tasks/text-to-speech/inference.d.ts +143 -0
- package/dist/src/tasks/text-to-speech/inference.d.ts.map +1 -0
- package/dist/src/tasks/text-to-video/data.d.ts +4 -0
- package/dist/src/tasks/text-to-video/data.d.ts.map +1 -0
- package/dist/src/tasks/text2text-generation/inference.d.ts +54 -0
- package/dist/src/tasks/text2text-generation/inference.d.ts.map +1 -0
- package/dist/src/tasks/token-classification/data.d.ts +4 -0
- package/dist/src/tasks/token-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/token-classification/inference.d.ts +83 -0
- package/dist/src/tasks/token-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/translation/data.d.ts +4 -0
- package/dist/src/tasks/translation/data.d.ts.map +1 -0
- package/dist/src/tasks/translation/inference.d.ts +55 -0
- package/dist/src/tasks/translation/inference.d.ts.map +1 -0
- package/dist/src/tasks/unconditional-image-generation/data.d.ts +4 -0
- package/dist/src/tasks/unconditional-image-generation/data.d.ts.map +1 -0
- package/dist/src/tasks/video-classification/data.d.ts +4 -0
- package/dist/src/tasks/video-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/video-classification/inference.d.ts +60 -0
- package/dist/src/tasks/video-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/visual-question-answering/data.d.ts +4 -0
- package/dist/src/tasks/visual-question-answering/data.d.ts.map +1 -0
- package/dist/src/tasks/visual-question-answering/inference.d.ts +64 -0
- package/dist/src/tasks/visual-question-answering/inference.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-classification/data.d.ts +4 -0
- package/dist/src/tasks/zero-shot-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-classification/inference.d.ts +68 -0
- package/dist/src/tasks/zero-shot-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-image-classification/data.d.ts +4 -0
- package/dist/src/tasks/zero-shot-image-classification/data.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-image-classification/inference.d.ts +62 -0
- package/dist/src/tasks/zero-shot-image-classification/inference.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-object-detection/data.d.ts +4 -0
- package/dist/src/tasks/zero-shot-object-detection/data.d.ts.map +1 -0
- package/dist/src/tasks/zero-shot-object-detection/inference.d.ts +67 -0
- package/dist/src/tasks/zero-shot-object-detection/inference.d.ts.map +1 -0
- package/dist/src/tokenizer-data.d.ts +26 -0
- package/dist/src/tokenizer-data.d.ts.map +1 -0
- package/dist/src/widget-example.d.ts +86 -0
- package/dist/src/widget-example.d.ts.map +1 -0
- package/package.json +11 -6
- package/src/index.ts +3 -0
- package/src/local-apps.ts +119 -0
- package/src/model-data.ts +1 -5
- package/src/model-libraries-snippets.ts +21 -18
- package/src/model-libraries.ts +9 -0
- package/src/tasks/chat-completion/inference.ts +204 -85
- package/src/tasks/chat-completion/spec/input.json +198 -34
- package/src/tasks/chat-completion/spec/output.json +178 -40
- package/src/tasks/chat-completion/spec/stream_output.json +170 -0
- package/src/tasks/index.ts +7 -8
- package/src/tasks/text-generation/inference.ts +58 -170
- package/src/tasks/text-generation/spec/input.json +130 -29
- package/src/tasks/text-generation/spec/output.json +104 -90
- package/src/tasks/text-generation/spec/stream_output.json +97 -0
- package/tsconfig.json +3 -1
- package/dist/index.d.ts +0 -3531
- package/src/tasks/chat-completion/spec/output_stream.json +0 -48
- package/src/tasks/text-generation/spec/output_stream.json +0 -47
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Inputs for Automatic Speech Recognition inference
|
|
8
|
+
*/
|
|
9
|
+
export interface AutomaticSpeechRecognitionInput {
|
|
10
|
+
/**
|
|
11
|
+
* The input audio data
|
|
12
|
+
*/
|
|
13
|
+
inputs: unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Additional inference parameters
|
|
16
|
+
*/
|
|
17
|
+
parameters?: AutomaticSpeechRecognitionParameters;
|
|
18
|
+
[property: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Additional inference parameters
|
|
22
|
+
*
|
|
23
|
+
* Additional inference parameters for Automatic Speech Recognition
|
|
24
|
+
*/
|
|
25
|
+
export interface AutomaticSpeechRecognitionParameters {
|
|
26
|
+
/**
|
|
27
|
+
* Parametrization of the text generation process
|
|
28
|
+
*/
|
|
29
|
+
generate?: GenerationParameters;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to output corresponding timestamps with the generated text
|
|
32
|
+
*/
|
|
33
|
+
return_timestamps?: boolean;
|
|
34
|
+
[property: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parametrization of the text generation process
|
|
38
|
+
*
|
|
39
|
+
* Ad-hoc parametrization of the text generation process
|
|
40
|
+
*/
|
|
41
|
+
export interface GenerationParameters {
|
|
42
|
+
/**
|
|
43
|
+
* Whether to use sampling instead of greedy decoding when generating new tokens.
|
|
44
|
+
*/
|
|
45
|
+
do_sample?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Controls the stopping condition for beam-based methods.
|
|
48
|
+
*/
|
|
49
|
+
early_stopping?: EarlyStoppingUnion;
|
|
50
|
+
/**
|
|
51
|
+
* If set to float strictly between 0 and 1, only tokens with a conditional probability
|
|
52
|
+
* greater than epsilon_cutoff will be sampled. In the paper, suggested values range from
|
|
53
|
+
* 3e-4 to 9e-4, depending on the size of the model. See [Truncation Sampling as Language
|
|
54
|
+
* Model Desmoothing](https://hf.co/papers/2210.15191) for more details.
|
|
55
|
+
*/
|
|
56
|
+
epsilon_cutoff?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Eta sampling is a hybrid of locally typical sampling and epsilon sampling. If set to
|
|
59
|
+
* float strictly between 0 and 1, a token is only considered if it is greater than either
|
|
60
|
+
* eta_cutoff or sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits))). The latter
|
|
61
|
+
* term is intuitively the expected next token probability, scaled by sqrt(eta_cutoff). In
|
|
62
|
+
* the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
|
|
63
|
+
* See [Truncation Sampling as Language Model Desmoothing](https://hf.co/papers/2210.15191)
|
|
64
|
+
* for more details.
|
|
65
|
+
*/
|
|
66
|
+
eta_cutoff?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The maximum length (in tokens) of the generated text, including the input.
|
|
69
|
+
*/
|
|
70
|
+
max_length?: number;
|
|
71
|
+
/**
|
|
72
|
+
* The maximum number of tokens to generate. Takes precedence over maxLength.
|
|
73
|
+
*/
|
|
74
|
+
max_new_tokens?: number;
|
|
75
|
+
/**
|
|
76
|
+
* The minimum length (in tokens) of the generated text, including the input.
|
|
77
|
+
*/
|
|
78
|
+
min_length?: number;
|
|
79
|
+
/**
|
|
80
|
+
* The minimum number of tokens to generate. Takes precedence over maxLength.
|
|
81
|
+
*/
|
|
82
|
+
min_new_tokens?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Number of groups to divide num_beams into in order to ensure diversity among different
|
|
85
|
+
* groups of beams. See [this paper](https://hf.co/papers/1610.02424) for more details.
|
|
86
|
+
*/
|
|
87
|
+
num_beam_groups?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Number of beams to use for beam search.
|
|
90
|
+
*/
|
|
91
|
+
num_beams?: number;
|
|
92
|
+
/**
|
|
93
|
+
* The value balances the model confidence and the degeneration penalty in contrastive
|
|
94
|
+
* search decoding.
|
|
95
|
+
*/
|
|
96
|
+
penalty_alpha?: number;
|
|
97
|
+
/**
|
|
98
|
+
* The value used to modulate the next token probabilities.
|
|
99
|
+
*/
|
|
100
|
+
temperature?: number;
|
|
101
|
+
/**
|
|
102
|
+
* The number of highest probability vocabulary tokens to keep for top-k-filtering.
|
|
103
|
+
*/
|
|
104
|
+
top_k?: number;
|
|
105
|
+
/**
|
|
106
|
+
* If set to float < 1, only the smallest set of most probable tokens with probabilities
|
|
107
|
+
* that add up to top_p or higher are kept for generation.
|
|
108
|
+
*/
|
|
109
|
+
top_p?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Local typicality measures how similar the conditional probability of predicting a target
|
|
112
|
+
* token next is to the expected conditional probability of predicting a random token next,
|
|
113
|
+
* given the partial text already generated. If set to float < 1, the smallest set of the
|
|
114
|
+
* most locally typical tokens with probabilities that add up to typical_p or higher are
|
|
115
|
+
* kept for generation. See [this paper](https://hf.co/papers/2202.00666) for more details.
|
|
116
|
+
*/
|
|
117
|
+
typical_p?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Whether the model should use the past last key/values attentions to speed up decoding
|
|
120
|
+
*/
|
|
121
|
+
use_cache?: boolean;
|
|
122
|
+
[property: string]: unknown;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Controls the stopping condition for beam-based methods.
|
|
126
|
+
*/
|
|
127
|
+
export type EarlyStoppingUnion = boolean | "never";
|
|
128
|
+
/**
|
|
129
|
+
* Outputs of inference for the Automatic Speech Recognition task
|
|
130
|
+
*/
|
|
131
|
+
export interface AutomaticSpeechRecognitionOutput {
|
|
132
|
+
/**
|
|
133
|
+
* When returnTimestamps is enabled, chunks contains a list of audio chunks identified by
|
|
134
|
+
* the model.
|
|
135
|
+
*/
|
|
136
|
+
chunks?: AutomaticSpeechRecognitionOutputChunk[];
|
|
137
|
+
/**
|
|
138
|
+
* The recognized text.
|
|
139
|
+
*/
|
|
140
|
+
text: string;
|
|
141
|
+
[property: string]: unknown;
|
|
142
|
+
}
|
|
143
|
+
export interface AutomaticSpeechRecognitionOutputChunk {
|
|
144
|
+
/**
|
|
145
|
+
* A chunk of text identified by the model
|
|
146
|
+
*/
|
|
147
|
+
text: string;
|
|
148
|
+
/**
|
|
149
|
+
* The start and end timestamps corresponding with the text
|
|
150
|
+
*/
|
|
151
|
+
timestamps: number[];
|
|
152
|
+
[property: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/automatic-speech-recognition/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA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,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAChD;;;OAGG;IACH,MAAM,CAAC,EAAE,qCAAqC,EAAE,CAAC;IACjD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,qCAAqC;IACrD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Chat Completion Input.
|
|
8
|
+
*
|
|
9
|
+
* Auto-generated from TGI specs.
|
|
10
|
+
* For more details, check out
|
|
11
|
+
* https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.
|
|
12
|
+
*/
|
|
13
|
+
export interface ChatCompletionInput {
|
|
14
|
+
/**
|
|
15
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing
|
|
16
|
+
* frequency in the text so far,
|
|
17
|
+
* decreasing the model's likelihood to repeat the same line verbatim.
|
|
18
|
+
*/
|
|
19
|
+
frequency_penalty?: number;
|
|
20
|
+
/**
|
|
21
|
+
* UNUSED
|
|
22
|
+
* Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON
|
|
23
|
+
* object that maps tokens
|
|
24
|
+
* (specified by their token ID in the tokenizer) to an associated bias value from -100 to
|
|
25
|
+
* 100. Mathematically,
|
|
26
|
+
* the bias is added to the logits generated by the model prior to sampling. The exact
|
|
27
|
+
* effect will vary per model,
|
|
28
|
+
* but values between -1 and 1 should decrease or increase likelihood of selection; values
|
|
29
|
+
* like -100 or 100 should
|
|
30
|
+
* result in a ban or exclusive selection of the relevant token.
|
|
31
|
+
*/
|
|
32
|
+
logit_bias?: number[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether to return log probabilities of the output tokens or not. If true, returns the log
|
|
35
|
+
* probabilities of each
|
|
36
|
+
* output token returned in the content of message.
|
|
37
|
+
*/
|
|
38
|
+
logprobs?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* The maximum number of tokens that can be generated in the chat completion.
|
|
41
|
+
*/
|
|
42
|
+
max_tokens?: number;
|
|
43
|
+
/**
|
|
44
|
+
* A list of messages comprising the conversation so far.
|
|
45
|
+
*/
|
|
46
|
+
messages: ChatCompletionInputMessage[];
|
|
47
|
+
/**
|
|
48
|
+
* [UNUSED] ID of the model to use. See the model endpoint compatibility table for details
|
|
49
|
+
* on which models work with the Chat API.
|
|
50
|
+
*/
|
|
51
|
+
model: string;
|
|
52
|
+
/**
|
|
53
|
+
* UNUSED
|
|
54
|
+
* How many chat completion choices to generate for each input message. Note that you will
|
|
55
|
+
* be charged based on the
|
|
56
|
+
* number of generated tokens across all of the choices. Keep n as 1 to minimize costs.
|
|
57
|
+
*/
|
|
58
|
+
n?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they
|
|
61
|
+
* appear in the text so far,
|
|
62
|
+
* increasing the model's likelihood to talk about new topics
|
|
63
|
+
*/
|
|
64
|
+
presence_penalty?: number;
|
|
65
|
+
seed?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Up to 4 sequences where the API will stop generating further tokens.
|
|
68
|
+
*/
|
|
69
|
+
stop?: string[];
|
|
70
|
+
stream?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the
|
|
73
|
+
* output more random, while
|
|
74
|
+
* lower values like 0.2 will make it more focused and deterministic.
|
|
75
|
+
*
|
|
76
|
+
* We generally recommend altering this or `top_p` but not both.
|
|
77
|
+
*/
|
|
78
|
+
temperature?: number;
|
|
79
|
+
tool_choice?: ChatCompletionInputToolType;
|
|
80
|
+
/**
|
|
81
|
+
* A prompt to be appended before the tools
|
|
82
|
+
*/
|
|
83
|
+
tool_prompt?: string;
|
|
84
|
+
/**
|
|
85
|
+
* A list of tools the model may call. Currently, only functions are supported as a tool.
|
|
86
|
+
* Use this to provide a list of
|
|
87
|
+
* functions the model may generate JSON inputs for.
|
|
88
|
+
*/
|
|
89
|
+
tools?: ChatCompletionInputTool[];
|
|
90
|
+
/**
|
|
91
|
+
* An integer between 0 and 5 specifying the number of most likely tokens to return at each
|
|
92
|
+
* token position, each with
|
|
93
|
+
* an associated log probability. logprobs must be set to true if this parameter is used.
|
|
94
|
+
*/
|
|
95
|
+
top_logprobs?: number;
|
|
96
|
+
/**
|
|
97
|
+
* An alternative to sampling with temperature, called nucleus sampling, where the model
|
|
98
|
+
* considers the results of the
|
|
99
|
+
* tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10%
|
|
100
|
+
* probability mass are considered.
|
|
101
|
+
*/
|
|
102
|
+
top_p?: number;
|
|
103
|
+
[property: string]: unknown;
|
|
104
|
+
}
|
|
105
|
+
export interface ChatCompletionInputMessage {
|
|
106
|
+
content?: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
role: string;
|
|
109
|
+
tool_calls?: ChatCompletionInputToolCall[];
|
|
110
|
+
[property: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
export interface ChatCompletionInputToolCall {
|
|
113
|
+
function: ChatCompletionInputFunctionDefinition;
|
|
114
|
+
id: number;
|
|
115
|
+
type: string;
|
|
116
|
+
[property: string]: unknown;
|
|
117
|
+
}
|
|
118
|
+
export interface ChatCompletionInputFunctionDefinition {
|
|
119
|
+
arguments: unknown;
|
|
120
|
+
description?: string;
|
|
121
|
+
name: string;
|
|
122
|
+
[property: string]: unknown;
|
|
123
|
+
}
|
|
124
|
+
export type ChatCompletionInputToolType = "OneOf" | ChatCompletionInputToolTypeObject;
|
|
125
|
+
export interface ChatCompletionInputToolTypeObject {
|
|
126
|
+
FunctionName: string;
|
|
127
|
+
[property: string]: unknown;
|
|
128
|
+
}
|
|
129
|
+
export interface ChatCompletionInputTool {
|
|
130
|
+
function: ChatCompletionInputFunctionDefinition;
|
|
131
|
+
type: string;
|
|
132
|
+
[property: string]: unknown;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Chat Completion Output.
|
|
136
|
+
*
|
|
137
|
+
* Auto-generated from TGI specs.
|
|
138
|
+
* For more details, check out
|
|
139
|
+
* https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.
|
|
140
|
+
*/
|
|
141
|
+
export interface ChatCompletionOutput {
|
|
142
|
+
choices: ChatCompletionOutputComplete[];
|
|
143
|
+
created: number;
|
|
144
|
+
id: string;
|
|
145
|
+
model: string;
|
|
146
|
+
object: string;
|
|
147
|
+
system_fingerprint: string;
|
|
148
|
+
usage: ChatCompletionOutputUsage;
|
|
149
|
+
[property: string]: unknown;
|
|
150
|
+
}
|
|
151
|
+
export interface ChatCompletionOutputComplete {
|
|
152
|
+
finish_reason: string;
|
|
153
|
+
index: number;
|
|
154
|
+
logprobs?: ChatCompletionOutputLogprobs;
|
|
155
|
+
message: ChatCompletionOutputMessage;
|
|
156
|
+
[property: string]: unknown;
|
|
157
|
+
}
|
|
158
|
+
export interface ChatCompletionOutputLogprobs {
|
|
159
|
+
content: ChatCompletionOutputLogprob[];
|
|
160
|
+
[property: string]: unknown;
|
|
161
|
+
}
|
|
162
|
+
export interface ChatCompletionOutputLogprob {
|
|
163
|
+
logprob: number;
|
|
164
|
+
token: string;
|
|
165
|
+
top_logprobs: ChatCompletionOutputTopLogprob[];
|
|
166
|
+
[property: string]: unknown;
|
|
167
|
+
}
|
|
168
|
+
export interface ChatCompletionOutputTopLogprob {
|
|
169
|
+
logprob: number;
|
|
170
|
+
token: string;
|
|
171
|
+
[property: string]: unknown;
|
|
172
|
+
}
|
|
173
|
+
export interface ChatCompletionOutputMessage {
|
|
174
|
+
content?: string;
|
|
175
|
+
name?: string;
|
|
176
|
+
role: string;
|
|
177
|
+
tool_calls?: ChatCompletionOutputToolCall[];
|
|
178
|
+
[property: string]: unknown;
|
|
179
|
+
}
|
|
180
|
+
export interface ChatCompletionOutputToolCall {
|
|
181
|
+
function: ChatCompletionOutputFunctionDefinition;
|
|
182
|
+
id: number;
|
|
183
|
+
type: string;
|
|
184
|
+
[property: string]: unknown;
|
|
185
|
+
}
|
|
186
|
+
export interface ChatCompletionOutputFunctionDefinition {
|
|
187
|
+
arguments: unknown;
|
|
188
|
+
description?: string;
|
|
189
|
+
name: string;
|
|
190
|
+
[property: string]: unknown;
|
|
191
|
+
}
|
|
192
|
+
export interface ChatCompletionOutputUsage {
|
|
193
|
+
completion_tokens: number;
|
|
194
|
+
prompt_tokens: number;
|
|
195
|
+
total_tokens: number;
|
|
196
|
+
[property: string]: unknown;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Chat Completion Stream Output.
|
|
200
|
+
*
|
|
201
|
+
* Auto-generated from TGI specs.
|
|
202
|
+
* For more details, check out
|
|
203
|
+
* https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/scripts/inference-tgi-import.ts.
|
|
204
|
+
*/
|
|
205
|
+
export interface ChatCompletionStreamOutput {
|
|
206
|
+
choices: ChatCompletionStreamOutputChoice[];
|
|
207
|
+
created: number;
|
|
208
|
+
id: string;
|
|
209
|
+
model: string;
|
|
210
|
+
object: string;
|
|
211
|
+
system_fingerprint: string;
|
|
212
|
+
[property: string]: unknown;
|
|
213
|
+
}
|
|
214
|
+
export interface ChatCompletionStreamOutputChoice {
|
|
215
|
+
delta: ChatCompletionStreamOutputDelta;
|
|
216
|
+
finish_reason?: string;
|
|
217
|
+
index: number;
|
|
218
|
+
logprobs?: ChatCompletionStreamOutputLogprobs;
|
|
219
|
+
[property: string]: unknown;
|
|
220
|
+
}
|
|
221
|
+
export interface ChatCompletionStreamOutputDelta {
|
|
222
|
+
content?: string;
|
|
223
|
+
role: string;
|
|
224
|
+
tool_calls?: ChatCompletionStreamOutputDeltaToolCall;
|
|
225
|
+
[property: string]: unknown;
|
|
226
|
+
}
|
|
227
|
+
export interface ChatCompletionStreamOutputDeltaToolCall {
|
|
228
|
+
function: ChatCompletionStreamOutputFunction;
|
|
229
|
+
id: string;
|
|
230
|
+
index: number;
|
|
231
|
+
type: string;
|
|
232
|
+
[property: string]: unknown;
|
|
233
|
+
}
|
|
234
|
+
export interface ChatCompletionStreamOutputFunction {
|
|
235
|
+
arguments: string;
|
|
236
|
+
name?: string;
|
|
237
|
+
[property: string]: unknown;
|
|
238
|
+
}
|
|
239
|
+
export interface ChatCompletionStreamOutputLogprobs {
|
|
240
|
+
content: ChatCompletionStreamOutputLogprob[];
|
|
241
|
+
[property: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
export interface ChatCompletionStreamOutputLogprob {
|
|
244
|
+
logprob: number;
|
|
245
|
+
token: string;
|
|
246
|
+
top_logprobs: ChatCompletionStreamOutputTopLogprob[];
|
|
247
|
+
[property: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
export interface ChatCompletionStreamOutputTopLogprob {
|
|
250
|
+
logprob: number;
|
|
251
|
+
token: string;
|
|
252
|
+
[property: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/chat-completion/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MA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0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/tasks/depth-estimation/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEzC,QAAA,MAAM,QAAQ,EAAE,cAqDf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Inputs for Depth Estimation inference
|
|
8
|
+
*/
|
|
9
|
+
export interface DepthEstimationInput {
|
|
10
|
+
/**
|
|
11
|
+
* The input image data
|
|
12
|
+
*/
|
|
13
|
+
inputs: unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Additional inference parameters
|
|
16
|
+
*/
|
|
17
|
+
parameters?: {
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
[property: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Outputs of inference for the Depth Estimation task
|
|
24
|
+
*/
|
|
25
|
+
export interface DepthEstimationOutput {
|
|
26
|
+
/**
|
|
27
|
+
* The predicted depth as an image
|
|
28
|
+
*/
|
|
29
|
+
depth?: unknown;
|
|
30
|
+
/**
|
|
31
|
+
* The predicted depth as a tensor
|
|
32
|
+
*/
|
|
33
|
+
predicted_depth?: unknown;
|
|
34
|
+
[property: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/depth-estimation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACxC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/tasks/document-question-answering/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEzC,QAAA,MAAM,QAAQ,EAAE,cAyEf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Inputs for Document Question Answering inference
|
|
8
|
+
*/
|
|
9
|
+
export interface DocumentQuestionAnsweringInput {
|
|
10
|
+
/**
|
|
11
|
+
* One (document, question) pair to answer
|
|
12
|
+
*/
|
|
13
|
+
inputs: DocumentQuestionAnsweringInputData;
|
|
14
|
+
/**
|
|
15
|
+
* Additional inference parameters
|
|
16
|
+
*/
|
|
17
|
+
parameters?: DocumentQuestionAnsweringParameters;
|
|
18
|
+
[property: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One (document, question) pair to answer
|
|
22
|
+
*/
|
|
23
|
+
export interface DocumentQuestionAnsweringInputData {
|
|
24
|
+
/**
|
|
25
|
+
* The image on which the question is asked
|
|
26
|
+
*/
|
|
27
|
+
image: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* A question to ask of the document
|
|
30
|
+
*/
|
|
31
|
+
question: string;
|
|
32
|
+
[property: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Additional inference parameters
|
|
36
|
+
*
|
|
37
|
+
* Additional inference parameters for Document Question Answering
|
|
38
|
+
*/
|
|
39
|
+
export interface DocumentQuestionAnsweringParameters {
|
|
40
|
+
/**
|
|
41
|
+
* If the words in the document are too long to fit with the question for the model, it will
|
|
42
|
+
* be split in several chunks with some overlap. This argument controls the size of that
|
|
43
|
+
* overlap.
|
|
44
|
+
*/
|
|
45
|
+
doc_stride?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to accept impossible as an answer
|
|
48
|
+
*/
|
|
49
|
+
handle_impossible_answer?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Language to use while running OCR. Defaults to english.
|
|
52
|
+
*/
|
|
53
|
+
lang?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The maximum length of predicted answers (e.g., only answers with a shorter length are
|
|
56
|
+
* considered).
|
|
57
|
+
*/
|
|
58
|
+
max_answer_len?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The maximum length of the question after tokenization. It will be truncated if needed.
|
|
61
|
+
*/
|
|
62
|
+
max_question_len?: number;
|
|
63
|
+
/**
|
|
64
|
+
* The maximum length of the total sentence (context + question) in tokens of each chunk
|
|
65
|
+
* passed to the model. The context will be split in several chunks (using doc_stride as
|
|
66
|
+
* overlap) if needed.
|
|
67
|
+
*/
|
|
68
|
+
max_seq_len?: number;
|
|
69
|
+
/**
|
|
70
|
+
* The number of answers to return (will be chosen by order of likelihood). Can return less
|
|
71
|
+
* than top_k answers if there are not enough options available within the context.
|
|
72
|
+
*/
|
|
73
|
+
top_k?: number;
|
|
74
|
+
/**
|
|
75
|
+
* A list of words and bounding boxes (normalized 0->1000). If provided, the inference will
|
|
76
|
+
* skip the OCR step and use the provided bounding boxes instead.
|
|
77
|
+
*/
|
|
78
|
+
word_boxes?: WordBox[];
|
|
79
|
+
[property: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
export type WordBox = number[] | string;
|
|
82
|
+
export type DocumentQuestionAnsweringOutput = DocumentQuestionAnsweringOutputElement[];
|
|
83
|
+
/**
|
|
84
|
+
* Outputs of inference for the Document Question Answering task
|
|
85
|
+
*/
|
|
86
|
+
export interface DocumentQuestionAnsweringOutputElement {
|
|
87
|
+
/**
|
|
88
|
+
* The answer to the question.
|
|
89
|
+
*/
|
|
90
|
+
answer: string;
|
|
91
|
+
/**
|
|
92
|
+
* The end word index of the answer (in the OCR’d version of the input or provided word
|
|
93
|
+
* boxes).
|
|
94
|
+
*/
|
|
95
|
+
end: number;
|
|
96
|
+
/**
|
|
97
|
+
* The probability associated to the answer.
|
|
98
|
+
*/
|
|
99
|
+
score: number;
|
|
100
|
+
/**
|
|
101
|
+
* The start word index of the answer (in the OCR’d version of the input or provided word
|
|
102
|
+
* boxes).
|
|
103
|
+
*/
|
|
104
|
+
start: number;
|
|
105
|
+
/**
|
|
106
|
+
* The index of each word/box pair that is in the answer
|
|
107
|
+
*/
|
|
108
|
+
words: number[];
|
|
109
|
+
[property: string]: unknown;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/document-question-answering/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;OAEG;IACH,MAAM,EAAE,kCAAkC,CAAC;IAC3C;;OAEG;IACH,UAAU,CAAC,EAAE,mCAAmC,CAAC;IACjD,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,kCAAkC;IAClD;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ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,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
export type FeatureExtractionOutput = unknown[];
|
|
7
|
+
/**
|
|
8
|
+
* Inputs for Text Embedding inference
|
|
9
|
+
*/
|
|
10
|
+
export interface FeatureExtractionInput {
|
|
11
|
+
/**
|
|
12
|
+
* The text to get the embeddings of
|
|
13
|
+
*/
|
|
14
|
+
inputs: string;
|
|
15
|
+
/**
|
|
16
|
+
* Additional inference parameters
|
|
17
|
+
*/
|
|
18
|
+
parameters?: {
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
[property: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/feature-extraction/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,uBAAuB,GAAG,OAAO,EAAE,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACxC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/tasks/fill-mask/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEzC,QAAA,MAAM,QAAQ,EAAE,cA0Ef,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|