Map internal task names to labels.
Browse filesThey are consistent with Hub Tasks when possible.
app.py
CHANGED
@@ -48,6 +48,27 @@ push_mapping = {
|
|
48 |
}
|
49 |
push_labels = list(push_mapping.keys())
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
def error_str(error, title="Error", model=None, task=None, framework=None, compute_units=None, precision=None, tolerance=None, destination=None, open_discussion=True):
|
52 |
if not error: return ""
|
53 |
|
@@ -123,6 +144,7 @@ def on_model_change(model):
|
|
123 |
|
124 |
features = FeaturesManager.get_supported_features_for_model_type(model_type)
|
125 |
tasks = list(features.keys())
|
|
|
126 |
|
127 |
frameworks = supported_frameworks(model)
|
128 |
selected_framework = frameworks[0] if len(frameworks) > 0 else None
|
@@ -194,6 +216,7 @@ def convert(model_id, task,
|
|
194 |
push_destination, destination_model, token,
|
195 |
progress=gr.Progress()):
|
196 |
model_id = url_to_model_id(model_id)
|
|
|
197 |
compute_units = compute_units_mapping[compute_units]
|
198 |
precision = precision_mapping[precision]
|
199 |
tolerance = tolerance_mapping[tolerance]
|
|
|
48 |
}
|
49 |
push_labels = list(push_mapping.keys())
|
50 |
|
51 |
+
tasks_mapping = {
|
52 |
+
"default": "Feature Extraction",
|
53 |
+
"causal-lm": "Text Generation",
|
54 |
+
"ctc": "CTC (Connectionist Temporal Classification)",
|
55 |
+
"image-classification": "Image Classification",
|
56 |
+
"image-segmentation": "Image Segmentation",
|
57 |
+
"masked-im": "Image Fill-Mask",
|
58 |
+
"masked-lm": "Fill-Mask",
|
59 |
+
"multiple-choice": "Multiple Choice",
|
60 |
+
"next-sentence-prediction": "Next Sentence Prediction",
|
61 |
+
"object-detection": "Object Detection",
|
62 |
+
"question-answering": "Question Answering",
|
63 |
+
"semantic-segmentation": "Semantic Segmentation",
|
64 |
+
"seq2seq-lm": "Text to Text Generation",
|
65 |
+
"sequence-classification": "Text Classification",
|
66 |
+
"speech-seq2seq": "Speech to Speech Generation",
|
67 |
+
"token-classification": "Token Classification",
|
68 |
+
}
|
69 |
+
reverse_tasks_mapping = {v: k for k, v in tasks_mapping.items()}
|
70 |
+
tasks_labels = list(tasks_mapping.keys())
|
71 |
+
|
72 |
def error_str(error, title="Error", model=None, task=None, framework=None, compute_units=None, precision=None, tolerance=None, destination=None, open_discussion=True):
|
73 |
if not error: return ""
|
74 |
|
|
|
144 |
|
145 |
features = FeaturesManager.get_supported_features_for_model_type(model_type)
|
146 |
tasks = list(features.keys())
|
147 |
+
tasks = [tasks_mapping[task] for task in tasks]
|
148 |
|
149 |
frameworks = supported_frameworks(model)
|
150 |
selected_framework = frameworks[0] if len(frameworks) > 0 else None
|
|
|
216 |
push_destination, destination_model, token,
|
217 |
progress=gr.Progress()):
|
218 |
model_id = url_to_model_id(model_id)
|
219 |
+
task = reverse_tasks_mapping[task]
|
220 |
compute_units = compute_units_mapping[compute_units]
|
221 |
precision = precision_mapping[precision]
|
222 |
tolerance = tolerance_mapping[tolerance]
|