Skip to content

Commit 69629f7

Browse files
authored
Release 1.6.1 (#537)
1 parent 75dfa27 commit 69629f7

32 files changed

+335
-52
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
Changelog
22
====
33

4+
### 1.6.1
5+
Release date: 01/08/24
6+
* Fix dataset/model upload.
7+
8+
### 1.6.0
9+
Release date: 01/04/24
10+
* Release the pre-release branch with models endpoints.
11+
12+
#### 1.6.0a7
13+
Release date: 11/22/23
14+
* Add model_instance_type and base_model_instance_id to ModelInstance
15+
16+
#### 1.6.0a6
17+
Release date: 9/19/23
18+
* Include version_number and version_id in the model-instance-metadata.json file
19+
20+
#### 1.6.0a5
21+
Release date: 8/02/23
22+
* Add Keras framework
23+
424
#### 1.5.16
525
Release date: 7/17/23
626
* Fix dataset download bug with locale
27+
* Resumable uploads
28+
* Retry some failed requests
729

830
#### 1.6.0a4
931
Release date: 7/07/23

KaggleSwagger.yaml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,7 @@ definitions:
15361536
- FDL-1.3
15371537
- EU-ODP-Legal-Notice
15381538
- apache-2.0
1539+
- GPL-3.0
15391540
subtitle:
15401541
type: string
15411542
description: The subtitle to be set on the dataset
@@ -1713,7 +1714,8 @@ definitions:
17131714
- AGPL-3.0
17141715
- FDL-1.3
17151716
- EU-ODP-Legal-Notice
1716-
- apache-2.0
1717+
- apache-2.0
1718+
- GPL-3.0
17171719
Collaborator:
17181720
type: object
17191721
required:
@@ -1818,6 +1820,7 @@ definitions:
18181820
- scikitLearn
18191821
- mxnet
18201822
- onnx
1823+
- keras
18211824
overview:
18221825
type: string
18231826
description: The overview of the model instance (markdown)
@@ -1826,7 +1829,7 @@ definitions:
18261829
description: The description of how to use the model instance (markdown)
18271830
licenseName:
18281831
type: string
1829-
description: The license that should be associated with the model
1832+
description: The license that should be associated with the model instance
18301833
default: Apache 2.0
18311834
enum:
18321835
- CC0: Public Domain
@@ -1851,6 +1854,7 @@ definitions:
18511854
- Apache 2.0
18521855
- MIT
18531856
- BSD-3-Clause
1857+
- GPL 3
18541858
fineTunable:
18551859
type: boolean
18561860
description: Whether the model instance is fine tunable
@@ -1860,6 +1864,20 @@ definitions:
18601864
description: A list of training data (urls or names)
18611865
items:
18621866
type: string
1867+
modelInstanceType:
1868+
type: string
1869+
description: Whether the model instance is a base model, external variant, internal variant, or unspecified
1870+
enum:
1871+
- Unspecified
1872+
- BaseModel
1873+
- KaggleVariant
1874+
- ExternalVariant
1875+
baseModelInstance:
1876+
type: string
1877+
description: If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance
1878+
externalBaseModelUrl:
1879+
type: integer
1880+
description: If this is an external variant, a URL to the base model
18631881
files:
18641882
type: array
18651883
description: A list of files that should be associated with the model instance version
@@ -1878,7 +1896,7 @@ definitions:
18781896
description: The description of how to use the model instance (markdown)
18791897
licenseName:
18801898
type: string
1881-
description: The license that should be associated with the model
1899+
description: The license that should be associated with the model instance
18821900
default: Apache 2.0
18831901
enum:
18841902
- CC0: Public Domain
@@ -1903,6 +1921,7 @@ definitions:
19031921
- Apache 2.0
19041922
- MIT
19051923
- BSD-3-Clause
1924+
- GPL 3
19061925
fineTunable:
19071926
type: boolean
19081927
description: Whether the model instance is fine tunable
@@ -1912,6 +1931,20 @@ definitions:
19121931
description: A list of training data (urls or names)
19131932
items:
19141933
type: string
1934+
modelInstanceType:
1935+
type: string
1936+
description: Whether the model instance is a base model, external variant, internal variant, or unspecified
1937+
enum:
1938+
- Unspecified
1939+
- BaseModel
1940+
- KaggleVariant
1941+
- ExternalVariant
1942+
baseModelInstance:
1943+
type: string
1944+
description: If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance
1945+
externalBaseModelUrl:
1946+
type: integer
1947+
description: If this is an external variant, a URL to the base model
19151948
updateMask:
19161949
type: string
19171950
description: Describes which fields to update

kaggle/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/api/kaggle_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/api/kaggle_api_extended.py

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -271,7 +271,7 @@ def __repr__(self):
271271

272272

273273
class KaggleApi(KaggleApi):
274-
__version__ = '1.5.16'
274+
__version__ = '1.6.1'
275275

276276
CONFIG_NAME_PROXY = 'proxy'
277277
CONFIG_NAME_COMPETITION = 'competition'
@@ -909,7 +909,7 @@ def competition_download_file(self,
909909
""" download a competition file to a designated location, or use
910910
a default location
911911
912-
Paramters
912+
Parameters
913913
=========
914914
competition: the name of the competition
915915
file_name: the configuration file name
@@ -2880,6 +2880,16 @@ def model_instance_get_cli(self, model_instance, folder=None):
28802880
data['licenseName'] = mi['licenseName']
28812881
data['fineTunable'] = mi['fineTunable']
28822882
data['trainingData'] = mi['trainingData']
2883+
data['versionId'] = mi['versionId']
2884+
data['versionNumber'] = mi['versionNumber']
2885+
data['modelInstanceType'] = mi['modelInstanceType']
2886+
if mi['baseModelInstanceInformation'] is not None:
2887+
data['baseModelInstance'] = '{}/{}/{}/{}'.format(
2888+
mi['baseModelInstanceInformation']['owner']['slug'],
2889+
mi['baseModelInstanceInformation']['modelSlug'],
2890+
mi['baseModelInstanceInformation']['framework'],
2891+
mi['baseModelInstanceInformation']['instanceSlug'])
2892+
data['externalBaseModelUrl'] = mi['externalBaseModelUrl']
28832893

28842894
with open(meta_file, 'w') as f:
28852895
json.dump(data, f, indent=2)
@@ -2924,7 +2934,13 @@ def model_instance_initialize(self, folder):
29242934
'Apache 2.0',
29252935
'fineTunable':
29262936
False,
2927-
'trainingData': []
2937+
'trainingData': [],
2938+
'modelInstanceType':
2939+
'Unspecified',
2940+
'baseModelInstanceId':
2941+
0,
2942+
'externalBaseModelUrl':
2943+
''
29282944
}
29292945
meta_file = os.path.join(folder, self.MODEL_INSTANCE_METADATA_FILE)
29302946
with open(meta_file, 'w') as f:
@@ -2964,6 +2980,12 @@ def model_instance_create(self, folder, quiet=False, dir_mode='skip'):
29642980
license_name = self.get_or_fail(meta_data, 'licenseName')
29652981
fine_tunable = self.get_or_default(meta_data, 'fineTunable', False)
29662982
training_data = self.get_or_default(meta_data, 'trainingData', [])
2983+
model_instance_type = self.get_or_default(
2984+
meta_data, 'modelInstanceType', 'Unspecified')
2985+
base_model_instance = self.get_or_default(meta_data,
2986+
'baseModelInstance', '')
2987+
external_base_model_url = self.get_or_default(
2988+
meta_data, 'externalBaseModelUrl', '')
29672989

29682990
# validations
29692991
if owner_slug == 'INSERT_OWNER_SLUG_HERE':
@@ -2997,6 +3019,9 @@ def model_instance_create(self, folder, quiet=False, dir_mode='skip'):
29973019
license_name=license_name,
29983020
fine_tunable=fine_tunable,
29993021
training_data=training_data,
3022+
model_instance_type=model_instance_type,
3023+
base_model_instance=base_model_instance,
3024+
external_base_model_url=external_base_model_url,
30003025
files=[])
30013026

30023027
with ResumableUploadContext() as upload_context:
@@ -3089,6 +3114,12 @@ def model_instance_update(self, folder):
30893114
license_name = self.get_or_default(meta_data, 'licenseName', None)
30903115
fine_tunable = self.get_or_default(meta_data, 'fineTunable', None)
30913116
training_data = self.get_or_default(meta_data, 'trainingData', None)
3117+
model_instance_type = self.get_or_default(meta_data,
3118+
'modelInstanceType', None)
3119+
base_model_instance = self.get_or_default(meta_data,
3120+
'baseModelInstance', None)
3121+
external_base_model_url = self.get_or_default(
3122+
meta_data, 'externalBaseModelUrl', None)
30923123

30933124
# validations
30943125
if owner_slug == 'INSERT_OWNER_SLUG_HERE':
@@ -3128,13 +3159,22 @@ def model_instance_update(self, folder):
31283159
update_mask['paths'].append('fine_tunable')
31293160
if training_data != None:
31303161
update_mask['paths'].append('training_data')
3162+
if model_instance_type != None:
3163+
update_mask['paths'].append('model_instance_type')
3164+
if base_model_instance != None:
3165+
update_mask['paths'].append('base_model_instance')
3166+
if external_base_model_url != None:
3167+
update_mask['paths'].append('external_base_model_url')
31313168

31323169
request = ModelInstanceUpdateRequest(
31333170
overview=overview,
31343171
usage=usage,
31353172
license_name=license_name,
31363173
fine_tunable=fine_tunable,
31373174
training_data=training_data,
3175+
model_instance_type=model_instance_type,
3176+
base_model_instance=base_model_instance,
3177+
external_base_model_url=external_base_model_url,
31383178
update_mask=update_mask)
31393179
result = ModelNewResponse(
31403180
self.process_response(
@@ -3283,6 +3323,7 @@ def model_instance_version_download(self,
32833323
os.remove(outfile)
32843324
except OSError as e:
32853325
print('Could not delete tar file, got %s' % e)
3326+
return outfile
32863327

32873328
def model_instance_version_download_cli(self,
32883329
model_instance_version,
@@ -3301,7 +3342,7 @@ def model_instance_version_download_cli(self,
33013342
quiet: suppress verbose output (default is False)
33023343
untar: if True, untar files upon download (default is False)
33033344
"""
3304-
self.model_instance_version_download(
3345+
return self.model_instance_version_download(
33053346
model_instance_version,
33063347
path=path,
33073348
untar=untar,
@@ -3528,6 +3569,9 @@ def process_response(self, result):
35283569
'Version, please consider updating (server ' +
35293570
api_version + ' / client ' + self.__version__ + ')')
35303571
self.already_printed_version_warning = True
3572+
if isinstance(data,
3573+
dict) and 'code' in data and data['code'] != 200:
3574+
raise Exception(data['message'])
35313575
return data
35323576
return result
35333577

kaggle/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/cli.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ def main():
5757
parse_competitions(subparsers)
5858
parse_datasets(subparsers)
5959
parse_kernels(subparsers)
60-
# parse_models(subparsers)
60+
parse_models(subparsers)
6161
parse_files(subparsers)
6262
parse_config(subparsers)
6363
args = parser.parse_args()
@@ -1347,8 +1347,12 @@ class Help(object):
13471347
kaggle = 'Use one of:\ncompetitions {' + ', '.join(
13481348
competitions_choices) + '}\ndatasets {' + ', '.join(
13491349
datasets_choices) + '}\nkernels {' + ', '.join(
1350-
kernels_choices) + '}\nconfig {' + ', '.join(
1351-
config_choices) + '}'
1350+
kernels_choices) + '}\nmodels {' + ', '.join(
1351+
models_choices) + '}\nmodels instances {' + ', '.join(
1352+
model_instances_choices
1353+
) + '}\nmodels instances versions {' + ', '.join(
1354+
model_instance_versions_choices
1355+
) + '}\nconfig {' + ', '.join(config_choices) + '}'
13521356

13531357
group_competitions = 'Commands related to Kaggle competitions'
13541358
group_datasets = 'Commands related to Kaggle datasets'

kaggle/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/models/api_blob_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/models/collaborator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/models/create_inbox_file_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

kaggle/models/dataset_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
#
3-
# Copyright 2023 Kaggle Inc
3+
# Copyright 2024 Kaggle Inc
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)