Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/model_instances.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,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 instance.
Initializes a metadata file (`model-instance-metadata.json`) for creating a new model variation.

**Usage:**

Expand Down
60 changes: 30 additions & 30 deletions documentation/model_instances_versions.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Model Instance Versions Commands
# Model Variation Versions Commands

Commands for managing versions of a specific Kaggle Model Instance. Each version represents a snapshot of the model instance files at a point in time.
Commands for managing versions of a specific Kaggle Model Variation. Each version represents a snapshot of the model variation files at a point in time.

## `kaggle models instances versions create`
## `kaggle models variations versions create`

Creates a new version of an existing model instance.
Creates a new version of an existing model variation.

**Usage:**

```bash
kaggle models instances versions create <MODEL_INSTANCE> -p <FOLDER_PATH> [options]
kaggle models variations versions create <MODEL_INSTANCE> -p <FOLDER_PATH> [options]
```

**Arguments:**

* `<MODEL_INSTANCE>`: The target model instance URL suffix for the new version (format: `owner/model-slug/framework/instance-slug`, e.g., `$KAGGLE_DEVELOPER/test-model/jax/main`).
* `<MODEL_INSTANCE>`: 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`).

**Options:**

Expand All @@ -25,32 +25,32 @@ kaggle models instances versions create <MODEL_INSTANCE> -p <FOLDER_PATH> [optio

**Example:**

Create a new version for the model instance `$KAGGLE_DEVELOPER/test-model/jax/main` using files from the `tmp` folder, with version notes "Updated model files", quietly, and skipping subdirectories:
Create a new version for the model variation `$KAGGLE_DEVELOPER/test-model/jax/main` using files from the `tmp` folder, with version notes "Updated model files", quietly, and skipping subdirectories:

```bash
# Ensure tmp folder contains the new files for the version, e.g., data_v2.csv
# echo "e,f,g,h" > tmp/data_v2.csv

kaggle models instances versions create $KAGGLE_DEVELOPER/test-model/jax/main -p tmp -n "Updated model files" -q -r skip
kaggle models variations versions create $KAGGLE_DEVELOPER/test-model/jax/main -p tmp -n "Updated model files" -q -r skip
```

**Purpose:**

This command uploads a new set of files to an existing model instance, creating a new, numbered version. This allows you to track changes and revert to previous versions of your model instance files.
This command uploads a new set of files to an existing model variation, creating a new, numbered version. This allows you to track changes and revert to previous versions of your model variation files.

## `kaggle models instances versions download`
## `kaggle models variations versions download`

Downloads files for a specific version of a model instance.
Downloads files for a specific version of a model variation.

**Usage:**

```bash
kaggle models instances versions download <MODEL_INSTANCE_VERSION> [options]
kaggle models variations versions download <MODEL_INSTANCE_VERSION> [options]
```

**Arguments:**

* `<MODEL_INSTANCE_VERSION>`: Model instance version URL suffix in the format `owner/model-slug/framework/instance-slug/version-number` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main/1`).
* `<MODEL_INSTANCE_VERSION>`: 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`).

**Options:**

Expand All @@ -62,29 +62,29 @@ kaggle models instances versions download <MODEL_INSTANCE_VERSION> [options]

**Example:**

Download version 1 of the model instance `$KAGGLE_DEVELOPER/test-model/jax/main` into the `tmp` folder, untar if applicable, force overwrite, and do it quietly:
Download version 1 of the model variation `$KAGGLE_DEVELOPER/test-model/jax/main` into the `tmp` folder, untar if applicable, force overwrite, and do it quietly:

```bash
kaggle models instances versions download $KAGGLE_DEVELOPER/test-model/jax/main/1 -p tmp -q -f --untar
kaggle models variations versions download $KAGGLE_DEVELOPER/test-model/jax/main/1 -p tmp -q -f --untar
```

**Purpose:**

This command allows you to retrieve the specific files associated with a particular version of a model instance.
This command allows you to retrieve the specific files associated with a particular version of a model variation.

## `kaggle models instances versions files`
## `kaggle models variations versions files`

Lists files for a specific version of a model instance.
Lists files for a specific version of a model variation.

**Usage:**

```bash
kaggle models instances versions files <MODEL_INSTANCE_VERSION> [options]
kaggle models variations versions files <MODEL_INSTANCE_VERSION> [options]
```

**Arguments:**

* `<MODEL_INSTANCE_VERSION>`: Model instance version URL suffix (e.g., `google/gemma/pytorch/7b/2`).
* `<MODEL_INSTANCE_VERSION>`: Model variation version URL suffix (e.g., `google/gemma/pytorch/7b/2`).

**Options:**

Expand All @@ -94,42 +94,42 @@ kaggle models instances versions files <MODEL_INSTANCE_VERSION> [options]

**Example:**

List the first 3 files for version 2 of the model instance `google/gemma/pytorch/7b` in CSV format:
List the first 3 files for version 2 of the model variation `google/gemma/pytorch/7b` in CSV format:

```bash
kaggle models instances versions files google/gemma/pytorch/7b/2 -v --page-size=3
kaggle models variations versions files google/gemma/pytorch/7b/2 -v --page-size=3
```

**Purpose:**

Use this command to see the individual files that constitute a specific version of a model instance before downloading.
Use this command to see the individual files that constitute a specific version of a model variation before downloading.

## `kaggle models instances versions delete`
## `kaggle models variations versions delete`

Deletes a specific version of a model instance from Kaggle.
Deletes a specific version of a model variation from Kaggle.

**Usage:**

```bash
kaggle models instances versions delete <MODEL_INSTANCE_VERSION> [options]
kaggle models variations versions delete <MODEL_INSTANCE_VERSION> [options]
```

**Arguments:**

* `<MODEL_INSTANCE_VERSION>`: Model instance version URL suffix in the format `owner/model-slug/framework/instance-slug/version-number` (e.g., `$KAGGLE_DEVELOPER/test-model/jax/main/1`).
* `<MODEL_INSTANCE_VERSION>`: 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`).

