From 643a053d54a5760630e6c3d274f31262a1892609 Mon Sep 17 00:00:00 2001 From: Philippe Modard Date: Mon, 8 Jan 2024 15:53:22 +0000 Subject: [PATCH] Release 1.6.1 --- CHANGELOG.md | 22 ++++ KaggleSwagger.yaml | 39 ++++++- kaggle/__init__.py | 2 +- kaggle/api/__init__.py | 2 +- kaggle/api/kaggle_api.py | 2 +- kaggle/api/kaggle_api_extended.py | 54 +++++++++- kaggle/api_client.py | 2 +- kaggle/cli.py | 12 ++- kaggle/configuration.py | 2 +- kaggle/models/__init__.py | 2 +- kaggle/models/api_blob_type.py | 2 +- kaggle/models/collaborator.py | 2 +- kaggle/models/create_inbox_file_request.py | 2 +- kaggle/models/dataset_column.py | 2 +- kaggle/models/dataset_new_request.py | 4 +- kaggle/models/dataset_new_version_request.py | 2 +- .../models/dataset_update_settings_request.py | 2 +- kaggle/models/error.py | 2 +- kaggle/models/kaggle_models_extended.py | 2 +- kaggle/models/kernel_push_request.py | 2 +- kaggle/models/license.py | 4 +- .../model_instance_new_version_request.py | 2 +- .../models/model_instance_update_request.py | 100 ++++++++++++++++- kaggle/models/model_new_instance_request.py | 102 ++++++++++++++++-- kaggle/models/model_new_request.py | 2 +- kaggle/models/model_update_request.py | 2 +- kaggle/models/result.py | 2 +- kaggle/models/start_blob_upload_request.py | 2 +- kaggle/models/start_blob_upload_response.py | 2 +- kaggle/models/upload_file.py | 2 +- kaggle/rest.py | 2 +- setup.py | 4 +- 32 files changed, 335 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48821ef..612dec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,31 @@ Changelog ==== +### 1.6.1 +Release date: 01/08/24 +* Fix dataset/model upload. + +### 1.6.0 +Release date: 01/04/24 +* Release the pre-release branch with models endpoints. + +#### 1.6.0a7 +Release date: 11/22/23 +* Add model_instance_type and base_model_instance_id to ModelInstance + +#### 1.6.0a6 +Release date: 9/19/23 +* Include version_number and version_id in the model-instance-metadata.json file + +#### 1.6.0a5 +Release date: 8/02/23 +* Add Keras framework + #### 1.5.16 Release date: 7/17/23 * Fix dataset download bug with locale +* Resumable uploads +* Retry some failed requests #### 1.6.0a4 Release date: 7/07/23 diff --git a/KaggleSwagger.yaml b/KaggleSwagger.yaml index eb3fa61..c0689b8 100644 --- a/KaggleSwagger.yaml +++ b/KaggleSwagger.yaml @@ -1536,6 +1536,7 @@ definitions: - FDL-1.3 - EU-ODP-Legal-Notice - apache-2.0 + - GPL-3.0 subtitle: type: string description: The subtitle to be set on the dataset @@ -1713,7 +1714,8 @@ definitions: - AGPL-3.0 - FDL-1.3 - EU-ODP-Legal-Notice - - apache-2.0 + - apache-2.0 + - GPL-3.0 Collaborator: type: object required: @@ -1818,6 +1820,7 @@ definitions: - scikitLearn - mxnet - onnx + - keras overview: type: string description: The overview of the model instance (markdown) @@ -1826,7 +1829,7 @@ definitions: description: The description of how to use the model instance (markdown) licenseName: type: string - description: The license that should be associated with the model + description: The license that should be associated with the model instance default: Apache 2.0 enum: - CC0: Public Domain @@ -1851,6 +1854,7 @@ definitions: - Apache 2.0 - MIT - BSD-3-Clause + - GPL 3 fineTunable: type: boolean description: Whether the model instance is fine tunable @@ -1860,6 +1864,20 @@ definitions: description: A list of training data (urls or names) items: type: string + modelInstanceType: + type: string + description: Whether the model instance is a base model, external variant, internal variant, or unspecified + enum: + - Unspecified + - BaseModel + - KaggleVariant + - ExternalVariant + baseModelInstance: + type: string + description: If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance + externalBaseModelUrl: + type: integer + description: If this is an external variant, a URL to the base model files: type: array description: A list of files that should be associated with the model instance version @@ -1878,7 +1896,7 @@ definitions: description: The description of how to use the model instance (markdown) licenseName: type: string - description: The license that should be associated with the model + description: The license that should be associated with the model instance default: Apache 2.0 enum: - CC0: Public Domain @@ -1903,6 +1921,7 @@ definitions: - Apache 2.0 - MIT - BSD-3-Clause + - GPL 3 fineTunable: type: boolean description: Whether the model instance is fine tunable @@ -1912,6 +1931,20 @@ definitions: description: A list of training data (urls or names) items: type: string + modelInstanceType: + type: string + description: Whether the model instance is a base model, external variant, internal variant, or unspecified + enum: + - Unspecified + - BaseModel + - KaggleVariant + - ExternalVariant + baseModelInstance: + type: string + description: If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance + externalBaseModelUrl: + type: integer + description: If this is an external variant, a URL to the base model updateMask: type: string description: Describes which fields to update diff --git a/kaggle/__init__.py b/kaggle/__init__.py index e63b465..4d2f819 100644 --- a/kaggle/__init__.py +++ b/kaggle/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/api/__init__.py b/kaggle/api/__init__.py index c8a9a41..bd47882 100644 --- a/kaggle/api/__init__.py +++ b/kaggle/api/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/api/kaggle_api.py b/kaggle/api/kaggle_api.py index 016ff69..114e35b 100644 --- a/kaggle/api/kaggle_api.py +++ b/kaggle/api/kaggle_api.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/api/kaggle_api_extended.py b/kaggle/api/kaggle_api_extended.py index c4e4891..69fb506 100644 --- a/kaggle/api/kaggle_api_extended.py +++ b/kaggle/api/kaggle_api_extended.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -271,7 +271,7 @@ def __repr__(self): class KaggleApi(KaggleApi): - __version__ = '1.5.16' + __version__ = '1.6.1' CONFIG_NAME_PROXY = 'proxy' CONFIG_NAME_COMPETITION = 'competition' @@ -909,7 +909,7 @@ def competition_download_file(self, """ download a competition file to a designated location, or use a default location - Paramters + Parameters ========= competition: the name of the competition file_name: the configuration file name @@ -2880,6 +2880,16 @@ def model_instance_get_cli(self, model_instance, folder=None): data['licenseName'] = mi['licenseName'] data['fineTunable'] = mi['fineTunable'] data['trainingData'] = mi['trainingData'] + data['versionId'] = mi['versionId'] + data['versionNumber'] = mi['versionNumber'] + data['modelInstanceType'] = mi['modelInstanceType'] + if mi['baseModelInstanceInformation'] is not None: + data['baseModelInstance'] = '{}/{}/{}/{}'.format( + mi['baseModelInstanceInformation']['owner']['slug'], + mi['baseModelInstanceInformation']['modelSlug'], + mi['baseModelInstanceInformation']['framework'], + mi['baseModelInstanceInformation']['instanceSlug']) + data['externalBaseModelUrl'] = mi['externalBaseModelUrl'] with open(meta_file, 'w') as f: json.dump(data, f, indent=2) @@ -2924,7 +2934,13 @@ def model_instance_initialize(self, folder): 'Apache 2.0', 'fineTunable': False, - 'trainingData': [] + 'trainingData': [], + 'modelInstanceType': + 'Unspecified', + 'baseModelInstanceId': + 0, + 'externalBaseModelUrl': + '' } meta_file = os.path.join(folder, self.MODEL_INSTANCE_METADATA_FILE) with open(meta_file, 'w') as f: @@ -2964,6 +2980,12 @@ def model_instance_create(self, folder, quiet=False, dir_mode='skip'): license_name = self.get_or_fail(meta_data, 'licenseName') fine_tunable = self.get_or_default(meta_data, 'fineTunable', False) training_data = self.get_or_default(meta_data, 'trainingData', []) + model_instance_type = self.get_or_default( + meta_data, 'modelInstanceType', 'Unspecified') + base_model_instance = self.get_or_default(meta_data, + 'baseModelInstance', '') + external_base_model_url = self.get_or_default( + meta_data, 'externalBaseModelUrl', '') # validations if owner_slug == 'INSERT_OWNER_SLUG_HERE': @@ -2997,6 +3019,9 @@ def model_instance_create(self, folder, quiet=False, dir_mode='skip'): license_name=license_name, fine_tunable=fine_tunable, training_data=training_data, + model_instance_type=model_instance_type, + base_model_instance=base_model_instance, + external_base_model_url=external_base_model_url, files=[]) with ResumableUploadContext() as upload_context: @@ -3089,6 +3114,12 @@ def model_instance_update(self, folder): license_name = self.get_or_default(meta_data, 'licenseName', None) fine_tunable = self.get_or_default(meta_data, 'fineTunable', None) training_data = self.get_or_default(meta_data, 'trainingData', None) + model_instance_type = self.get_or_default(meta_data, + 'modelInstanceType', None) + base_model_instance = self.get_or_default(meta_data, + 'baseModelInstance', None) + external_base_model_url = self.get_or_default( + meta_data, 'externalBaseModelUrl', None) # validations if owner_slug == 'INSERT_OWNER_SLUG_HERE': @@ -3128,6 +3159,12 @@ def model_instance_update(self, folder): update_mask['paths'].append('fine_tunable') if training_data != None: update_mask['paths'].append('training_data') + if model_instance_type != None: + update_mask['paths'].append('model_instance_type') + if base_model_instance != None: + update_mask['paths'].append('base_model_instance') + if external_base_model_url != None: + update_mask['paths'].append('external_base_model_url') request = ModelInstanceUpdateRequest( overview=overview, @@ -3135,6 +3172,9 @@ def model_instance_update(self, folder): license_name=license_name, fine_tunable=fine_tunable, training_data=training_data, + model_instance_type=model_instance_type, + base_model_instance=base_model_instance, + external_base_model_url=external_base_model_url, update_mask=update_mask) result = ModelNewResponse( self.process_response( @@ -3283,6 +3323,7 @@ def model_instance_version_download(self, os.remove(outfile) except OSError as e: print('Could not delete tar file, got %s' % e) + return outfile def model_instance_version_download_cli(self, model_instance_version, @@ -3301,7 +3342,7 @@ def model_instance_version_download_cli(self, quiet: suppress verbose output (default is False) untar: if True, untar files upon download (default is False) """ - self.model_instance_version_download( + return self.model_instance_version_download( model_instance_version, path=path, untar=untar, @@ -3528,6 +3569,9 @@ def process_response(self, result): 'Version, please consider updating (server ' + api_version + ' / client ' + self.__version__ + ')') self.already_printed_version_warning = True + if isinstance(data, + dict) and 'code' in data and data['code'] != 200: + raise Exception(data['message']) return data return result diff --git a/kaggle/api_client.py b/kaggle/api_client.py index 9c82b11..a13ef35 100644 --- a/kaggle/api_client.py +++ b/kaggle/api_client.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/cli.py b/kaggle/cli.py index 1bc864c..4b860b5 100644 --- a/kaggle/cli.py +++ b/kaggle/cli.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ def main(): parse_competitions(subparsers) parse_datasets(subparsers) parse_kernels(subparsers) - # parse_models(subparsers) + parse_models(subparsers) parse_files(subparsers) parse_config(subparsers) args = parser.parse_args() @@ -1347,8 +1347,12 @@ class Help(object): kaggle = 'Use one of:\ncompetitions {' + ', '.join( competitions_choices) + '}\ndatasets {' + ', '.join( datasets_choices) + '}\nkernels {' + ', '.join( - kernels_choices) + '}\nconfig {' + ', '.join( - config_choices) + '}' + kernels_choices) + '}\nmodels {' + ', '.join( + models_choices) + '}\nmodels instances {' + ', '.join( + model_instances_choices + ) + '}\nmodels instances versions {' + ', '.join( + model_instance_versions_choices + ) + '}\nconfig {' + ', '.join(config_choices) + '}' group_competitions = 'Commands related to Kaggle competitions' group_datasets = 'Commands related to Kaggle datasets' diff --git a/kaggle/configuration.py b/kaggle/configuration.py index 40a1121..4308e17 100644 --- a/kaggle/configuration.py +++ b/kaggle/configuration.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/__init__.py b/kaggle/models/__init__.py index 04b9c59..999007e 100644 --- a/kaggle/models/__init__.py +++ b/kaggle/models/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/api_blob_type.py b/kaggle/models/api_blob_type.py index b6d4362..dc6e44e 100644 --- a/kaggle/models/api_blob_type.py +++ b/kaggle/models/api_blob_type.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/collaborator.py b/kaggle/models/collaborator.py index c15b568..16c5d6c 100644 --- a/kaggle/models/collaborator.py +++ b/kaggle/models/collaborator.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/create_inbox_file_request.py b/kaggle/models/create_inbox_file_request.py index e40934e..cc40603 100644 --- a/kaggle/models/create_inbox_file_request.py +++ b/kaggle/models/create_inbox_file_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/dataset_column.py b/kaggle/models/dataset_column.py index 17a5bf8..72008d2 100644 --- a/kaggle/models/dataset_column.py +++ b/kaggle/models/dataset_column.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/dataset_new_request.py b/kaggle/models/dataset_new_request.py index f1b3811..175a542 100644 --- a/kaggle/models/dataset_new_request.py +++ b/kaggle/models/dataset_new_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -199,7 +199,7 @@ def license_name(self, license_name): :param license_name: The license_name of this DatasetNewRequest. # noqa: E501 :type: str """ - allowed_values = ["CC0-1.0", "CC-BY-SA-4.0", "GPL-2.0", "ODbL-1.0", "CC-BY-NC-SA-4.0", "unknown", "DbCL-1.0", "CC-BY-SA-3.0", "copyright-authors", "other", "reddit-api", "world-bank", "CC-BY-4.0", "CC-BY-NC-4.0", "PDDL", "CC-BY-3.0", "CC-BY-3.0-IGO", "US-Government-Works", "CC-BY-NC-SA-3.0-IGO", "CDLA-Permissive-1.0", "CDLA-Sharing-1.0", "CC-BY-ND-4.0", "CC-BY-NC-ND-4.0", "ODC-BY-1.0", "LGPL-3.0", "AGPL-3.0", "FDL-1.3", "EU-ODP-Legal-Notice", "apache-2.0"] # noqa: E501 + allowed_values = ["CC0-1.0", "CC-BY-SA-4.0", "GPL-2.0", "ODbL-1.0", "CC-BY-NC-SA-4.0", "unknown", "DbCL-1.0", "CC-BY-SA-3.0", "copyright-authors", "other", "reddit-api", "world-bank", "CC-BY-4.0", "CC-BY-NC-4.0", "PDDL", "CC-BY-3.0", "CC-BY-3.0-IGO", "US-Government-Works", "CC-BY-NC-SA-3.0-IGO", "CDLA-Permissive-1.0", "CDLA-Sharing-1.0", "CC-BY-ND-4.0", "CC-BY-NC-ND-4.0", "ODC-BY-1.0", "LGPL-3.0", "AGPL-3.0", "FDL-1.3", "EU-ODP-Legal-Notice", "apache-2.0", "GPL-3.0"] # noqa: E501 if license_name not in allowed_values: raise ValueError( "Invalid value for `license_name` ({0}), must be one of {1}" # noqa: E501 diff --git a/kaggle/models/dataset_new_version_request.py b/kaggle/models/dataset_new_version_request.py index 9f54c07..941184f 100644 --- a/kaggle/models/dataset_new_version_request.py +++ b/kaggle/models/dataset_new_version_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/dataset_update_settings_request.py b/kaggle/models/dataset_update_settings_request.py index 6a6597d..eef92f1 100644 --- a/kaggle/models/dataset_update_settings_request.py +++ b/kaggle/models/dataset_update_settings_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/error.py b/kaggle/models/error.py index 740d68e..ac7253e 100644 --- a/kaggle/models/error.py +++ b/kaggle/models/error.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/kaggle_models_extended.py b/kaggle/models/kaggle_models_extended.py index fc222a0..d15bc27 100644 --- a/kaggle/models/kaggle_models_extended.py +++ b/kaggle/models/kaggle_models_extended.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/kernel_push_request.py b/kaggle/models/kernel_push_request.py index a81e5ec..8d7cac8 100644 --- a/kaggle/models/kernel_push_request.py +++ b/kaggle/models/kernel_push_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/license.py b/kaggle/models/license.py index 417f49d..0135e8e 100644 --- a/kaggle/models/license.py +++ b/kaggle/models/license.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ def name(self, name): """ if name is None: raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - allowed_values = ["CC0-1.0", "CC-BY-SA-4.0", "GPL-2.0", "ODbL-1.0", "CC-BY-NC-SA-4.0", "unknown", "DbCL-1.0", "CC-BY-SA-3.0", "copyright-authors", "other", "reddit-api", "world-bank", "CC-BY-4.0", "CC-BY-NC-4.0", "PDDL", "CC-BY-3.0", "CC-BY-3.0-IGO", "US-Government-Works", "CC-BY-NC-SA-3.0-IGO", "CDLA-Permissive-1.0", "CDLA-Sharing-1.0", "CC-BY-ND-4.0", "CC-BY-NC-ND-4.0", "ODC-BY-1.0", "LGPL-3.0", "AGPL-3.0", "FDL-1.3", "EU-ODP-Legal-Notice", "apache-2.0"] # noqa: E501 + allowed_values = ["CC0-1.0", "CC-BY-SA-4.0", "GPL-2.0", "ODbL-1.0", "CC-BY-NC-SA-4.0", "unknown", "DbCL-1.0", "CC-BY-SA-3.0", "copyright-authors", "other", "reddit-api", "world-bank", "CC-BY-4.0", "CC-BY-NC-4.0", "PDDL", "CC-BY-3.0", "CC-BY-3.0-IGO", "US-Government-Works", "CC-BY-NC-SA-3.0-IGO", "CDLA-Permissive-1.0", "CDLA-Sharing-1.0", "CC-BY-ND-4.0", "CC-BY-NC-ND-4.0", "ODC-BY-1.0", "LGPL-3.0", "AGPL-3.0", "FDL-1.3", "EU-ODP-Legal-Notice", "apache-2.0", "GPL-3.0"] # noqa: E501 if name not in allowed_values: raise ValueError( "Invalid value for `name` ({0}), must be one of {1}" # noqa: E501 diff --git a/kaggle/models/model_instance_new_version_request.py b/kaggle/models/model_instance_new_version_request.py index 107095b..d6bdb9e 100644 --- a/kaggle/models/model_instance_new_version_request.py +++ b/kaggle/models/model_instance_new_version_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/model_instance_update_request.py b/kaggle/models/model_instance_update_request.py index 3e9eda4..9288b70 100644 --- a/kaggle/models/model_instance_update_request.py +++ b/kaggle/models/model_instance_update_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,6 +52,9 @@ class ModelInstanceUpdateRequest(object): 'license_name': 'str', 'fine_tunable': 'bool', 'training_data': 'list[str]', + 'model_instance_type': 'str', + 'base_model_instance': 'str', + 'external_base_model_url': 'int', 'update_mask': 'str' } @@ -61,10 +64,13 @@ class ModelInstanceUpdateRequest(object): 'license_name': 'licenseName', 'fine_tunable': 'fineTunable', 'training_data': 'trainingData', + 'model_instance_type': 'modelInstanceType', + 'base_model_instance': 'baseModelInstance', + 'external_base_model_url': 'externalBaseModelUrl', 'update_mask': 'updateMask' } - def __init__(self, overview=None, usage=None, license_name='Apache 2.0', fine_tunable=True, training_data=None, update_mask=None): # noqa: E501 + def __init__(self, overview=None, usage=None, license_name='Apache 2.0', fine_tunable=True, training_data=None, model_instance_type=None, base_model_instance=None, external_base_model_url=None, update_mask=None): # noqa: E501 """ModelInstanceUpdateRequest - a model defined in Swagger""" # noqa: E501 self._overview = None @@ -72,6 +78,9 @@ def __init__(self, overview=None, usage=None, license_name='Apache 2.0', fine_tu self._license_name = None self._fine_tunable = None self._training_data = None + self._model_instance_type = None + self._base_model_instance = None + self._external_base_model_url = None self._update_mask = None self.discriminator = None @@ -85,6 +94,12 @@ def __init__(self, overview=None, usage=None, license_name='Apache 2.0', fine_tu self.fine_tunable = fine_tunable if training_data is not None: self.training_data = training_data + if model_instance_type is not None: + self.model_instance_type = model_instance_type + if base_model_instance is not None: + self.base_model_instance = base_model_instance + if external_base_model_url is not None: + self.external_base_model_url = external_base_model_url self.update_mask = update_mask @property @@ -137,7 +152,7 @@ def usage(self, usage): def license_name(self): """Gets the license_name of this ModelInstanceUpdateRequest. # noqa: E501 - The license that should be associated with the model # noqa: E501 + The license that should be associated with the model instance # noqa: E501 :return: The license_name of this ModelInstanceUpdateRequest. # noqa: E501 :rtype: str @@ -148,12 +163,12 @@ def license_name(self): def license_name(self, license_name): """Sets the license_name of this ModelInstanceUpdateRequest. - The license that should be associated with the model # noqa: E501 + The license that should be associated with the model instance # noqa: E501 :param license_name: The license_name of this ModelInstanceUpdateRequest. # noqa: E501 :type: str """ - allowed_values = ["CC BY-NC-SA 4.0", "CC BY-SA 4.0", "GPL 2", "CC BY-SA 3.0", "Attribution 4.0 International (CC BY 4.0)", "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)", "ODC Public Domain Dedication and Licence (PDDL)", "Attribution 3.0 Unported (CC BY 3.0)", "Attribution 3.0 IGO (CC BY 3.0 IGO)", "Attribution-NonCommercial-ShareAlike 3.0 IGO (CC BY-NC-SA 3.0 IGO)", "Community Data License Agreement - Permissive - Version 1.0", "Community Data License Agreement - Sharing - Version 1.0", "Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)", "Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)", "ODC Attribution License (ODC-By)", "GNU Lesser General Public License 3.0", "GNU Affero General Public License 3.0", "GNU Free Documentation License 1.3", "Apache 2.0", "MIT", "BSD-3-Clause"] # noqa: E501 + allowed_values = ["CC BY-NC-SA 4.0", "CC BY-SA 4.0", "GPL 2", "CC BY-SA 3.0", "Attribution 4.0 International (CC BY 4.0)", "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)", "ODC Public Domain Dedication and Licence (PDDL)", "Attribution 3.0 Unported (CC BY 3.0)", "Attribution 3.0 IGO (CC BY 3.0 IGO)", "Attribution-NonCommercial-ShareAlike 3.0 IGO (CC BY-NC-SA 3.0 IGO)", "Community Data License Agreement - Permissive - Version 1.0", "Community Data License Agreement - Sharing - Version 1.0", "Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)", "Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)", "ODC Attribution License (ODC-By)", "GNU Lesser General Public License 3.0", "GNU Affero General Public License 3.0", "GNU Free Documentation License 1.3", "Apache 2.0", "MIT", "BSD-3-Clause", "GPL 3"] # noqa: E501 if license_name not in allowed_values: raise ValueError( "Invalid value for `license_name` ({0}), must be one of {1}" # noqa: E501 @@ -208,6 +223,81 @@ def training_data(self, training_data): self._training_data = training_data + @property + def model_instance_type(self): + """Gets the model_instance_type of this ModelInstanceUpdateRequest. # noqa: E501 + + Whether the model instance is a base model, external variant, internal variant, or unspecified # noqa: E501 + + :return: The model_instance_type of this ModelInstanceUpdateRequest. # noqa: E501 + :rtype: str + """ + return self._model_instance_type + + @model_instance_type.setter + def model_instance_type(self, model_instance_type): + """Sets the model_instance_type of this ModelInstanceUpdateRequest. + + Whether the model instance is a base model, external variant, internal variant, or unspecified # noqa: E501 + + :param model_instance_type: The model_instance_type of this ModelInstanceUpdateRequest. # noqa: E501 + :type: str + """ + allowed_values = ["Unspecified", "BaseModel", "KaggleVariant", "ExternalVariant"] # noqa: E501 + if model_instance_type not in allowed_values: + raise ValueError( + "Invalid value for `model_instance_type` ({0}), must be one of {1}" # noqa: E501 + .format(model_instance_type, allowed_values) + ) + + self._model_instance_type = model_instance_type + + @property + def base_model_instance(self): + """Gets the base_model_instance of this ModelInstanceUpdateRequest. # noqa: E501 + + If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance # noqa: E501 + + :return: The base_model_instance of this ModelInstanceUpdateRequest. # noqa: E501 + :rtype: str + """ + return self._base_model_instance + + @base_model_instance.setter + def base_model_instance(self, base_model_instance): + """Sets the base_model_instance of this ModelInstanceUpdateRequest. + + If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance # noqa: E501 + + :param base_model_instance: The base_model_instance of this ModelInstanceUpdateRequest. # noqa: E501 + :type: str + """ + + self._base_model_instance = base_model_instance + + @property + def external_base_model_url(self): + """Gets the external_base_model_url of this ModelInstanceUpdateRequest. # noqa: E501 + + If this is an external variant, a URL to the base model # noqa: E501 + + :return: The external_base_model_url of this ModelInstanceUpdateRequest. # noqa: E501 + :rtype: int + """ + return self._external_base_model_url + + @external_base_model_url.setter + def external_base_model_url(self, external_base_model_url): + """Sets the external_base_model_url of this ModelInstanceUpdateRequest. + + If this is an external variant, a URL to the base model # noqa: E501 + + :param external_base_model_url: The external_base_model_url of this ModelInstanceUpdateRequest. # noqa: E501 + :type: int + """ + + self._external_base_model_url = external_base_model_url + @property def update_mask(self): """Gets the update_mask of this ModelInstanceUpdateRequest. # noqa: E501 diff --git a/kaggle/models/model_new_instance_request.py b/kaggle/models/model_new_instance_request.py index 8534ca7..36aed21 100644 --- a/kaggle/models/model_new_instance_request.py +++ b/kaggle/models/model_new_instance_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -56,6 +56,9 @@ class ModelNewInstanceRequest(object): 'license_name': 'str', 'fine_tunable': 'bool', 'training_data': 'list[str]', + 'model_instance_type': 'str', + 'base_model_instance': 'str', + 'external_base_model_url': 'int', 'files': 'list[UploadFile]' } @@ -67,10 +70,13 @@ class ModelNewInstanceRequest(object): 'license_name': 'licenseName', 'fine_tunable': 'fineTunable', 'training_data': 'trainingData', + 'model_instance_type': 'modelInstanceType', + 'base_model_instance': 'baseModelInstance', + 'external_base_model_url': 'externalBaseModelUrl', 'files': 'files' } - def __init__(self, instance_slug=None, framework=None, overview=None, usage=None, license_name='Apache 2.0', fine_tunable=True, training_data=None, files=None): # noqa: E501 + def __init__(self, instance_slug=None, framework=None, overview=None, usage=None, license_name='Apache 2.0', fine_tunable=True, training_data=None, model_instance_type=None, base_model_instance=None, external_base_model_url=None, files=None): # noqa: E501 """ModelNewInstanceRequest - a model defined in Swagger""" # noqa: E501 self._instance_slug = None @@ -80,6 +86,9 @@ def __init__(self, instance_slug=None, framework=None, overview=None, usage=None self._license_name = None self._fine_tunable = None self._training_data = None + self._model_instance_type = None + self._base_model_instance = None + self._external_base_model_url = None self._files = None self.discriminator = None @@ -94,6 +103,12 @@ def __init__(self, instance_slug=None, framework=None, overview=None, usage=None self.fine_tunable = fine_tunable if training_data is not None: self.training_data = training_data + if model_instance_type is not None: + self.model_instance_type = model_instance_type + if base_model_instance is not None: + self.base_model_instance = base_model_instance + if external_base_model_url is not None: + self.external_base_model_url = external_base_model_url if files is not None: self.files = files @@ -144,7 +159,7 @@ def framework(self, framework): """ if framework is None: raise ValueError("Invalid value for `framework`, must not be `None`") # noqa: E501 - allowed_values = ["tensorFlow1", "tensorFlow2", "tfLite", "tfJs", "pyTorch", "jax", "coral", "scikitLearn", "mxnet", "onnx"] # noqa: E501 + allowed_values = ["tensorFlow1", "tensorFlow2", "tfLite", "tfJs", "pyTorch", "jax", "coral", "scikitLearn", "mxnet", "onnx", "keras"] # noqa: E501 if framework not in allowed_values: raise ValueError( "Invalid value for `framework` ({0}), must be one of {1}" # noqa: E501 @@ -203,7 +218,7 @@ def usage(self, usage): def license_name(self): """Gets the license_name of this ModelNewInstanceRequest. # noqa: E501 - The license that should be associated with the model # noqa: E501 + The license that should be associated with the model instance # noqa: E501 :return: The license_name of this ModelNewInstanceRequest. # noqa: E501 :rtype: str @@ -214,14 +229,14 @@ def license_name(self): def license_name(self, license_name): """Sets the license_name of this ModelNewInstanceRequest. - The license that should be associated with the model # noqa: E501 + The license that should be associated with the model instance # noqa: E501 :param license_name: The license_name of this ModelNewInstanceRequest. # noqa: E501 :type: str """ if license_name is None: raise ValueError("Invalid value for `license_name`, must not be `None`") # noqa: E501 - allowed_values = ["CC BY-NC-SA 4.0", "CC BY-SA 4.0", "GPL 2", "CC BY-SA 3.0", "Attribution 4.0 International (CC BY 4.0)", "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)", "ODC Public Domain Dedication and Licence (PDDL)", "Attribution 3.0 Unported (CC BY 3.0)", "Attribution 3.0 IGO (CC BY 3.0 IGO)", "Attribution-NonCommercial-ShareAlike 3.0 IGO (CC BY-NC-SA 3.0 IGO)", "Community Data License Agreement - Permissive - Version 1.0", "Community Data License Agreement - Sharing - Version 1.0", "Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)", "Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)", "ODC Attribution License (ODC-By)", "GNU Lesser General Public License 3.0", "GNU Affero General Public License 3.0", "GNU Free Documentation License 1.3", "Apache 2.0", "MIT", "BSD-3-Clause"] # noqa: E501 + allowed_values = ["CC BY-NC-SA 4.0", "CC BY-SA 4.0", "GPL 2", "CC BY-SA 3.0", "Attribution 4.0 International (CC BY 4.0)", "Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)", "ODC Public Domain Dedication and Licence (PDDL)", "Attribution 3.0 Unported (CC BY 3.0)", "Attribution 3.0 IGO (CC BY 3.0 IGO)", "Attribution-NonCommercial-ShareAlike 3.0 IGO (CC BY-NC-SA 3.0 IGO)", "Community Data License Agreement - Permissive - Version 1.0", "Community Data License Agreement - Sharing - Version 1.0", "Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0)", "Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)", "ODC Attribution License (ODC-By)", "GNU Lesser General Public License 3.0", "GNU Affero General Public License 3.0", "GNU Free Documentation License 1.3", "Apache 2.0", "MIT", "BSD-3-Clause", "GPL 3"] # noqa: E501 if license_name not in allowed_values: raise ValueError( "Invalid value for `license_name` ({0}), must be one of {1}" # noqa: E501 @@ -276,6 +291,81 @@ def training_data(self, training_data): self._training_data = training_data + @property + def model_instance_type(self): + """Gets the model_instance_type of this ModelNewInstanceRequest. # noqa: E501 + + Whether the model instance is a base model, external variant, internal variant, or unspecified # noqa: E501 + + :return: The model_instance_type of this ModelNewInstanceRequest. # noqa: E501 + :rtype: str + """ + return self._model_instance_type + + @model_instance_type.setter + def model_instance_type(self, model_instance_type): + """Sets the model_instance_type of this ModelNewInstanceRequest. + + Whether the model instance is a base model, external variant, internal variant, or unspecified # noqa: E501 + + :param model_instance_type: The model_instance_type of this ModelNewInstanceRequest. # noqa: E501 + :type: str + """ + allowed_values = ["Unspecified", "BaseModel", "KaggleVariant", "ExternalVariant"] # noqa: E501 + if model_instance_type not in allowed_values: + raise ValueError( + "Invalid value for `model_instance_type` ({0}), must be one of {1}" # noqa: E501 + .format(model_instance_type, allowed_values) + ) + + self._model_instance_type = model_instance_type + + @property + def base_model_instance(self): + """Gets the base_model_instance of this ModelNewInstanceRequest. # noqa: E501 + + If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance # noqa: E501 + + :return: The base_model_instance of this ModelNewInstanceRequest. # noqa: E501 + :rtype: str + """ + return self._base_model_instance + + @base_model_instance.setter + def base_model_instance(self, base_model_instance): + """Sets the base_model_instance of this ModelNewInstanceRequest. + + If this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance # noqa: E501 + + :param base_model_instance: The base_model_instance of this ModelNewInstanceRequest. # noqa: E501 + :type: str + """ + + self._base_model_instance = base_model_instance + + @property + def external_base_model_url(self): + """Gets the external_base_model_url of this ModelNewInstanceRequest. # noqa: E501 + + If this is an external variant, a URL to the base model # noqa: E501 + + :return: The external_base_model_url of this ModelNewInstanceRequest. # noqa: E501 + :rtype: int + """ + return self._external_base_model_url + + @external_base_model_url.setter + def external_base_model_url(self, external_base_model_url): + """Sets the external_base_model_url of this ModelNewInstanceRequest. + + If this is an external variant, a URL to the base model # noqa: E501 + + :param external_base_model_url: The external_base_model_url of this ModelNewInstanceRequest. # noqa: E501 + :type: int + """ + + self._external_base_model_url = external_base_model_url + @property def files(self): """Gets the files of this ModelNewInstanceRequest. # noqa: E501 diff --git a/kaggle/models/model_new_request.py b/kaggle/models/model_new_request.py index 9030499..767c4e7 100644 --- a/kaggle/models/model_new_request.py +++ b/kaggle/models/model_new_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/model_update_request.py b/kaggle/models/model_update_request.py index 7019e5f..fd4b969 100644 --- a/kaggle/models/model_update_request.py +++ b/kaggle/models/model_update_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/result.py b/kaggle/models/result.py index 9ad2552..3cf8bfe 100644 --- a/kaggle/models/result.py +++ b/kaggle/models/result.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/start_blob_upload_request.py b/kaggle/models/start_blob_upload_request.py index 999ed10..4c78202 100644 --- a/kaggle/models/start_blob_upload_request.py +++ b/kaggle/models/start_blob_upload_request.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/start_blob_upload_response.py b/kaggle/models/start_blob_upload_response.py index f6ae050..75adc58 100644 --- a/kaggle/models/start_blob_upload_response.py +++ b/kaggle/models/start_blob_upload_response.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/models/upload_file.py b/kaggle/models/upload_file.py index b57d07b..61a7d83 100644 --- a/kaggle/models/upload_file.py +++ b/kaggle/models/upload_file.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kaggle/rest.py b/kaggle/rest.py index 6a64e75..d8e26ab 100644 --- a/kaggle/rest.py +++ b/kaggle/rest.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/setup.py b/setup.py index dff324e..c50c67a 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright 2023 Kaggle Inc +# Copyright 2024 Kaggle Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ setup( name='kaggle', - version='1.5.16', + version='1.6.1', description='Kaggle API', long_description= ('Official API for https://www.kaggle.com, accessible using a command line '