kaggle 1.8.3__py3-none-any.whl → 1.8.4__py3-none-any.whl

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.
@@ -1,552 +0,0 @@
1
- #!/usr/bin/python
2
- #
3
- # Copyright 2024 Kaggle Inc
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- # coding: utf-8
18
-
19
- import pprint
20
- import re # noqa: F401
21
-
22
- import six
23
-
24
- from kaggle.models.upload_file import UploadFile # noqa: F401,E501
25
-
26
-
27
- class ModelNewInstanceRequest(object):
28
- """
29
- Attributes:
30
- project_types (dict): The key is attribute name
31
- and the value is attribute type.
32
- attribute_map (dict): The key is attribute name
33
- and the value is json key in definition.
34
- """
35
-
36
- project_types = {
37
- "instance_slug": "str",
38
- "framework": "str",
39
- "overview": "str",
40
- "usage": "str",
41
- "license_name": "str",
42
- "fine_tunable": "bool",
43
- "training_data": "list[str]",
44
- "model_instance_type": "str",
45
- "base_model_instance": "str",
46
- "external_base_model_url": "int",
47
- "files": "list[UploadFile]",
48
- }
49
-
50
- attribute_map = {
51
- "instance_slug": "instanceSlug",
52
- "framework": "framework",
53
- "overview": "overview",
54
- "usage": "usage",
55
- "license_name": "licenseName",
56
- "fine_tunable": "fineTunable",
57
- "training_data": "trainingData",
58
- "model_instance_type": "modelInstanceType",
59
- "base_model_instance": "baseModelInstance",
60
- "external_base_model_url": "externalBaseModelUrl",
61
- "files": "files",
62
- }
63
-
64
- def __init__(
65
- self,
66
- instance_slug=None,
67
- framework=None,
68
- overview=None,
69
- usage=None,
70
- license_name="Apache 2.0",
71
- fine_tunable=True,
72
- training_data=None,
73
- model_instance_type=None,
74
- base_model_instance=None,
75
- external_base_model_url=None,
76
- files=None,
77
- ): # noqa: E501
78
-
79
- self._instance_slug = None
80
- self._framework = None
81
- self._overview = None
82
- self._usage = None
83
- self._license_name = None
84
- self._fine_tunable = None
85
- self._training_data = None
86
- self._model_instance_type = None
87
- self._base_model_instance = None
88
- self._external_base_model_url = None
89
- self._files = None
90
- self.discriminator = None
91
-
92
- self.instance_slug = instance_slug
93
- self.framework = framework
94
- if overview is not None:
95
- self.overview = overview
96
- if usage is not None:
97
- self.usage = usage
98
- self.license_name = license_name
99
- if fine_tunable is not None:
100
- self.fine_tunable = fine_tunable
101
- if training_data is not None:
102
- self.training_data = training_data
103
- if model_instance_type is not None:
104
- self.model_instance_type = model_instance_type
105
- if base_model_instance is not None:
106
- self.base_model_instance = base_model_instance
107
- if external_base_model_url is not None:
108
- self.external_base_model_url = external_base_model_url
109
- if files is not None:
110
- self.files = files
111
-
112
- @property
113
- def instance_slug(self):
114
- """Gets the instance_slug of this ModelNewInstanceRequest. # noqa:
115
- E501.
116
-
117
- The slug that the model instance should be created with # noqa:
118
- E501
119
-
120
- :return: The instance_slug of this ModelNewInstanceRequest. #
121
- noqa: E501
122
- :rtype: str
123
- """
124
- return self._instance_slug
125
-
126
- @instance_slug.setter
127
- def instance_slug(self, instance_slug):
128
- """Sets the instance_slug of this ModelNewInstanceRequest.
129
-
130
- The slug that the model instance should be created with # noqa:
131
- E501
132
-
133
- :param instance_slug: The instance_slug of this
134
- ModelNewInstanceRequest. # noqa: E501
135
- :type: str
136
- """
137
- if instance_slug is None:
138
- raise ValueError("Invalid value for `instance_slug`, must not be `None`") # noqa: E501
139
-
140
- self._instance_slug = instance_slug
141
-
142
- @property
143
- def framework(self):
144
- """Gets the framework of this ModelNewInstanceRequest. # noqa: E501.
145
-
146
- The framework of the model instance # noqa: E501
147
-
148
- :return: The framework of this ModelNewInstanceRequest. # noqa:
149
- E501
150
- :rtype: str
151
- """
152
- return self._framework
153
-
154
- @framework.setter
155
- def framework(self, framework):
156
- """Sets the framework of this ModelNewInstanceRequest.
157
-
158
- The framework of the model instance # noqa: E501
159
-
160
- :param framework: The framework of this ModelNewInstanceRequest.
161
- # noqa: E501
162
- :type: str
163
- """
164
- if framework is None:
165
- raise ValueError("Invalid value for `framework`, must not be `None`") # noqa: E501
166
- allowed_values = [
167
- "tensorFlow1",
168
- "tensorFlow2",
169
- "tfLite",
170
- "tfJs",
171
- "pyTorch",
172
- "jax",
173
- "flax",
174
- "pax",
175
- "maxText",
176
- "gemmaCpp",
177
- "tensorRtLlm",
178
- "ggml",
179
- "gguf",
180
- "coral",
181
- "scikitLearn",
182
- "mxnet",
183
- "onnx",
184
- "keras",
185
- "transformers",
186
- "triton",
187
- "api",
188
- "triton",
189
- "tensorRtLlm",
190
- "other",
191
- ] # noqa: E501
192
- if framework not in allowed_values:
193
- raise ValueError(
194
- "Invalid value for `framework` ({0}), must be one of {1}".format( # noqa: E501
195
- framework, allowed_values
196
- )
197
- )
198
-
199
- self._framework = framework
200
-
201
- @property
202
- def overview(self):
203
- """Gets the overview of this ModelNewInstanceRequest. # noqa: E501.
204
-
205
- The overview of the model instance (markdown) # noqa: E501
206
-
207
- :return: The overview of this ModelNewInstanceRequest. # noqa:
208
- E501
209
- :rtype: str
210
- """
211
- return self._overview
212
-
213
- @overview.setter
214
- def overview(self, overview):
215
- """Sets the overview of this ModelNewInstanceRequest.
216
-
217
- The overview of the model instance (markdown) # noqa: E501
218
-
219
- :param overview: The overview of this ModelNewInstanceRequest. #
220
- noqa: E501
221
- :type: str
222
- """
223
-
224
- self._overview = overview
225
-
226
- @property
227
- def usage(self):
228
- """Gets the usage of this ModelNewInstanceRequest. # noqa: E501.
229
-
230
- The description of how to use the model instance (markdown) #
231
- noqa: E501
232
-
233
- :return: The usage of this ModelNewInstanceRequest. # noqa:
234
- E501
235
- :rtype: str
236
- """
237
- return self._usage
238
-
239
- @usage.setter
240
- def usage(self, usage):
241
- """Sets the usage of this ModelNewInstanceRequest.
242
-
243
- The description of how to use the model instance (markdown) #
244
- noqa: E501
245
-
246
- :param usage: The usage of this ModelNewInstanceRequest. #
247
- noqa: E501
248
- :type: str
249
- """
250
-
251
- self._usage = usage
252
-
253
- @property
254
- def license_name(self):
255
- """Gets the license_name of this ModelNewInstanceRequest. # noqa:
256
- E501.
257
-
258
- The license that should be associated with the model instance #
259
- noqa: E501
260
-
261
- :return: The license_name of this ModelNewInstanceRequest. #
262
- noqa: E501
263
- :rtype: str
264
- """
265
- return self._license_name
266
-
267
- @license_name.setter
268
- def license_name(self, license_name):
269
- """Sets the license_name of this ModelNewInstanceRequest.
270
-
271
- The license that should be associated with the model instance #
272
- noqa: E501
273
-
274
- :param license_name: The license_name of this
275
- ModelNewInstanceRequest. # noqa: E501
276
- :type: str
277
- """
278
- if license_name is None:
279
- raise ValueError("Invalid value for `license_name`, must not be `None`") # noqa: E501
280
- allowed_values = [
281
- "CC0 1.0",
282
- "CC BY-NC-SA 4.0",
283
- "Unknown",
284
- "CC BY-SA 4.0",
285
- "GPL 2",
286
- "CC BY-SA 3.0",
287
- "Other",
288
- "Other (specified in description)",
289
- "CC BY 4.0",
290
- "Attribution 4.0 International (CC BY 4.0)",
291
- "CC BY-NC 4.0",
292
- "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)",
293
- "PDDL",
294
- "ODC Public Domain Dedication and Licence (PDDL)",
295
- "CC BY 3.0",
296
- "Attribution 3.0 Unported (CC BY 3.0)",
297
- "CC BY 3.0 IGO",
298
- "Attribution 3.0 IGO (CC BY 3.0 IGO)",
299
- "CC BY-NC-SA 3.0 IGO",
300
- "Attribution-NonCommercial-ShareAlike 3.0 IGO (CC BY-NC-SA 3.0 IGO)",
301
- "CDLA Permissive 1.0",
302
- "Community Data License Agreement - Permissive - Version 1.0",
303
- "CDLA Sharing 1.0",
304
- "Community Data License Agreement - Sharing - Version 1.0",
305
- "CC BY-ND 4.0",
306
- "Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)",
307
- "CC BY-NC-ND 4.0",
308
- "Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)",
309
- "ODC-BY 1.0",
310
- "ODC Attribution License (ODC-By)",
311
- "LGPL 3.0",
312
- "GNU Lesser General Public License 3.0",
313
- "AGPL 3.0",
314
- "GNU Affero General Public License 3.0",
315
- "FDL 1.3",
316
- "GNU Free Documentation License 1.3",
317
- "apache-2.0",
318
- "Apache 2.0",
319
- "mit",
320
- "MIT",
321
- "bsd-3-clause",
322
- "BSD-3-Clause",
323
- "Llama 2",
324
- "Llama 2 Community License",
325
- "Gemma",
326
- "gpl-3",
327
- "GPL 3",
328
- "RAIL-M",
329
- "AI Pubs Open RAIL-M License",
330
- "AIPubs Research-Use RAIL-M",
331
- "AI Pubs Research-Use RAIL-M License",
332
- "BigScience OpenRAIL-M",
333
- "BigScience Open RAIL-M License",
334
- "RAIL",
335
- "RAIL (specified in description)",
336
- "Llama 3",
337
- "Llama 3 Community License",
338
- ] # noqa: E501
339
- if license_name not in allowed_values:
340
- raise ValueError(
341
- "Invalid value for `license_name` ({0}), must be one of {1}".format( # noqa: E501
342
- license_name, allowed_values
343
- )
344
- )
345
-
346
- self._license_name = license_name
347
-
348
- @property
349
- def fine_tunable(self):
350
- """Gets the fine_tunable of this ModelNewInstanceRequest. # noqa:
351
- E501.
352
-
353
- Whether the model instance is fine tunable # noqa: E501
354
-
355
- :return: The fine_tunable of this ModelNewInstanceRequest. #
356
- noqa: E501
357
- :rtype: bool
358
- """
359
- return self._fine_tunable
360
-
361
- @fine_tunable.setter
362
- def fine_tunable(self, fine_tunable):
363
- """Sets the fine_tunable of this ModelNewInstanceRequest.
364
-
365
- Whether the model instance is fine tunable # noqa: E501
366
-
367
- :param fine_tunable: The fine_tunable of this
368
- ModelNewInstanceRequest. # noqa: E501
369
- :type: bool
370
- """
371
-
372
- self._fine_tunable = fine_tunable
373
-
374
- @property
375
- def training_data(self):
376
- """Gets the training_data of this ModelNewInstanceRequest. # noqa:
377
- E501.
378
-
379
- A list of training data (urls or names) # noqa: E501
380
-
381
- :return: The training_data of this ModelNewInstanceRequest. #
382
- noqa: E501
383
- :rtype: list[str]
384
- """
385
- return self._training_data
386
-
387
- @training_data.setter
388
- def training_data(self, training_data):
389
- """Sets the training_data of this ModelNewInstanceRequest.
390
-
391
- A list of training data (urls or names) # noqa: E501
392
-
393
- :param training_data: The training_data of this
394
- ModelNewInstanceRequest. # noqa: E501
395
- :type: list[str]
396
- """
397
-
398
- self._training_data = training_data
399
-
400
- @property
401
- def model_instance_type(self):
402
- """Gets the model_instance_type of this ModelNewInstanceRequest. #
403
- noqa: E501.
404
-
405
- Whether the model instance is a base model, external variant,
406
- internal variant, or unspecified # noqa: E501
407
-
408
- :return: The model_instance_type of this
409
- ModelNewInstanceRequest. # noqa: E501
410
- :rtype: str
411
- """
412
- return self._model_instance_type
413
-
414
- @model_instance_type.setter
415
- def model_instance_type(self, model_instance_type):
416
- """Sets the model_instance_type of this ModelNewInstanceRequest.
417
-
418
- Whether the model instance is a base model, external variant,
419
- internal variant, or unspecified # noqa: E501
420
-
421
- :param model_instance_type: The model_instance_type of this
422
- ModelNewInstanceRequest. # noqa: E501
423
- :type: str
424
- """
425
- allowed_values = ["Unspecified", "BaseModel", "KaggleVariant", "ExternalVariant"] # noqa: E501
426
- if model_instance_type not in allowed_values:
427
- raise ValueError(
428
- "Invalid value for `model_instance_type` ({0}), must be one of {1}".format( # noqa: E501
429
- model_instance_type, allowed_values
430
- )
431
- )
432
-
433
- self._model_instance_type = model_instance_type
434
-
435
- @property
436
- def base_model_instance(self):
437
- """Gets the base_model_instance of this ModelNewInstanceRequest. #
438
- noqa: E501.
439
-
440
- If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance # noqa: E501
441
-
442
- :return: The base_model_instance of this ModelNewInstanceRequest. # noqa: E501
443
- :rtype: str
444
- """
445
- return self._base_model_instance
446
-
447
- @base_model_instance.setter
448
- def base_model_instance(self, base_model_instance):
449
- """Sets the base_model_instance of this ModelNewInstanceRequest.
450
-
451
- If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance # noqa: E501
452
-
453
- :param base_model_instance: The base_model_instance of this ModelNewInstanceRequest. # noqa: E501
454
- :type: str
455
- """
456
-
457
- self._base_model_instance = base_model_instance
458
-
459
- @property
460
- def external_base_model_url(self):
461
- """Gets the external_base_model_url of this ModelNewInstanceRequest. #
462
- noqa: E501.
463
-
464
- If this is an external variant, a URL to the base model # noqa:
465
- E501
466
-
467
- :return: The external_base_model_url of this
468
- ModelNewInstanceRequest. # noqa: E501
469
- :rtype: int
470
- """
471
- return self._external_base_model_url
472
-
473
- @external_base_model_url.setter
474
- def external_base_model_url(self, external_base_model_url):
475
- """Sets the external_base_model_url of this ModelNewInstanceRequest.
476
-
477
- If this is an external variant, a URL to the base model # noqa:
478
- E501
479
-
480
- :param external_base_model_url: The external_base_model_url of
481
- this ModelNewInstanceRequest. # noqa: E501
482
- :type: int
483
- """
484
-
485
- self._external_base_model_url = external_base_model_url
486
-
487
- @property
488
- def files(self):
489
- """Gets the files of this ModelNewInstanceRequest. # noqa: E501.
490
-
491
- A list of files that should be associated with the model
492
- instance version # noqa: E501
493
-
494
- :return: The files of this ModelNewInstanceRequest. # noqa: E501
495
- :rtype: list[UploadFile]
496
- """
497
- return self._files
498
-
499
- @files.setter
500
- def files(self, files):
501
- """Sets the files of this ModelNewInstanceRequest.
502
-
503
- A list of files that should be associated with the model
504
- instance version # noqa: E501
505
-
506
- :param files: The files of this ModelNewInstanceRequest. #
507
- noqa: E501
508
- :type: list[UploadFile]
509
- """
510
-
511
- self._files = files
512
-
513
- def to_dict(self):
514
- """Returns the model properties as a dict."""
515
- result = {}
516
-
517
- for attr, _ in six.iteritems(self.project_types):
518
- value = getattr(self, attr)
519
- if isinstance(value, list):
520
- result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
521
- elif hasattr(value, "to_dict"):
522
- result[attr] = value.to_dict()
523
- elif isinstance(value, dict):
524
- result[attr] = dict(
525
- map(
526
- lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
527
- value.items(),
528
- )
529
- )
530
- else:
531
- result[attr] = value
532
-
533
- return result
534
-
535
- def to_str(self):
536
- """Returns the string representation of the model."""
537
- return pprint.pformat(self.to_dict())
538
-
539
- def __repr__(self):
540
- """For `print` and `pprint`"""
541
- return self.to_str()
542
-
543
- def __eq__(self, other):
544
- """Returns true if both objects are equal."""
545
- if not isinstance(other, ModelNewInstanceRequest):
546
- return False
547
-
548
- return self.__dict__ == other.__dict__
549
-
550
- def __ne__(self, other):
551
- """Returns true if both objects are not equal."""
552
- return not self == other