**Options:**

* `-y, --yes`: Automatically confirm deletion without prompting.

**Example:**

Delete version 1 of the model instance `$KAGGLE_DEVELOPER/test-model/jax/main` and automatically confirm:
Delete version 1 of the model variation `$KAGGLE_DEVELOPER/test-model/jax/main` and automatically confirm:

```bash
kaggle models instances versions delete $KAGGLE_DEVELOPER/test-model/jax/main/1 -y
kaggle models variations versions delete $KAGGLE_DEVELOPER/test-model/jax/main/1 -y
```

**Purpose:**

This command permanently removes a specific version of your model instance from Kaggle. Use with caution. If it's the only version, this may lead to the deletion of the model instance itself if no other versions exist.
This command permanently removes a specific version of your model variation from Kaggle. Use with caution. If it's the only version, this may lead to the deletion of the model variation itself if no other versions exist.
6 changes: 3 additions & 3 deletions documentation/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ kaggle models create -p <FOLDER_PATH>

**Options:**

* `-p, --path <FOLDER_PATH>`: Path to the folder containing the `model-metadata.json` file (defaults to the current directory). This folder should also contain your model files that you intend to upload as part of the first model instance.
* `-p, --path <FOLDER_PATH>`: Path to the folder containing the `model-metadata.json` file (defaults to the current directory). This folder should also contain your model files that you intend to upload as part of the first model variation.

**Example:**

Expand All @@ -95,7 +95,7 @@ kaggle models create -p tmp

**Purpose:**

This command registers a new model on Kaggle using the provided metadata. After this, you will typically create model instances and versions.
This command registers a new model on Kaggle using the provided metadata. After this, you will typically create model variations and versions.

## `kaggle models get`

Expand Down Expand Up @@ -181,4 +181,4 @@ kaggle models delete $KAGGLE_DEVELOPER/test-model -y

**Purpose:**

