|
| 1 | +import os |
| 2 | + |
1 | 3 | from integ.utils import (
|
| 4 | + validate_automatic_speech_recognition, |
| 5 | + validate_classification, |
2 | 6 | validate_feature_extraction,
|
3 | 7 | validate_fill_mask,
|
4 | 8 | validate_ner,
|
5 | 9 | validate_question_answering,
|
6 | 10 | validate_summarization,
|
7 | 11 | validate_text2text_generation,
|
8 |
| - validate_text_classification, |
9 | 12 | validate_text_generation,
|
10 | 13 | validate_translation,
|
11 | 14 | validate_zero_shot_classification,
|
|
53 | 56 | "pytorch": "gpt2",
|
54 | 57 | "tensorflow": "gpt2",
|
55 | 58 | },
|
| 59 | + "image-classification": { |
| 60 | + "pytorch": "google/vit-base-patch16-224", |
| 61 | + "tensorflow": "google/vit-base-patch16-224", |
| 62 | + }, |
| 63 | + "automatic-speech-recognition": { |
| 64 | + "pytorch": "facebook/wav2vec2-base-100h", |
| 65 | + "tensorflow": "facebook/wav2vec2-base-960h", |
| 66 | + }, |
56 | 67 | }
|
57 | 68 |
|
58 | 69 | task2input = {
|
|
78 | 89 | "inputs": "question: What is 42 context: 42 is the answer to life, the universe and everything."
|
79 | 90 | },
|
80 | 91 | "text-generation": {"inputs": "My name is philipp and I am"},
|
| 92 | + "image-classification": open(os.path.join(os.getcwd(), "tests/resources/image/tiger.jpeg"), "rb").read(), |
| 93 | + "automatic-speech-recognition": open(os.path.join(os.getcwd(), "tests/resources/audio/sample1.flac"), "rb").read(), |
81 | 94 | }
|
82 | 95 |
|
83 | 96 | task2output = {
|
|
98 | 111 | "feature-extraction": None,
|
99 | 112 | "fill-mask": None,
|
100 | 113 | "text-generation": None,
|
| 114 | + "image-classification": [ |
| 115 | + {"score": 0.8858247399330139, "label": "tiger, Panthera tigris"}, |
| 116 | + {"score": 0.10940514504909515, "label": "tiger cat"}, |
| 117 | + {"score": 0.0006216464680619538, "label": "jaguar, panther, Panthera onca, Felis onca"}, |
| 118 | + {"score": 0.0004262699221726507, "label": "dhole, Cuon alpinus"}, |
| 119 | + {"score": 0.00030842673731967807, "label": "lion, king of beasts, Panthera leo"}, |
| 120 | + ], |
| 121 | + "automatic-speech-recognition": { |
| 122 | + "text": "GOING ALONG SLUSHY COUNTRY ROADS AND SPEAKING TO DAMP OAUDIENCES IN DROFTY SCHOOL ROOMS DAY AFTER DAY FOR A FORT NIGHT HE'LL HAVE TO PUT IN AN APPEARANCE AT SOME PLACE OF WORSHIP ON SUNDAY MORNING AND HE CAN COME TO US IMMEDIATELY AFTERWARDS" |
| 123 | + }, |
101 | 124 | }
|
102 | 125 |
|
103 | 126 | task2performance = {
|
|
181 | 204 | "average_request_time": 3,
|
182 | 205 | },
|
183 | 206 | },
|
| 207 | + "image-classification": { |
| 208 | + "cpu": { |
| 209 | + "average_request_time": 4, |
| 210 | + }, |
| 211 | + "gpu": { |
| 212 | + "average_request_time": 1, |
| 213 | + }, |
| 214 | + }, |
| 215 | + "automatic-speech-recognition": { |
| 216 | + "cpu": { |
| 217 | + "average_request_time": 6, |
| 218 | + }, |
| 219 | + "gpu": { |
| 220 | + "average_request_time": 6, |
| 221 | + }, |
| 222 | + }, |
184 | 223 | }
|
185 | 224 |
|
186 | 225 | task2validation = {
|
187 |
| - "text-classification": validate_text_classification, |
| 226 | + "text-classification": validate_classification, |
188 | 227 | "zero-shot-classification": validate_zero_shot_classification,
|
189 | 228 | "feature-extraction": validate_feature_extraction,
|
190 | 229 | "ner": validate_ner,
|
|
194 | 233 | "translation_xx_to_yy": validate_translation,
|
195 | 234 | "text2text-generation": validate_text2text_generation,
|
196 | 235 | "text-generation": validate_text_generation,
|
| 236 | + "image-classification": validate_classification, |
| 237 | + "automatic-speech-recognition": validate_automatic_speech_recognition, |
197 | 238 | }
|
0 commit comments