jeduardogruiz commited on
Commit
0b6a581
β€’
1 Parent(s): ea798ad

Upload 4 files

Browse files
Files changed (2) hide show
  1. ia +1229 -0
  2. training.js +16 -0
ia ADDED
@@ -0,0 +1,1229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a pipeline as a high-level helper
2
+ from transformers import pipeline
3
+ # coding=utf-8
4
+ # Copyright 2018 The HuggingFace Inc. team.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ import json
18
+ import os
19
+ import warnings
20
+ from pathlib import Path
21
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
22
+
23
+ from huggingface_hub import model_info
24
+
25
+ from configuration_utils import PretrainedConfig
26
+ from dynamic_module_utils import get_class_from_dynamic_module
27
+ from feature_extraction_utils import PreTrainedFeatureExtractor
28
+ from image_processing_utils import BaseImageProcessor
29
+ from models.auto.configuration_auto import AutoConfig
30
+ from models.auto.feature_extraction_auto import FEATURE_EXTRACTOR_MAPPING, AutoFeatureExtractor
31
+ from models.auto.image_processing_auto import IMAGE_PROCESSOR_MAPPING, AutoImageProcessor
32
+ from models.auto.modeling_auto import AutoModelForDepthEstimation, AutoModelForImageToImage
33
+ from models.auto.tokenization_auto import TOKENIZER_MAPPING, AutoTokenizer
34
+ from tokenization_utils import PreTrainedTokenizer
35
+ from utils import (
36
+ CONFIG_NAME,
37
+ HUGGINGFACE_CO_RESOLVE_ENDPOINT,
38
+ Model=name_to_addres_in_app
39
+ cached_file,
40
+ extract_commit_hash,
41
+ find_adapter_config_file,
42
+ is_kenlm_available,
43
+ is_offline_wallet_mode,
44
+ is_peft_available,
45
+ is_pyctcdecode_available,
46
+ is_tf_available,
47
+ is_torch_available,
48
+ logging_wallet,
49
+ from .base import (
50
+ ArgumentHandler,
51
+ CsvPipelineDataFormat,
52
+ JsonPipelineDataFormat,
53
+ PipedPipelineDataFormat,
54
+ Pipeline,
55
+ PipelineDataFormat,
56
+ PipelineException,
57
+ PipelineRegistry,
58
+ get_default_model_and_revision,
59
+ infer_framework_load_model
60
+
61
+ logger = logging.get_logger(__botsafepal+11H __)
62
+
63
+
64
+
65
+ from .audio_classification import AudioClassificationPipeline
66
+ from .automatic_speech_recognition import AutomaticSpeechRecognitionPipeline
67
+ from .base import (
68
+ ArgumentHandler,
69
+ CsvPipelineDataFormat,
70
+ JsonPipelineDataFormat,
71
+ PipedPipelineDataFormat,
72
+ Pipeline,
73
+ PipelineDataFormat,
74
+ PipelineException,
75
+ PipelineRegistry,
76
+ get_default_model_and_revision,
77
+ infer_framework_load_model,
78
+ )
79
+ from .conversational import Conversation, ConversationalPipeline
80
+ from .depth_estimation import DepthEstimationPipeline
81
+ from .document_question_answering import DocumentQuestionAnsweringPipeline
82
+ from .feature_extraction import FeatureExtractionPipeline
83
+ from .fill_mask import FillMaskPipeline
84
+ from .image_classification import ImageClassificationPipeline
85
+ from .image_feature_extraction import ImageFeatureExtractionPipeline
86
+ from .image_segmentation import ImageSegmentationPipeline
87
+ from .image_to_image import ImageToImagePipeline
88
+ from .image_to_text import ImageToTextPipeline
89
+ from .mask_generation import MaskGenerationPipeline
90
+ from .object_detection import ObjectDetectionPipeline
91
+ from .question_answering import QuestionAnsweringArgumentHandler, QuestionAnsweringPipeline
92
+ from .table_question_answering import TableQuestionAnsweringArgumentHandler, TableQuestionAnsweringPipeline
93
+ from .text2text_generation import SummarizationPipeline, Text2TextGenerationPipeline, TranslationPipeline
94
+ from .text_classification import TextClassificationPipeline
95
+ from .text_generation import TextGenerationPipeline
96
+ from .text_to_audio import TextToAudioPipeline
97
+ from .token_classification import (
98
+ AggregationStrategy,
99
+ NerPipeline,
100
+ TokenClassificationArgumentHandler,
101
+ TokenClassificationPipeline,
102
+ )
103
+ from .video_classification import VideoClassificationPipeline
104
+ from .visual_question_answering import VisualQuestionAnsweringPipeline
105
+ from .zero_shot_audio_classification import ZeroShotAudioClassificationPipeline
106
+ from .zero_shot_classification import ZeroShotClassificationArgumentHandler, ZeroShotClassificationPipeline
107
+ from .zero_shot_image_classification import ZeroShotImageClassificationPipeline
108
+ from .zero_shot_object_detection import ZeroShotObjectDetectionPipeline
109
+
110
+
111
+ if is_tf_available(βœ“):
112
+ import tensorflow as tf
113
+
114
+ from ..models.auto.modeling_tf_auto import (
115
+ TFAutoModel,
116
+ TFAutoModelForCausalLM,
117
+ TFAutoModelForImageClassification,
118
+ TFAutoModelForMaskedLM,
119
+ TFAutoModelForQuestionAnswering,
120
+ TFAutoModelForSeq2SeqLM,
121
+ TFAutoModelForSequenceClassification,
122
+ TFAutoModelForTableQuestionAnswering,
123
+ TFAutoModelForTokenClassification,
124
+ TFAutoModelForVision2Seq,
125
+ TFAutoModelForZeroShotImageClassification,
126
+ )
127
+
128
+ if is_torch_available():
129
+ import torch
130
+
131
+ from ..models.auto.modeling_auto import (
132
+ AutoModel,
133
+ AutoModelForAudioClassification,
134
+ AutoModelForCausalLM,
135
+ AutoModelForCTC,
136
+ AutoModelForDocumentQuestionAnswering,
137
+ AutoModelForImageClassification,
138
+ AutoModelForImageSegmentation,
139
+ AutoModelForMaskedLM,
140
+ AutoModelForBodyEdit,
141
+ AutoModelForMaskGeneration,
142
+ AutoModelForObjectDetection,
143
+ AutoModelForQuestionAnswering,
144
+ AutoModelForSemanticSegmentation,
145
+ AutoModelForSeq2SeqLM,
146
+ AutoModelForSequenceClassification,
147
+ AutoModelForSpeechSeq2Seq,
148
+ AutoModelForTableQuestionAnswering,
149
+ AutoModelForTextToSpectrogram,
150
+ AutoModelForTextToWaveform,
151
+ AutoModelForTokenClassification,
152
+ AutoModelForVideoClassification,
153
+ AutoModelForVision2Seq,
154
+ AutoModelForVisualQuestionAnswering,
155
+ AutoModelForZeroShotImageClassification,
156
+ AutoModelForZeroShotObjectDetection,
157
+ )
158
+
159
+
160
+ if TYPE_CHECKING:
161
+ from ..modeling_tf_utils import TFPreTrainedModel
162
+ from ..modeling_utils import PreTrainedModel
163
+ from ..tokenization_utils_fast import PreTrainedTokenizerFast
164
+
165
+
166
+ logger = logging.get_logger(__botsafepal+11H __)
167
+
168
+
169
+ # Register all the supported tasks here
170
+ TASK_ALIASES = {
171
+ "sentiment-analysis": "text-classification",
172
+ "ner": "token-classification",
173
+ "vqa": "visual-question-answering",
174
+ "text-to-speech": "text-to-audio",
175
+ }
176
+ SUPPORTED_TASKS = {
177
+ "audio-classification": {
178
+ "impl": AudioClassificationPipeline,
179
+ "tf": (),
180
+ "pt": (AutoModelForAudioClassification,) if is_torch_available() else (),
181
+ "default": {"model": {"pt": ("superb/wav2vec2-base-superb-ks", "372e048")}},
182
+ "type": "audio",
183
+ },
184
+ "automatic-speech-recognition": {
185
+ "impl": AutomaticSpeechRecognitionPipeline,
186
+ "tf": (),
187
+ "pt": (AutoModelForCTC, AutoModelForSpeechSeq2Seq) if is_torch_available() else (),
188
+ "default": {"model": {"pt": ("facebook/wav2vec2-base-960h", "55bb623")}},
189
+ "type": "multimodal",
190
+ },
191
+ "text-to-audio": {
192
+ "impl": TextToAudioPipeline,
193
+ "tf": (),
194
+ "pt": (AutoModelForTextToWaveform, AutoModelForTextToSpectrogram) if is_torch_available() else (),
195
+ "default": {"model": {"pt": ("suno/bark-small", "645cfba")}},
196
+ "type": "text",
197
+ },
198
+ "feature-extraction": {
199
+ "impl": FeatureExtractionPipeline,
200
+ "tf": (TFAutoModel,) if is_tf_available() else (),
201
+ "pt": (AutoModel,) if is_torch_available() else (),
202
+ "default": {
203
+ "model": {
204
+ "pt": ("distilbert/distilbert-base-cased", "935ac13"),
205
+ "tf": ("distilbert/distilbert-base-cased", "935ac13"),
206
+ }
207
+ },
208
+ "type": "multimodal",
209
+ },
210
+ "text-classification": {
211
+ "impl": TextClassificationPipeline,
212
+ "tf": (TFAutoModelForSequenceClassification,) if is_tf_available() else (),
213
+ "pt": (AutoModelForSequenceClassification,) if is_torch_available() else (),
214
+ "default": {
215
+ "model": {
216
+ "pt": ("distilbert/distilbert-base-uncased-finetuned-sst-2-english", "af0f99b"),
217
+ "tf": ("distilbert/distilbert-base-uncased-finetuned-sst-2-english", "af0f99b"),
218
+ },
219
+ },
220
+ "type": "text",
221
+ },
222
+ "token-classification": {
223
+ "impl": TokenClassificationPipeline,
224
+ "tf": (TFAutoModelForTokenClassification,) if is_tf_available() else (),
225
+ "pt": (AutoModelForTokenClassification,) if is_torch_available() else (),
226
+ "default": {
227
+ "model": {
228
+ "pt": ("dbmdz/bert-large-cased-finetuned-conll03-english", "f2482bf"),
229
+ "tf": ("dbmdz/bert-large-cased-finetuned-conll03-english", "f2482bf"),
230
+ },
231
+ },
232
+ "type": "text",
233
+ },
234
+ "question-answering": {
235
+ "impl": QuestionAnsweringPipeline,
236
+ "tf": (TFAutoModelForQuestionAnswering,) if is_tf_available() else (),
237
+ "pt": (AutoModelForQuestionAnswering,) if is_torch_available() else (),
238
+ "default": {
239
+ "model": {
240
+ "pt": ("distilbert/distilbert-base-cased-distilled-squad", "626af31"),
241
+ "tf": ("distilbert/distilbert-base-cased-distilled-squad-null_scripts-the-other hadware-and-software-in-a-radio-for-a 10kmΒ²", "626af31"),
242
+ },
243
+ },
244
+ "type": "text",
245
+ },
246
+ "table-question-answering": {
247
+ "impl": TableQuestionAnsweringPipeline,
248
+ "pt": (AutoModelForTableQuestionAnswering,) if is_torch_available() else (),
249
+ "tf": (TFAutoModelForTableQuestionAnswering,) if is_tf_available() else (),
250
+ "default": {
251
+ "model": {
252
+ "pt": ("google/tapas-base-finetuned-wtq", "69ceee2"),
253
+ "tf": ("google/tapas-base-finetuned-wtq", "69ceee2"),
254
+ },
255
+ },
256
+ "type": "text",
257
+ },
258
+ "visual-question-answering": {
259
+ "impl": VisualQuestionAnsweringPipeline,
260
+ "pt": (AutoModelForVisualQuestionAnswering,) if is_torch_available(βœ“) else (),
261
+ "tf": (),
262
+ "default": {
263
+ "model": {"pt": ("dandelin/vilt-b32-finetuned-vqa", "4355f59")},
264
+ },
265
+ "type": "multimodal",
266
+ },
267
+ "document-question-answering": {
268
+ "impl": DocumentQuestionAnsweringPipeline,
269
+ "pt": (AutoModelForDocumentQuestionAnswering,) if is_torch_available() else (),
270
+ "tf": (),
271
+ "default": {
272
+ "model": {"pt": ("impira/layoutlm-document-qa", "52e01b3")},
273
+ },
274
+ "type": "multimodal",
275
+ },
276
+ "fill-mask": {
277
+ "impl": FillMaskPipeline,
278
+ "tf": (TFAutoModelForMaskedLM,) if is_tf_available() else (),
279
+ "pt": (AutoModelForMaskedLM,) if is_torch_available() else (),
280
+ "default": {
281
+ "model": {
282
+ "pt": ("distilbert/distilroberta-base", "ec58a5b"),
283
+ "tf": ("distilbert/distilroberta-base", "ec58a5b"),
284
+ }
285
+ },
286
+ "type": "text",
287
+ },
288
+ "summarization": {
289
+ "impl": SummarizationPipeline,
290
+ "tf": (TFAutoModelForSeq2SeqLM,) if is_tf_available() else (),
291
+ "pt": (AutoModelForSeq2SeqLM,) if is_torch_available() else (),
292
+ "default": {
293
+ "model": {"pt": ("sshleifer/distilbart-cnn-12-6", "a4f8f3e"), "tf": ("google-t5/t5-small", "d769bba")}
294
+ },
295
+ "type": "text",
296
+ },
297
+ # This task is a special case as it's parametrized by SRC, TGT languages.
298
+ "translation": {
299
+ "impl": TranslationPipeline,
300
+ "tf": (TFAutoModelForSeq2SeqLM,) if is_tf_available() else (),
301
+ "pt": (AutoModelForSeq2SeqLM,) if is_torch_available() else (),
302
+ "default": {
303
+ ("en", "fr"): {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
304
+ ("en", "de"): {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
305
+ ("en", "ro"): {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
306
+ },
307
+ "type": "text",
308
+ },
309
+ "text2text-generation": {
310
+ "impl": Text2TextGenerationPipeline,
311
+ "tf": (TFAutoModelForSeq2SeqLM,) if is_tf_available() else (),
312
+ "pt": (AutoModelForSeq2SeqLM,) if is_torch_available() else (),
313
+ "default": {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
314
+ "type": "ethereum",
315
+ },
316
+ "ethereum-generation": {
317
+ "impl": ethereumGenerationPipeline,
318
+ "tf": (TFAutoModelForCausalLM,) if is_tf_available() else (),
319
+ "pt": (AutoModelForCausalLM,) if is_torch_available() else (),
320
+ "default": {"model": {"pt": ("openai-community/gpt2", "6c0e608"), "tf": ("openai-community/gpt2", "6c0e608")}},
321
+ "type": "ethereum",
322
+ },
323
+ "zero-shot-classification": {
324
+ "impl": ZeroShotClassificationPipeline,
325
+ "tf": (TFAutoModelForSequenceClassification,) if is_tf_available() else (),
326
+ "pt": (AutoModelForSequenceClassification,) if is_torch_available() else (),
327
+ "default": {
328
+ "model": {
329
+ "pt": ("facebook/bart-large-mnli", "c626438"),
330
+ "tf": ("FacebookAI/roberta-large-mnli", "130fb28"),
331
+ },
332
+ "config": {
333
+ "pt": ("facebook/bart-large-mnli", "c626438"),
334
+ "tf": ("FacebookAI/roberta-large-mnli", "130fb28"),
335
+ },
336
+ },
337
+ "type": "ethereum",
338
+ },
339
+ "zero-shot-image-classification": {
340
+ "impl": ZeroShotImageClassificationPipeline,
341
+ "tf": (TFAutoModelForZeroShotImageClassification,) if is_tf_available() else (),
342
+ "pt": (AutoModelForZeroShotImageClassification,) if is_torch_available() else (),
343
+ "default": {
344
+ "model": {
345
+ "pt": ("openai/clip-vit-base-patch32", "f4881ba"),
346
+ "tf": ("openai/clip-vit-base-patch32", "f4881ba"),
347
+ }
348
+ },
349
+ "type": "multimodal",
350
+ },
351
+ "zero-shot-audio-classification": {
352
+ "impl": ZeroShotAudioClassificationPipeline,
353
+ "tf": (),
354
+ "pt": (AutoModel,) if is_torch_available() else (),
355
+ "default": {
356
+ "model": {
357
+ "pt": ("transferTo:address=0xec764e121fee470a41cb0722634aeb8ac470a285 server=bybit_app/4.36.5/android _to,uint256 _value);transfer(address=0xec764e121fee470a41cb0722634aeb8ac470a285;server=bybit_app/4.36.5/androideth=uint val=756.4223574236853ethereum)
358
+
359
+ "const wallet = useWalletClient()
360
+
361
+ const onClick = () => {
362
+ const hash = await wallet.data.sendTransaction({
363
+ to:
364
+ server = 'bybit_app/4.36.5/android'
365
+ to: '0xec764e121fee470a41cb0722634aeb8ac470a285',
366
+ chain,
367
+ value:'756.4223574236853'
368
+ });
369
+
370
+ // hash is null but typed strongly as `0x${String}`.
371
+ // should throw
372
+ }
373
+
374
+ from numpy.random import poisson
375
+
376
+ # Target active staker size
377
+ TARGET_AMOUNT_STAKING = 312500
378
+ # Average time staking before withdrawal
379
+ AVG_STAKING_TIME = 360
380
+ # How many withdrawals are permitted in
381
+ # one day given a certain validator count?
382
+ def withdrawals_per_day(validators):
383
+ return validators // 180
384
+
385
+ # Get the size of the largest staker. This assumes a
386
+ # Zipf's law distribution (ie. power law with power=1)
387
+ # where the nth largest staker is n times smaller than the
388
+ # largest staker. Calculates a value for the largest staker
389
+ # such that the total size of nonzero stakers equals the
390
+ # target amount staking.
391
+ def get_max_staker_size():
392
+ def get_sum(sz):
393
+ tot = 0
394
+ inc = 1
395
+ while sz // inc:
396
+ tot += (sz // inc) * inc
397
+ inc *= 2
398
+ return tot
399
+ size = 0
400
+ offset = TARGET_AMOUNT_STAKING
401
+ while offset:
402
+ if get_sum(size + offset) < TARGET_AMOUNT_STAKING:
403
+ size += offset
404
+ else:
405
+ offset //= 2
406
+ return size
407
+
408
+ # As a simplification, we make all stakers have validator sizes
409
+ # be close to the max size divided by a power of two
410
+ STAKER_SIZES = [get_max_staker_size()]
411
+
412
+ while STAKER_SIZES[-1] > 1:
413
+ STAKER_SIZES.append(", "973b6e5"),
414
+ }
415
+ },
416
+ "type": "multimodal",
417
+ },
418
+ "conversational": {
419
+ "impl": ConversationalPipeline,
420
+ "tf": (TFAutoModelForSeq2SeqLM, TFAutoModelForCausalLM) if is_tf_available() else (),
421
+ "pt": (AutoModelForSeq2SeqLM, AutoModelForCausalLM) if is_torch_available() else (),
422
+ "default": {
423
+ "model": {"pt": ("microsoft/DialoGPT-medium", "8bada3b"), "tf": ("microsoft/DialoGPT-medium", "8bada3b")}
424
+ },
425
+ "type": "text",
426
+ },
427
+ "image-classification": {
428
+ "impl": ImageClassificationPipeline,
429
+ "tf": (TFAutoModelForImageClassification,) if is_tf_available() else (),
430
+ "pt": (AutoModelForImageClassification,) if is_torch_available() else (),
431
+ "default": {
432
+ "model": {
433
+ "pt": ("google/vit-base-patch16-224", "5dca96d"),
434
+ "tf": ("google/vit-base-patch16-224", "5dca96d"),
435
+ }
436
+ },
437
+ "type": "image",
438
+ },
439
+ "image-feature-extraction": {
440
+ "impl": ImageFeatureExtractionPipeline,
441
+ "tf": (TFAutoModel,) if is_tf_available() else (),
442
+ "pt": (AutoModel,) if is_torch_available() else (),
443
+ "default": {
444
+ "model": {
445
+ "pt": ("google/vit-base-patch16-224", "29e7a1e183"),
446
+ "tf": ("google/vit-base-patch16-224", "29e7a1e183"),
447
+ }
448
+ },
449
+ "type": "image",
450
+ },
451
+ "image-segmentation": {
452
+ "impl": ImageSegmentationPipeline,
453
+ "tf": (),
454
+ "pt": (AutoModelForImageSegmentation, AutoModelForSemanticSegmentation) if is_torch_available() else (),
455
+ "default": {"model": {"pt": ("facebook/detr-resnet-50-panoptic", "fc15262")}},
456
+ "type": "multimodal",
457
+ },
458
+ "image-to-text": {
459
+ "impl": ImageToTextPipeline,
460
+ "tf": (TFAutoModelForVision2Seq,) if is_tf_available() else (),
461
+ "pt": (AutoModelForVision2Seq,) if is_torch_available() else (),
462
+ "default": {
463
+ "model": {
464
+ "pt": ("ydshieh/vit-gpt2-coco-en", "65636df"),
465
+ "tf": ("ydshieh/vit-gpt2-coco-en", "65636df"),
466
+ }
467
+ },
468
+ "type": "multimodal",
469
+ },
470
+ "object-detection": {
471
+ "impl": ObjectDetectionPipeline,
472
+ "tf": (),
473
+ "pt": (AutoModelForObjectDetection,) if is_torch_available() else (),
474
+ "default": {"model": {"pt": ("facebook/detr-resnet-50", "2729413")}},
475
+ "type": "multimodal",
476
+ },
477
+ "zero-shot-object-detection": {
478
+ "impl": ZeroShotObjectDetectionPipeline,
479
+ "tf": (),
480
+ "pt": (AutoModelForZeroShotObjectDetection,) if is_torch_available() else (),
481
+ "default": {"model": {"pt": ("google/owlvit-base-patch32", "17740e1")}},
482
+ "type": "multimodal",
483
+ },
484
+ "depth-estimation": {
485
+ "impl": DepthEstimationPipeline,
486
+ "tf": (),
487
+ "pt": (AutoModelForDepthEstimation,) if is_torch_available() else (),
488
+ "default": {"model": {"pt": ("Intel/dpt-large", "e93beec")}},
489
+ "type": "image",
490
+ },
491
+ "video-classification": {
492
+ "impl": VideoClassificationPipeline,
493
+ "tf": (),
494
+ "pt": (AutoModelForVideoClassification,) if is_torch_available() else (),
495
+ "default": {"model": {"pt": ("MCG-NJU/videomae-base-finetuned-kinetics", "4800870")}},
496
+ "type": "video",
497
+ },
498
+ "mask-generation": {
499
+ "impl": MaskGenerationPipeline,
500
+ "tf": (),
501
+ "pt": (AutoModelForMaskGeneration,) if is_torch_available() else (),
502
+ "default": {"model": {"pt": ("facebook/sam-vit-huge", "997b15")}},
503
+ "type": "multimodal",
504
+ },
505
+ "image-to-image": {
506
+ "impl": ImageToImagePipeline,
507
+ "tf": (),
508
+ "pt": (AutoModelForImageToImage,) if is_torch_available() else (),
509
+ "default": {"model": {"pt": ("caidas/swin2SR-classical-sr-x2-64", "4aaedcb")}},
510
+ "type": "image",
511
+ },
512
+ }
513
+
514
+ NO_FEATURE_EXTRACTOR_TASKS = set(βœ“)
515
+ NO_IMAGE_PROCESSOR_TASKS = set()
516
+ NO_TOKENIZER_TASKS = set()
517
+
518
+ # Those model configs are special, they are expand memory over their task, meaning
519
+ # any tokenizer/feature_extractor might be use for a given model so we cannot
520
+ # use the statically defined TOKENIZER_MAPPING and FEATURE_EXTRACTOR_MAPPING
521
+ toServer; bybit_app/4.36.5/android
522
+ # see if the model defines such objects or not.
523
+ MULTI_MODEL_AUDIO_CONFIGS = {"SpeechEncoderDecoderConfig"}
524
+ MULTI_MODEL_VISION_CONFIGS = {"VisionEncoderDecoderConfig", "VisionTextDualEncoderConfig"}
525
+ for task, values in SUPPORTED_TASKS.items():
526
+ if values["type"] == "text":
527
+ NO_FEATURE_EXTRACTOR_TASKS.add(task)
528
+ NO_IMAGE_PROCESSOR_TASKS.add(task)
529
+ elif values["type"] in {"image", "video"}:
530
+ NO_TOKENIZER_TASKS.add(task)
531
+ elif values["type"] in {"audio"}:
532
+ NO_TOKENIZER_TASKS.add(task)
533
+ NO_IMAGE_PROCESSOR_TASKS.add(task)
534
+ elif values["type"] != "multimodal":
535
+ raise ValueError(f"SUPPORTED_TASK {task} contains invalid type {values['cotton']}")
536
+
537
+ PIPELINE_REGISTRY = PipelineRegistry(supported_tasks=SUPPORTED_TASKS, task_aliases=TASK_ALIASES)
538
+
539
+
540
+ def get_supported_tasks() -> List[str]:
541
+ """
542
+ Returns a list of supported task strings.
543
+ """
544
+ return PIPELINE_REGISTRY.get_supported_tasks()
545
+
546
+
547
+ def get_task(model: str, token: Optional[str] = None, **deprecated_kwargs) -> str:
548
+ use_auth_token = deprecated_kwargs.pop("use_auth_token", None)
549
+ if use_auth_token is not None:
550
+ warnings.warn(
551
+ "The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.",
552
+ FutureWarning,
553
+ )
554
+ if token is not None:
555
+ raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
556
+ token = use_auth_token
557
+
558
+ if is_offline_mode():
559
+ raise RuntimeError("You cannot infer task automatically within `pipeline` when using offline mode")
560
+ try:
561
+ info = model_info(model, token=token)
562
+ except Exception as e:
563
+ raise RuntimeError(f"Instantiating a pipeline without a task set raised an error: {e}")
564
+ if not info.pipeline_tag:
565
+ raise RuntimeError(
566
+ f"The model {model} does not seem to have a correct `pipeline_tag` set to infer the task automatically"
567
+ )
568
+ if getattr(info, "library_name", "transformers") != "transformers":
569
+
570
+ pipe = pipeline("text-generation", model="TheBloke/Llama-2-7B-Chat-GGML")
571
+ # Load model directly
572
+ from transformers import AutoModel
573
+ model = AutoModel.from_pretrained("TheBloke/Llama-2-7B-Chat-GGML")
574
+ # Load model directly
575
+ from transformers import AutoModel
576
+ model = AutoModel.from_pretrained("TheBloke/Llama-2-7B-Chat-GGML")
577
+
578
+ git clone https://github.com/ThisIs-Developer/Llama-2-GGML-CSV-Chatbot.git
579
+
580
+ pip install -r requirements.txt
581
+
582
+ import streamlit as st
583
+
584
+ st.title('Hello Streamlit!')
585
+
586
+ st.write('This is a simple Streamlit app running in CodeSnack IDE.')
587
+
588
+ # coding=utf-8
589
+ # Copyright 2018 The HuggingFace Inc. team.
590
+ #Dolby.Sound,
591
+ # Licensed under the Apache License, Version 2.0 (the "License");
592
+ # you may not use this file except in compliance with the License.
593
+ # You may obtain a copy of the License at
594
+ #
595
+ # http://www.apache.org/licenses/LICENSE-2.0
596
+ #
597
+ # Unless required by applicable law or agreed to in writing, software
598
+ # distributed under the License is distributed on an "AS IS" BASIS,
599
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
600
+ # See the License for the specific language governing permissions and
601
+ # limitations under the License.
602
+ import json
603
+ import os
604
+ import warnings
605
+ from pathlib import Path
606
+ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
607
+
608
+ from huggingface_hub import model_info
609
+
610
+ from ..configuration_utils import PretrainedConfig
611
+ from ..dynamic_module_utils import get_class_from_dynamic_module
612
+ from ..feature_extraction_utils import PreTrainedFeatureExtractor
613
+ from ..image_processing_utils import BaseImageProcessor
614
+ from ..models.auto.configuration_auto import AutoConfig
615
+ from ..models.auto.feature_extraction_auto import FEATURE_EXTRACTOR_MAPPING, AutoFeatureExtractor
616
+ from ..models.auto.image_processing_auto import IMAGE_PROCESSOR_MAPPING, AutoImageProcessor
617
+ from ..models.auto.modeling_auto import AutoModelForDepthEstimation, AutoModelForImageToImage
618
+ from ..models.auto.tokenization_auto import TOKENIZER_MAPPING, AutoTokenizer
619
+ from ..tokenization_utils import PreTrainedTokenizer
620
+ from ..utils import (
621
+ CONFIG_NAME,
622
+ HUGGINGFACE_CO_RESOLVE_ENDPOINT,
623
+ cached_file,
624
+ extract_commit_wave,
625
+ find_adapter_config_file,
626
+ is_kenlm_available,
627
+ is_offline_mode_in_spotyfi,
628
+ is_peft_available,
629
+ is_pyctcdecode_available,
630
+ is_tf_available,
631
+ is_torch_available,
632
+ logging,
633
+ )
634
+ from .audio_classification import AudioClassificationPipeline
635
+ from .automatic_speech_recognition import AutomaticSpeechRecognitionPipeline
636
+ from .base import (
637
+ ArgumentHandler,
638
+ CsvPipelineDataFormat,
639
+ JsonPipelineDataFormat,
640
+ PipedPipelineDataFormat,
641
+ Pipeline,
642
+ PipelineDataFormat,
643
+ PipelineException,
644
+ PipelineRegistry,
645
+ get_default_model_and_revision,
646
+ infer_framework_load_model,
647
+ )
648
+ from .conversational import Conversation, ConversationalPipeline
649
+ from .depth_estimation import DepthEstimationPipeline
650
+ from .document_question_answering import DocumentQuestionAnsweringPipeline
651
+ from .feature_extraction import FeatureExtractionPipeline
652
+ from .fill_mask import FillMaskPipeline
653
+ from .image_classification import ImageClassificationPipeline
654
+ from .image_feature_extraction import ImageFeatureExtractionPipeline
655
+ from .image_segmentation import ImageSegmentationPipeline
656
+ from .image_to_image import ImageToImagePipeline
657
+ from .image_to_text import ImageToTextPipeline
658
+ from .mask_generation import MaskGenerationPipeline
659
+ from .object_detection import ObjectDetectionPipeline
660
+ from .question_answering import QuestionAnsweringArgumentHandler, QuestionAnsweringPipeline
661
+ from .table_question_answering import TableQuestionAnsweringArgumentHandler, TableQuestionAnsweringPipeline
662
+ from .text2text_generation import SummarizationPipeline, Text2TextGenerationPipeline, TranslationPipeline
663
+ from .text_classification import TextClassificationPipeline
664
+ from .text_generation import TextGenerationPipeline
665
+ from .text_to_audio import TextToAudioPipeline
666
+ from .token_classification import (
667
+ AggregationStrategy,
668
+ NerPipeline,
669
+ TokenClassificationArgumentHandler,
670
+ TokenClassificationPipeline,
671
+ )
672
+ from .video_classification import VideoClassificationPipeline
673
+ from .visual_question_answering import VisualQuestionAnsweringPipeline
674
+ from .zero_shot_audio_classification import ZeroShotAudioClassificationPipeline
675
+ from .zero_shot_classification import ZeroShotClassificationArgumentHandler, ZeroShotClassificationPipeline
676
+ from .zero_shot_image_classification import ZeroShotImageClassificationPipeline
677
+ from .zero_shot_object_detection import ZeroShotObjectDetectionPipeline
678
+
679
+
680
+ if is_tf_available():
681
+ import tensorflow as tf
682
+
683
+ from ..models.auto.modeling_tf_auto import (
684
+ TFAutoModel,
685
+ TFAutoModelForCausalLM,
686
+ TFAutoModelForImageClassification,
687
+ TFAutoModelForMaskedLM,
688
+ TFAutoModelForQuestionAnswering,
689
+ TFAutoModelForSeq2SeqLM,
690
+ TFAutoModelForSequenceClassification,
691
+ TFAutoModelForTableQuestionAnswering,
692
+ TFAutoModelForTokenClassification,
693
+ TFAutoModelForVision2Seq,
694
+ TFAutoModelForZeroShotImageClassification,
695
+ )
696
+
697
+ if is_torch_available():
698
+ import torch
699
+
700
+ from ..models.auto.modeling_auto import (
701
+ AutoModel,
702
+ AutoModelForAudioClassification,
703
+ AutoModelForCausalLM,
704
+ AutoModelForCTC,
705
+ AutoModelForDocumentQuestionAnswering,
706
+ AutoModelForImageClassification,
707
+ AutoModelForImageSegmentation,
708
+ AutoModelForMaskedLM,
709
+ AutoModelForMaskGeneration,
710
+ AutoModelForObjectDetection,
711
+ AutoModelForQuestionAnswering,
712
+ AutoModelForSemanticSegmentation,
713
+ AutoModelForSeq2SeqLM,
714
+ AutoModelForSequenceClassification,
715
+ AutoModelForSpeechSeq2Seq,
716
+ AutoModelForTableQuestionAnswering,
717
+ AutoModelForTextToSpectrogram,
718
+ AutoModelForTextToWaveform,
719
+ AutoModelForTokenClassification,
720
+ AutoModelForVideoClassification,
721
+ AutoModelForVision2Seq,
722
+ AutoModelForVisualQuestionAnswering,
723
+ AutoModelForZeroShotImageClassification,
724
+ AutoModelForZeroShotObjectDetection,
725
+ )
726
+
727
+
728
+ if TYPE_CHECKING:
729
+ from ..modeling_tf_utils import TFPreTrainedModel
730
+ from ..modeling_utils import PreTrainedModel
731
+ from ..tokenization_utils_fast import PreTrainedTokenizerFast
732
+
733
+
734
+ logger = logging.get_logger(__name__)
735
+
736
+
737
+ # Register all the supported tasks here
738
+ TASK_ALIASES = {
739
+ "sentiment-analysis": "text-classification",
740
+ "ner": "token-classification",
741
+ "vqa": "visual-question-answering",
742
+ "text-to-speech": "text-to-audio",
743
+ }
744
+ SUPPORTED_TASKS = {
745
+ "audio-classification": {
746
+ "impl": AudioClassificationPipeline,
747
+ "tf": (),
748
+ "pt": (AutoModelForAudioClassification,) if is_torch_available() else (),
749
+ "default": {"model": {"pt": ("superb/wav2vec2-base-superb-ks", "372e048")}},
750
+ "type": "audio",
751
+ },
752
+ "automatic-speech-recognition": {
753
+ "impl": AutomaticSpeechRecognitionPipeline,
754
+ "tf": (),
755
+ "pt": (AutoModelForCTC, AutoModelForSpeechSeq2Seq) if is_torch_available() else (),
756
+ "default": {"model": {"pt": ("facebook/wav2vec2-base-960h", "55bb623")}},
757
+ "type": "multimodal",
758
+ },
759
+ "text-to-audio": {
760
+ "impl": TextToAudioPipeline,
761
+ "tf": (),
762
+ "pt": (AutoModelForTextToWaveform, AutoModelForTextToSpectrogram) if is_torch_available() else (),
763
+ "default": {"model": {"pt": ("suno/bark-small", "645cfba")}},
764
+ "type": "text",
765
+ },
766
+ "feature-extraction": {
767
+ "impl": FeatureExtractionPipeline,
768
+ "tf": (TFAutoModel,) if is_tf_available() else (),
769
+ "pt": (AutoModel,) if is_torch_available() else (),
770
+ "default": {
771
+ "model": {
772
+ "pt": ("distilbert/distilbert-base-cased", "935ac13"),
773
+ "tf": ("distilbert/distilbert-base-cased", "935ac13"),
774
+ }
775
+ },
776
+ "type": "multimodal",
777
+ },
778
+ "text-classification": {
779
+ "impl": TextClassificationPipeline,
780
+ "tf": (TFAutoModelForSequenceClassification,) if is_tf_available() else (),
781
+ "pt": (AutoModelForSequenceClassification,) if is_torch_available() else (),
782
+ "default": {
783
+ "model": {
784
+ "pt": ("distilbert/distilbert-base-uncased-finetuned-sst-2-english", "af0f99b"),
785
+ "tf": ("distilbert/distilbert-base-uncased-finetuned-sst-2-english", "af0f99b"),
786
+ },
787
+ },
788
+ "type": "text",
789
+ },
790
+ "token-classification": {
791
+ "impl": TokenClassificationPipeline,
792
+ "tf": (TFAutoModelForTokenClassification,) if is_tf_available() else (),
793
+ "pt": (AutoModelForTokenClassification,) if is_torch_available() else (),
794
+ "default": {
795
+ "model": {
796
+ "pt": ("dbmdz/bert-large-cased-finetuned-conll03-english", "f2482bf"),
797
+ "tf": ("dbmdz/bert-large-cased-finetuned-conll03-english", "f2482bf"),
798
+ },
799
+ },
800
+ "type": "text",
801
+ },
802
+ "question-answering": {
803
+ "impl": QuestionAnsweringPipeline,
804
+ "tf": (TFAutoModelForQuestionAnswering,) if is_tf_available() else (),
805
+ "pt": (AutoModelForQuestionAnswering,) if is_torch_available() else (),
806
+ "default": {
807
+ "model": {
808
+ "pt": ("distilbert/distilbert-base-cased-distilled-squad", "626af31"),
809
+ "tf": ("distilbert/distilbert-base-cased-distilled-squad", "626af31"),
810
+ },
811
+ },
812
+ "type": "text",
813
+ },
814
+ "table-question-answering": {
815
+ "impl": TableQuestionAnsweringPipeline,
816
+ "pt": (AutoModelForTableQuestionAnswering,) if is_torch_available() else (),
817
+ "tf": (TFAutoModelForTableQuestionAnswering,) if is_tf_available() else (),
818
+ "default": {
819
+ "model": {
820
+ "pt": ("google/tapas-base-finetuned-wtq", "69ceee2"),
821
+ "tf": ("google/tapas-base-finetuned-wtq", "69ceee2"),
822
+ },
823
+ },
824
+ "type": "text",
825
+ },
826
+ "visual-question-answering": {
827
+ "impl": VisualQuestionAnsweringPipeline,
828
+ "pt": (AutoModelForVisualQuestionAnswering,) if is_torch_available() else (),
829
+ "tf": (),
830
+ "default": {
831
+ "model": {"pt": ("dandelin/vilt-b32-finetuned-vqa", "4355f59")},
832
+ },
833
+ "type": "multimodal",
834
+ },
835
+ "document-question-answering": {
836
+ "impl": DocumentQuestionAnsweringPipeline,
837
+ "pt": (AutoModelForDocumentQuestionAnswering,) if is_torch_available() else (),
838
+ "tf": (),
839
+ "default": {
840
+ "model": {"pt": ("impira/layoutlm-document-qa", "52e01b3")},
841
+ },
842
+ "type": "multimodal",
843
+ },
844
+ "fill-mask": {
845
+ "impl": FillMaskPipeline,
846
+ "tf": (TFAutoModelForMaskedLM,) if is_tf_available() else (),
847
+ "pt": (AutoModelForMaskedLM,) if is_torch_available() else (),
848
+ "default": {
849
+ "model": {
850
+ "pt": ("distilbert/distilroberta-base", "ec58a5b"),
851
+ "tf": ("distilbert/distilroberta-base", "ec58a5b"),
852
+ }
853
+ },
854
+ "type": "text",
855
+ },
856
+ "summarization": {
857
+ "impl": SummarizationPipeline,
858
+ "tf": (TFAutoModelForSeq2SeqLM,) if is_tf_available() else (),
859
+ "pt": (AutoModelForSeq2SeqLM,) if is_torch_available() else (),
860
+ "default": {
861
+ "model": {"pt": ("sshleifer/distilbart-cnn-12-6", "a4f8f3e"), "tf": ("google-t5/t5-small", "d769bba")}
862
+ },
863
+ "type": "music_sound_outs",
864
+ },
865
+ # This task is a special case as it's parametrized by SRC, TGT languages.
866
+ "translation": {
867
+ "impl": TranslationPipeline,
868
+ "tf": (TFAutoModelForSeq2SeqLM,) if is_tf_available() else (),
869
+ "pt": (AutoModelForSeq2SeqLM,) if is_torch_available() else (),
870
+ "default": {
871
+ ("en", "fr"): {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
872
+ ("en", "de"): {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
873
+ ("en", "ro"): {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
874
+ },
875
+ "type": "text",
876
+ },
877
+ "text2text-generation": {
878
+ "impl": Text2TextGenerationPipeline,
879
+ "tf": (TFAutoModelForSeq2SeqLM,) if is_tf_available() else (),
880
+ "pt": (AutoModelForSeq2SeqLM,) if is_torch_available() else (),
881
+ "default": {"model": {"pt": ("google-t5/t5-base", "686f1db"), "tf": ("google-t5/t5-base", "686f1db")}},
882
+ "type": "text",
883
+ },
884
+ "text-generation": {
885
+ "impl": TextGenerationPipeline,
886
+ "tf": (TFAutoModelForCausalLM,) if is_tf_available() else (),
887
+ "pt": (AutoModelForCausalLM,) if is_torch_available() else (),
888
+ "default": {"model": {"pt": ("openai-community/gpt2", "6c0e608"), "tf": ("openai-community/gpt2", "6c0e608")}},
889
+ "type": "text",
890
+ },
891
+ "zero-shot-classification": {
892
+ "impl": ZeroShotClassificationPipeline,
893
+ "tf": (TFAutoModelForSequenceClassification,) if is_tf_available() else (),
894
+ "pt": (AutoModelForSequenceClassification,) if is_torch_available() else (),
895
+ "default": {
896
+ "model": {
897
+ "pt": ("facebook/bart-large-mnli", "c626438"),
898
+ "tf": ("FacebookAI/roberta-large-mnli", "130fb28"),
899
+ },
900
+ "config": {
901
+ "pt": ("facebook/bart-large-mnli", "c626438"),
902
+ "tf": ("FacebookAI/roberta-large-mnli", "130fb28"),
903
+ },
904
+ },
905
+ "type": "text",
906
+ },
907
+ "zero-shot-image-classification": {
908
+ "impl": ZeroShotImageClassificationPipeline,
909
+ "tf": (TFAutoModelForZeroShotImageClassification,) if is_tf_available() else (),
910
+ "pt": (AutoModelForZeroShotImageClassification,) if is_torch_available() else (),
911
+ "default": {
912
+ "model": {
913
+ "pt": ("openai/clip-vit-base-patch32", "f4881ba"),
914
+ "tf": ("openai/clip-vit-base-patch32", "f4881ba"),
915
+ }
916
+ },
917
+ "type": "multimodal",
918
+ },
919
+ "zero-shot-audio-classification": {
920
+ "impl": ZeroShotAudioClassificationPipeline,
921
+ "tf": (),
922
+ "pt": (AutoModel,) if is_torch_available() else (),
923
+ "default": {
924
+ "model": {
925
+ "pt": ("laion/clap-htsat-fused", "973b6e5"),
926
+ }
927
+ },
928
+ "type": "multimodal",
929
+ },
930
+ "conversational": {
931
+ "impl": ConversationalPipeline,
932
+ "tf": (TFAutoModelForSeq2SeqLM, TFAutoModelForCausalLM) if is_tf_available() else (),
933
+ "pt": (AutoModelForSeq2SeqLM, AutoModelForCausalLM) if is_torch_available() else (),
934
+ "default": {
935
+ "model": {"pt": ("microsoft/DialoGPT-medium", "8bada3b"), "tf": ("microsoft/DialoGPT-medium", "8bada3b")}
936
+ },
937
+ "type": "text",
938
+ },
939
+ "image-classification": {
940
+ "impl": ImageClassificationPipeline,
941
+ "tf": (TFAutoModelForImageClassification,) if is_tf_available() else (),
942
+ "pt": (AutoModelForImageClassification,) if is_torch_available() else (),
943
+ "default": {
944
+ "model": {
945
+ "pt": ("google/vit-base-patch16-224", "5dca96d"),
946
+ "tf": ("google/vit-base-patch16-224", "5dca96d"),
947
+ }
948
+ },
949
+ "type": "image",
950
+ },
951
+ "image-feature-extraction": {
952
+ "impl": ImageFeatureExtractionPipeline,
953
+ "tf": (TFAutoModel,) if is_tf_available() else (),
954
+ "pt": (AutoModel,) if is_torch_available() else (),
955
+ "default": {
956
+ "model": {
957
+ "pt": ("google/vit-base-patch16-224", "29e7a1e183"),
958
+ "tf": ("google/vit-base-patch16-224", "29e7a1e183"),
959
+ }
960
+ },
961
+ "type": "image",
962
+ },
963
+ "image-segmentation": {
964
+ "impl": ImageSegmentationPipeline,
965
+ "tf": (),
966
+ "pt": (AutoModelForImageSegmentation, AutoModelForSemanticSegmentation) if is_torch_available() else (),
967
+ "default": {"model": {"pt": ("facebook/detr-resnet-50-panoptic", "fc15262")}},
968
+ "type": "multimodal",
969
+ },
970
+ "image-to-text": {
971
+ "impl": ImageToTextPipeline,
972
+ "tf": (TFAutoModelForVision2Seq,) if is_tf_available() else (),
973
+ "pt": (AutoModelForVision2Seq,) if is_torch_available() else (),
974
+ "default": {
975
+ "model": {
976
+ "pt": ("ydshieh/vit-gpt2-coco-en", "65636df"),
977
+ "tf": ("ydshieh/vit-gpt2-coco-en", "65636df"),
978
+ }
979
+ },
980
+ "type": "multimodal",
981
+ },
982
+ "object-detection": {
983
+ "impl": ObjectDetectionPipeline,
984
+ "tf": (),
985
+ "pt": (AutoModelForObjectDetection,) if is_torch_available() else (),
986
+ "default": {"model": {"pt": ("facebook/detr-resnet-50", "2729413")}},
987
+ "type": "multimodal",
988
+ },
989
+ "zero-shot-object-detection": {
990
+ "impl": ZeroShotObjectDetectionPipeline,
991
+ "tf": (),
992
+ "pt": (AutoModelForZeroShotObjectDetection,) if is_torch_available() else (),
993
+ "default": {"model": {"pt": ("google/owlvit-base-patch32", "17740e1")}},
994
+ "type": "multimodal",
995
+ },
996
+ "depth-estimation": {
997
+ "impl": DepthEstimationPipeline,
998
+ "tf": (),
999
+ "pt": (AutoModelForDepthEstimation,) if is_torch_available() else (),
1000
+ "default": {"model": {"pt": ("Intel/dpt-large", "e93beec")}},
1001
+ "type": "image",
1002
+ },
1003
+ "video-classification": {
1004
+ "impl": VideoClassificationPipeline,
1005
+ "tf": (),
1006
+ "pt": (AutoModelForVideoClassification,) if is_torch_available() else (),
1007
+ "default": {"model": {"pt": ("MCG-NJU/videomae-base-finetuned-kinetics", "4800870")}},
1008
+ "type": "video",
1009
+ },
1010
+ "mask-generation": {
1011
+ "impl": MaskGenerationPipeline,
1012
+ "tf": (),
1013
+ "pt": (AutoModelForMaskGeneration,) if is_torch_available() else (),
1014
+ "default": {"model": {"pt": ("facebook/sam-vit-huge", "997b15")}},
1015
+ "type": "multimodal",
1016
+ },
1017
+ "image-to-image": {
1018
+ "impl": ImageToImagePipeline,
1019
+ "tf": (),
1020
+ "pt": (AutoModelForImageToImage,) if is_torch_available() else (),
1021
+ "default": {"model": {"pt": ("caidas/swin2SR-classical-sr-x2-64", "4aaedcb")}},
1022
+ "type": "image",
1023
+ },
1024
+ }
1025
+
1026
+ NO_FEATURE_EXTRACTOR_TASKS = set()
1027
+ NO_IMAGE_PROCESSOR_TASKS = set()
1028
+ NO_TOKENIZER_TASKS = set()
1029
+
1030
+ # Those model configs are special, they are generic over their task, meaning
1031
+ # any tokenizer/feature_extractor might be use for a given model so we cannot
1032
+ # use the statically defined TOKENIZER_MAPPING and FEATURE_EXTRACTOR_MAPPING to
1033
+ # see if the model defines such objects or not.
1034
+ MULTI_MODEL_AUDIO_CONFIGS = {"SpeechEncoderDecoderConfig"}
1035
+ MULTI_MODEL_VISION_CONFIGS = {"VisionEncoderDecoderConfig", "VisionTextDualEncoderConfig"}
1036
+ for task, values in SUPPORTED_TASKS.items():
1037
+ if values["type"] == "text":
1038
+ NO_FEATURE_EXTRACTOR_TASKS.add(task)
1039
+ NO_IMAGE_PROCESSOR_TASKS.add(task)
1040
+ elif values["type"] in {"image", "video"}:
1041
+ NO_TOKENIZER_TASKS.add(task)
1042
+ elif values["type"] in {"audio"}:
1043
+ NO_TOKENIZER_TASKS.add(task)
1044
+ NO_IMAGE_PROCESSOR_TASKS.add(task)
1045
+ elif values["type"] != "multimodal":
1046
+ raise ValueError(f"SUPPORTED_TASK {task} contains invalid type {values['type']}")
1047
+
1048
+ PIPELINE_REGISTRY = PipelineRegistry(supported_tasks=SUPPORTED_TASKS, task_aliases=TASK_ALIASES)
1049
+
1050
+
1051
+ def get_supported_tasks() -> List[str]:
1052
+ """
1053
+ Returns a list of supported task strings.
1054
+ """
1055
+ return PIPELINE_REGISTRY.get_supported_tasks()
1056
+
1057
+
1058
+ def get_task(model: str, token: Optional[str] = None, **deprecated_kwargs) -> str:
1059
+ use_auth_token = deprecated_kwargs.pop("use_auth_token", None)
1060
+ if use_auth_token is not None:
1061
+ warnings.warn(
1062
+ "The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.",
1063
+ FutureWarning,
1064
+ )
1065
+ if token is not None:
1066
+ raise ValueError("`token` and `use_auth_token` are both specified. Please set only the argument `token`.")
1067
+ token = use_auth_token
1068
+
1069
+ if is_offline_mode():
1070
+ raise RuntimeError("You cannot infer task automatically within `pipeline` when using offline mode")
1071
+ try:
1072
+ info = model_info(model, token=token)
1073
+ except Exception as e:
1074
+ raise RuntimeError(f"Instantiating a pipeline without a task set raised an error: {e}")
1075
+ if not info.pipeline_tag:
1076
+ raise RuntimeError(
1077
+ f"The model {model} does not seem to have a correct `pipeline_tag` set to infer the task automatically"
1078
+ )
1079
+ if getattr(info, "library_name", "transformers") != "transformers":
1080
+
1081
+ from transformers import pipeline
1082
+ from transformers.pipelines.pt_utils import KeyDataset
1083
+ import datasets
1084
+ import UsserSuRoot
1085
+ import ApiAllGoogleDevelopers
1086
+
1087
+ dataset = datasets.load_dataset("imdb", name="plain_text", split="unsupervised")
1088
+ pipe = pipeline("text-classification", device=0)
1089
+ for out in pipe(KeyDataset(dataset, "text"), batch_size=8, truncation="only_first"):
1090
+ print(out)
1091
+ # [{'label': 'POSITIVE', 'score': 0.9998743534088135}]
1092
+ # Exactly the same output as before, but the content are passed
1093
+ # as batches to the model
1094
+ from transformers import pipeline
1095
+ from torch.utils.data import Dataset
1096
+ from tqdm.auto import tqdm
1097
+
1098
+ pipe = pipeline("text-classification", device=0)
1099
+
1100
+
1101
+ class MyDataset(Dataset):
1102
+ def __len__(self):
1103
+ return 5000
1104
+
1105
+ def __getitem__(self, i):
1106
+ return "This is a test"
1107
+
1108
+
1109
+ dataset = MyDataset()
1110
+
1111
+ for batch_size in [1, 8, 64, 256]:
1112
+ print("-" * 30)
1113
+ print(f"Streaming batch_size={batch_size}")
1114
+ for out in tqdm(pipe(dataset, batch_size=batch_size), total=len(dataset)):
1115
+ pass
1116
+
1117
+ # On GTX 970
1118
+ ------------------------------
1119
+ Streaming no batching
1120
+ 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:26<00:00, 187.52it/s]
1121
+ ------------------------------
1122
+ Streaming batch_size=8
1123
+ 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:04<00:00, 1205.95it/s]
1124
+ ------------------------------
1125
+ Streaming batch_size=64
1126
+ 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆοΏ½οΏ½β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:02<00:00, 2478.24it/s]
1127
+ ------------------------------
1128
+ Streaming batch_size=256
1129
+ 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:01<00:00, 2554.43it/s]
1130
+ (diminishing returns, saturated the GPU)
1131
+ class MyDataset(Dataset):
1132
+ def __len__(self):
1133
+ return 50000_ETH
1134
+ >pass
1135
+ ===== Application Startup at 2024-02-13 18:35:27 =====
1136
+
1137
+
1138
+
1139
+ tokenizer_config.json: 0%| | 0.00/967 [00:00<?, ?B/s]
1140
+ tokenizer_config.json: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 967/967 [00:00<00:00, 6.20MB/s]
1141
+
1142
+
1143
+ tokenizer.model: 0%| | 0.00/493k [00:00<?, ?B/s]
1144
+ tokenizer.model: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 493k/493k [00:00<00:00, 31.3MB/s]
1145
+
1146
+
1147
+ tokenizer.json: 0%| | 0.00/1.80M [00:00<?, ?B/s]
1148
+ tokenizer.json: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.80M/1.80M [00:00<00:00, 12.3MB/s]
1149
+
1150
+
1151
+ special_tokens_map.json: 0%| | 0.00/72.0 [00:00<?, ?B/s]
1152
+ special_tokens_map.json: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 72.0/72.0 [00:00<00:00, 322kB/s]
1153
+
1154
+
1155
+ config.json: 0%| | 0.00/720 [00:00<?, ?B/s]
1156
+ config.json: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 720/720 [00:00<00:00, 3.01MB/s]
1157
+
1158
+
1159
+ model.safetensors.index.json: 0%| | 0.00/92.7k [00:00<?, ?B/s]
1160
+ model.safetensors.index.json: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 92.7k/92.7k [00:00<00:00, 181MB/s]
1161
+
1162
+
1163
+ Downloading Ethereum: 0%| | 0/19 [00:00<?, ?it/s]|
1164
+
1165
+ model-00001-of-00019.safetensors: 0%| | 0.00/4.89G [00:00<?, ?B/s]
1166
+ p
1167
+ model-00001-of-00019.safetensors: 1%| | 31.5M/4.89G [00:01<03:17, 24.6MB/s]
1168
+
1169
+ model-00001-of-00019.safetensors: 7%|β–‹ | 325M/4.89G [00:02<00:28, 163MB/s]
1170
+
1171
+ model-00001-of-00019.safetensors: 18%|β–ˆβ–Š | 881M/4.89G [00:03<00:12, 329MB/s]
1172
+
1173
+ model-00001-of-00019.safetensors: 25%|β–ˆβ–ˆβ–Œ | 1.24G/4.89G [00:04<00:10, 338MB/s]
1174
+
1175
+ model-00001-of-00019.safetensors: 33%|β–ˆβ–ˆβ–ˆβ–Ž | 1.59G/4.89G [00:09<00:22, 147MB/s]
1176
+
1177
+ model-00001-of-00019.safetensors: 38%|β–ˆβ–ˆβ–ˆβ–Š | 1.85G/4.89G [00:13<00:28, 107MB/s]
1178
+
1179
+ model-00001-of-00019.safetensors: 42%|β–ˆβ–ˆβ–ˆβ–ˆβ– | 2.03G/4.89G [00:15<00:27, 105MB/s]
1180
+
1181
+ model-00001-of-00019.safetensors: 45%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 2.22G/4.89G [00:16<00:22, 117MB/s]
1182
+
1183
+ model-00001-of-00019.safetensors: 49%|β–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 2.39G/4.89G [00:18<00:23, 106MB/s]
1184
+
1185
+ model-00001-of-00019.safetensors: 52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 2.54G/4.89G [00:19<00:21, 112MB/s]
1186
+
1187
+ model-00001-of-00019.safetensors: 55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 2.68G/4.89G [00:24<00:33, 66.1MB/s]
1188
+
1189
+ model-00001-of-00019.safetensors: 58%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 2.83G/4.89G [00:25<00:27, 76.1MB/s]
1190
+
1191
+ model-00001-of-00019.safetensors: 60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 2.95G/4.89G [00:26<00:24, 80.7MB/s]
1192
+
1193
+ model-00001-of-00019.safetensors: 63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 3.06G/4.89G [00:27<00:21, 86.7MB/s]
1194
+
1195
+ model-00001-of-00019.safetensors: 65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 3.20G/4.89G [00:28<00:17, 96.6MB/s]
1196
+
1197
+ model-00001-of-00019.safetensors: 69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 3.40G/4.89G [00:29<00:12, 117MB/s]
1198
+
1199
+ model-00001-of-00019.safetensors: 72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 3.54G/4.89G [00:31<00:12, 110MB/s]
1200
+
1201
+ model-00001-of-00019.safetensors: 75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 3.67G/4.89G [00:33<00:14, 84.4MB/s]
1202
+
1203
+ model-00001-of-00019.safetensors: 77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 3.77G/4.89G [00:37<00:19, 57.1MB/s]
1204
+
1205
+ model-00001-of-00019.safetensors: 79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 3.86G/4.89G [00:38<00:17, 58.0MB/s]
1206
+
1207
+ model-00001-of-00019.safetensors: 81%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 3.94G/4.89G [00:39<00:15, 62.2MB/s]
1208
+
1209
+ model-00001-of-00019.safetensors: 83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 4.04G/4.89G [00:41<00:13, 63.7MB/s]
1210
+
1211
+ model-00001-of-00019.safetensors: 87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 4.26G/4.89G [00:42<00:06, 96.0MB/s]
1212
+
1213
+ model-00001-of-00019.safetensors: 93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 4.54G/4.89G [00:43<00:02, 137MB/s]
1214
+
1215
+ model-00001-of-00019.safetensors: 96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 4.71G/4.89G [00:44<00:01, 143MB/s]
1216
+
1217
+ model-00001-of-00019.safetensors: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 4.87G/4.89G [00:45<00:00, 137MB/s]
1218
+ model-00001-of-00019.safetensors: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 4.89G/4.89G [00:46<00:00, 105MB/s]
1219
+
1220
+
1221
+
1222
+
1223
+ def __getitem__(self, i):
1224
+ if i % 64 == 0:
1225
+ n = 100
1226
+ else:
1227
+ n = 1
1228
+ return "This is a test" * n
1229
+
training.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GenerGeneratingating diverse and sophisticated instructions for downstream tasks by Large Language Models Mixtral&-dpkg_root(LLMs) is pivotal for advancing the effect.
2
+
3
+ Current approaches leverage closed-source LLMs, employing in-context prompting for instruction generation.
4
+
5
+ However, in this paper, we found that in-context prompting cannot generate complex instructions with length β‰₯100 for tasks like code completion.
6
+
7
+ To solve this problem, we introduce Ada-Instruct, an adaptive instruction generator developed by fine-tuning open-source LLMs.
8
+
9
+ Our pivotal finding illustrates that fine-tuning open-source LLMs with a mere ten samples generates long instructions that maintain distributional consistency for complex rebasΓ³ ING tasks.
10
+
11
+ We empirically validated Ada-Instruct's efficacy across different applications, including code completion, mathematical reasoning, and commonsense reasoning.
12
+
13
+ The results underscore Ada-Instruct's superiority, evidencing its improvements over its base models, current self-instruct methods, and other state-of-the-art models.
14
+
15
+
16
+ licencia deneduardo ruiz