This command permanently removes one of your models (and all its instances and versions) from Kaggle. Use with caution.
This command permanently removes one of your models (and all its variations and versions) from Kaggle. Use with caution.
38 changes: 19 additions & 19 deletions documentation/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ This tutorial guides you through creating a new model on Kaggle.
cd my-new-model
```

2. **Copy your model definition files (optional for this step).** If you have files that define your model (e.g., Python scripts, model weights), copy them into this directory. For the `kaggle models create` step, only the metadata is strictly required, but you'll need files when you create a model instance.
2. **Copy your model definition files (optional for this step).** If you have files that define your model (e.g., Python scripts, model weights), copy them into this directory. For the `kaggle models create` step, only the metadata is strictly required, but you'll need files when you create a model variation.

3. **Initialize model metadata.** This creates a `model-metadata.json` file.

Expand All @@ -161,64 +161,64 @@ This tutorial guides you through creating a new model on Kaggle.

6. **Verify on Kaggle.com.** Refresh the [`Models` tab in `Your Work`](https://www.kaggle.com/work/models). You should see "My Awesome AI Model".

## Tutorial: Create a Model Instance
## Tutorial: Create a Model Variation

This tutorial shows how to create an instance under an existing model. A model instance usually represents the model implemented in a specific framework (like TensorFlow, PyTorch, JAX, etc.) and includes the actual model files.
This tutorial shows how to create a variation under an existing model. A model variation usually represents the model implemented in a specific framework (like TensorFlow, PyTorch, JAX, etc.) and includes the actual model files.

1. **Ensure you have a parent model.** Follow the "Create a Model" tutorial if you haven't already. Let's assume your model slug is `my-awesome-ai-model` and your username is `YOUR_USERNAME`.

2. **Prepare your model instance files.** In your model directory (e.g., `my-new-model`), create or place the files for this specific instance. For example, a JAX model might have a `flax_model.params` file.
2. **Prepare your model variation files.** In your model directory (e.g., `my-new-model`), create or place the files for this specific variation. For example, a JAX model might have a `flax_model.params` file.

```bash
# In the my-new-model directory
echo "This is a placeholder for JAX model parameters" > flax_model.params
```

3. **Initialize model instance metadata.** This creates `model-instance-metadata.json`.
3. **Initialize model variation metadata.** This creates `model-instance-metadata.json`.

```bash
# Still in the my-new-model directory
kaggle models instances init
kaggle models variations init
```

4. **Edit the instance metadata file.** Open `model-instance-metadata.json` and make changes:
4. **Edit the variation metadata file.** Open `model-instance-metadata.json` and make changes:
* Replace `"INSERT_OWNER_SLUG_HERE"` with your Kaggle username (e.g., `"YOUR_USERNAME"`).
* Replace `"INSERT_EXISTING_MODEL_SLUG_HERE"` with your parent model's slug (e.g., `"my-awesome-ai-model"`).
* Replace `"INSERT_INSTANCE_SLUG_HERE"` with a slug for this instance (e.g., `"jax-implementation"`).
* Replace `"INSERT_INSTANCE_SLUG_HERE"` with a slug for this variation (e.g., `"jax-implementation"`).
* Replace `"INSERT_FRAMEWORK_HERE"` with the model framework (e.g., `"jax"`, `"tensorflow"`, `"pytorch"`, `"sklearn"`).
* Update the `"instance_size_bytes"` if known, and add a `"description"`.

5. **Create the model instance.** This uploads the files in the current directory (e.g., `flax_model.params`) along with the instance metadata.
5. **Create the model variation.** This uploads the files in the current directory (e.g., `flax_model.params`) along with the variation metadata.

```bash
kaggle models instances create -p .
kaggle models variations create -p .
```

6. **Verify on Kaggle.com.** Go to your model's page on Kaggle by clicking on the model under in the [`Models` tab on `Your Work`](https://www.kaggle.com/work/models). You should see a new "jax-implementation" instance listed, and it will have one version containing `flax_model.params`.
6. **Verify on Kaggle.com.** Go to your model's page on Kaggle by clicking on the model under in the [`Models` tab on `Your Work`](https://www.kaggle.com/work/models). You should see a new "jax-implementation" variation listed, and it will have one version containing `flax_model.params`.

## Tutorial: Create a Model Instance Version
## Tutorial: Create a Model Variation Version

This tutorial explains how to add a new version to an existing model instance, for example, when you have updated model weights or files.
This tutorial explains how to add a new version to an existing model variation, for example, when you have updated model weights or files.

1. **Ensure you have a model instance.** Follow the "Create a Model Instance" tutorial. Let's assume your instance is `YOUR_USERNAME/my-awesome-ai-model/jax/jax-implementation`.
1. **Ensure you have a model variation.** Follow the "Create a Model Variation" tutorial. Let's assume your variation is `YOUR_USERNAME/my-awesome-ai-model/jax/jax-implementation`.

2. **Prepare your updated files.** In your model instance directory (e.g., `my-new-model`), update or add new files for this version. For example, create `flax_model_v2.params`.
2. **Prepare your updated files.** In your model variation directory (e.g., `my-new-model`), update or add new files for this version. For example, create `flax_model_v2.params`.

```bash
# In the my-new-model directory
echo "Updated JAX model parameters for V2" > flax_model_v2.params
# You might also remove or update flax_model.params if it's being replaced
```

3. **Create the new model instance version.** You need to specify the parent model instance and provide version notes. The files from the `-p` path will form the contents of this new version.
3. **Create the new model variation version.** You need to specify the parent model variation and provide version notes. The files from the `-p` path will form the contents of this new version.

```bash
# Replace YOUR_USERNAME and model/instance slugs accordingly
kaggle models instances versions create YOUR_USERNAME/my-awesome-ai-model/jax/jax-implementation -p . -n "Second version with updated parameters"
# Replace YOUR_USERNAME and the slugs for model and variation accordingly
kaggle models variations versions create YOUR_USERNAME/my-awesome-ai-model/jax/jax-implementation -p . -n "Second version with updated parameters"
```
*Note: The `-p .` means all files in the current directory will be uploaded as part of this new version. If you only want to upload `flax_model_v2.params`, ensure only it (and any other V2 files) are in a directory and point `-p` to that directory, or manage your files carefully.*

4. **Verify on Kaggle.com.** Go to your model instance page on Kaggle (e.g., `YOUR_USERNAME/my-awesome-ai-model/jax/jax-implementation`) by clicking on the [`Models` tab on `Your Work`](https://www.kaggle.com/work/models). You should see a new version (e.g., version 2) listed with your notes and the new files.
4. **Verify on Kaggle.com.** Go to your model variation page on Kaggle (e.g., `YOUR_USERNAME/my-awesome-ai-model/jax/jax-implementation`) by clicking on the [`Models` tab on `Your Work`](https://www.kaggle.com/work/models). You should see a new version (e.g., version 2) listed with your notes and the new files.

## Tutorial: How to Submit to a Competition

Expand Down