diff --git a/README.md b/README.md index 6bbac59..b8b88e6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Kaggle API +# Kaggle CLI The official CLI to interact with [Kaggle](https://www.kaggle.com). @@ -90,11 +90,9 @@ hatch run test:local ### Integration Tests -To run integration tests on your local machine, you need to set up your Kaggle API credentials. You can do this in one of these two ways described [this doc](docs/README.md). Refer to the sections: -- Using environment variables -- Using credentials file +To run integration tests on your local machine, you need to set up your Kaggle credentials. You can do this by following the [authentication instructions](docs/README.md). -After setting up your credentials by any of these methods, you can run the integration tests as follows: +After setting up your credentials, you can run the integration tests as follows: ```sh hatch run test:integration @@ -110,6 +108,6 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md). ## License -The Kaggle API is released under the [Apache 2.0 license](LICENSE.txt). +The Kaggle CLI is released under the [Apache 2.0 license](LICENSE.txt). diff --git a/docs/model_instances.md b/docs/model_instances.md index eb1d37e..48e3ca2 100644 --- a/docs/model_instances.md +++ b/docs/model_instances.md @@ -5,6 +5,7 @@ Commands for interacting with variations of Kaggle Models. A model variation typ ## `kaggle models variations init` Initializes a metadata file (`model-instance-metadata.json`) for creating a new model variation. +Note that the name of the file reflects the old name for a variation, which was "instance". **Usage:** @@ -52,7 +53,7 @@ Create a new model variation using the metadata and files in the `tmp` folder, q # Example: Edit model-instance-metadata.json first # sed -i 's/INSERT_OWNER_SLUG_HERE/your-username/' tmp/model-instance-metadata.json # sed -i 's/INSERT_EXISTING_MODEL_SLUG_HERE/parent-model-slug/' tmp/model-instance-metadata.json -# sed -i 's/INSERT_INSTANCE_SLUG_HERE/my-instance-slug/' tmp/model-instance-metadata.json +# sed -i 's/INSERT_INSTANCE_SLUG_HERE/my-variation-slug/' tmp/model-instance-metadata.json # sed -i 's/INSERT_FRAMEWORK_HERE/jax/' tmp/model-instance-metadata.json # echo "a,b,c,d" > tmp/data.csv # Example model file @@ -70,12 +71,12 @@ Downloads the `model-instance-metadata.json` file for an existing model variatio **Usage:** ```bash -kaggle models variations get -p +kaggle models variations get -p ``` **Arguments:** -* ``: Model variation URL suffix in the format `owner/model-slug/framework/instance-slug` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). +* ``: Model variation URL suffix in the format `owner/model-slug/framework/variation-slug` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). **Options:** @@ -100,12 +101,12 @@ Lists files for the current version of a model variation. **Usage:** ```bash -kaggle models variations files [options] +kaggle models variations files [options] ``` **Arguments:** -* ``: Model variation URL suffix (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). +* ``: Model variation URL suffix (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). **Options:** @@ -158,12 +159,12 @@ Deletes a model variation from Kaggle. **Usage:** ```bash -kaggle models variations delete [options] +kaggle models variations delete [options] ``` **Arguments:** -* ``: Model variation URL suffix in the format `owner/model-slug/framework/instance-slug` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). +* ``: Model variation URL suffix in the format `owner/model-slug/framework/variation-slug` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). **Options:** diff --git a/docs/model_instances_versions.md b/docs/model_instances_versions.md index 9640216..888fbd7 100644 --- a/docs/model_instances_versions.md +++ b/docs/model_instances_versions.md @@ -9,12 +9,12 @@ Creates a new version of an existing model variation. **Usage:** ```bash -kaggle models variations versions create -p [options] +kaggle models variations versions create -p [options] ``` **Arguments:** -* ``: The target model variation URL suffix for the new version (format: `owner/model-slug/framework/instance-slug`, e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). +* ``: The target model variation URL suffix for the new version (format: `owner/model-slug/framework/variation-slug`, e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`). **Options:** @@ -45,12 +45,12 @@ Downloads files for a specific version of a model variation. **Usage:** ```bash -kaggle models variations versions download [options] +kaggle models variations versions download [options] ``` **Arguments:** -* ``: Model variation version URL suffix in the format `owner/model-slug/framework/instance-slug/version-number` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main/1`). +* ``: Model variation version URL suffix in the format `owner/model-slug/framework/variation-slug/version-number` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main/1`). **Options:** @@ -79,12 +79,12 @@ Lists files for a specific version of a model variation. **Usage:** ```bash -kaggle models variations versions files [options] +kaggle models variations versions files [options] ``` **Arguments:** -* ``: Model variation version URL suffix (e.g., `google/gemma/pytorch/7b/2`). +* ``: Model variation version URL suffix (e.g., `google/gemma/pytorch/7b/2`). **Options:** @@ -111,12 +111,12 @@ Deletes a specific version of a model variation from Kaggle. **Usage:** ```bash -kaggle models variations versions delete [options] +kaggle models variations versions delete [options] ``` **Arguments:** -* ``: Model variation version URL suffix in the format `owner/model-slug/framework/instance-slug/version-number` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main/1`). +* ``: Model variation version URL suffix in the format `owner/model-slug/framework/variation-slug/version-number` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main/1`). **Options:** diff --git a/docs/models_metadata.md b/docs/models_metadata.md index af315a2..aed0f37 100644 --- a/docs/models_metadata.md +++ b/docs/models_metadata.md @@ -1,14 +1,14 @@ A full model is composed of 3 types of entities: 1. The model -2. The instances -3. The instance versions +2. The variations +3. The variation versions Let's take the example of [efficientnet](https://www.kaggle.com/models/tensorflow/efficientnet) to explain these entities. -A model like `efficientnet` contains multiple instances. +A model like `efficientnet` contains multiple variations. -An instance is a specific variation of the model (e.g. B0, B1, ...) with a certain framework (e.g. TensorFlow2). +A variation is a specific variation of the model (e.g. B0, B1, ...) with a certain framework (e.g. TensorFlow2). ## Model @@ -44,9 +44,9 @@ We currently support the following metadata fields for models. * `publishTime`: the original publishing time of the model * `provenanceSources`: the provenance of the model -## Model Instance +## Model Variation -To create a model instance, a special `model-instance-metadata.json` file must be specified. +To create a model variation, a special `model-instance-metadata.json` file must be specified. Here's a basic example for `model-instance-metadata.json`: ``` @@ -66,22 +66,22 @@ Here's a basic example for `model-instance-metadata.json`: } ``` -You can also use the API command `kaggle models instances init -p /path/to/model-instance` to have the API create this file for you for a new model instance. +You can also use the API command `kaggle models variations init -p /path/to/model-variation` to have the API create this file for you for a new model variation. ### Contents -We currently support the following metadata fields for model instances. +We currently support the following metadata fields for model variations. * `ownerSlug`: the slug of the user or organization of the model * `modelSlug`: the existing model's slug -* `instanceSlug`: the slug of the instance -* `framework`: the instance's framework (possible options: `tensorFlow1`,`tensorFlow2`,`tfLite`,`tfJs`,`pyTorch`,`jax`,`coral`, ...) -* `overview`: a short overview of the instance -* `usage`: the instance's usage in markdown syntax (see the template below) -* `fineTunable`: whether the instance is fine tunable +* `instanceSlug`: the slug of the variation +* `framework`: the variation's framework (possible options: `tensorFlow1`,`tensorFlow2`,`tfLite`,`tfJs`,`pyTorch`,`jax`,`coral`, ...) +* `overview`: a short overview of the variation +* `usage`: the variation's usage in markdown syntax (see the template below) +* `fineTunable`: whether the variation is fine tunable * `trainingData`: a list of training data in the form of strings, URLs, Kaggle Datasets, etc... -* `modelInstanceType`: whether the model instance is a base model, external variant, internal variant, or unspecified -* `baseModelInstance`: if this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{instance-slug}` of the base model instance +* `modelInstanceType`: whether the model variation is a base model, external variant, internal variant, or unspecified +* `baseModelInstance`: if this is an internal variant, the `{owner-slug}/{model-slug}/{framework}/{variation-slug}` of the base model variation * `externalBaseModelUrl`: if this is an external variant, a URL to the base model ### Licenses diff --git a/src/kaggle/cli.py b/src/kaggle/cli.py index 59c4758..9e3d349 100644 --- a/src/kaggle/cli.py +++ b/src/kaggle/cli.py @@ -35,8 +35,8 @@ def main() -> None: "-v", "--version", action="version", - help="Print the Kaggle API version", - version="Kaggle API " + kaggle.__version__, + help="Print the Kaggle CLI version", + version="Kaggle CLI " + kaggle.__version__, ) parser.add_argument( "-W", @@ -1087,9 +1087,9 @@ class Help(object): + ", ".join(kernels_choices) + "}\nmodels {" + ", ".join(models_choices) - + "}\nmodels instances {" + + "}\nmodels variations {" + ", ".join(model_instances_choices) - + "}\nmodels instances versions {" + + "}\nmodels variations versions {" + ", ".join(model_instance_versions_choices) + "}\nconfig {" + ", ".join(config_choices) @@ -1102,8 +1102,8 @@ class Help(object): group_datasets = "Commands related to Kaggle datasets" group_kernels = "Commands related to Kaggle kernels" group_models = "Commands related to Kaggle models" - group_model_instances = "Commands related to Kaggle model instances" - group_model_instance_versions = "Commands related to Kaggle model instance versions" + group_model_instances = "Commands related to Kaggle model variations" + group_model_instance_versions = "Commands related to Kaggle model variations versions" group_files = "Commands related files" group_config = "Configuration settings" group_auth = "Commands related to authentication" @@ -1320,12 +1320,12 @@ class Help(object): ) # Model Instances params - param_model_instance = "Model Instance URL suffix in format ///" - command_model_instances_get = "Get a model instance" - command_model_instances_init = "Initialize metadata file for model instance creation" - command_model_instances_files = "List files for the current version of a model instance" - command_model_instances_list = "List instances of a model" - command_model_instances_new = "Create a new model instance" + param_model_instance = "Model variation URL suffix in format ///" + command_model_instances_get = "Get a model variation" + command_model_instances_init = "Initialize metadata file for model variation creation" + command_model_instances_files = "List files for the current version of a model variation" + command_model_instances_list = "List variations of a model" + command_model_instances_new = "Create a new model variation" param_model_instance_downfile = ( "Folder for downloading the special model-instance-metadata.json file " "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/models_metadata.md#model-instance). " @@ -1336,22 +1336,22 @@ class Help(object): "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/models_metadata.md#model-instance). " "Defaults to current working directory" ) - command_model_instances_delete = "Delete a model instance" - command_model_instances_update = "Update a model instance" + command_model_instances_delete = "Delete a model variation" + command_model_instances_update = "Update a model variation" # Model Instance Versions params param_model_instance_version = ( - "Model Instance Version URL suffix in format ////" + "Model variation version URL suffix in format ////" ) # Model Instance Versions params - command_model_instance_versions_new = "Create a new model instance version" + command_model_instance_versions_new = "Create a new model variation version" param_model_instance_version_upfile = "Folder for upload. Defaults to current working directory" - command_model_instance_versions_delete = "Delete a model instance version" - command_model_instance_versions_download = "Download model instance version files" - command_model_instance_versions_files = "List model instance version files" - command_model_instance_versions_list = "List model instance versions" - param_model_instance_version_notes = "Version notes to record for the new model instance version" + command_model_instance_versions_delete = "Delete a model variation version" + command_model_instance_versions_download = "Download model variation version files" + command_model_instance_versions_files = "List model variation version files" + command_model_instance_versions_list = "List model variation versions" + param_model_instance_version_notes = "Version notes to record for the new model variation version" # Files params param_files_upload_inbox_path = "Virtual path on the server where the uploaded files will be stored"