# Versions

The **Versions** view is where you track all the saved versions of code-model pairs in your project. From here, you can [select](#switching-and-modifying-model-versions) which model to examine in the [Network Tab](https://docs.tensorleap.ai/user-interface/project/network), add a model run (i.e. a specific [evaluation](https://docs.tensorleap.ai/user-interface/project/menu-bar/evaluate-a-model)) for analysis in the [dashboard](https://docs.tensorleap.ai/user-interface/project/dashboards), [delete](#deleting-and-renaming-models-and-model-runs), [export](#export-and-upload-a-model-from-tensorleap), and [upload](#export-and-upload-a-model-from-tensorleap) new models via the Platform.

## Versions Layout Overview

Click <img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FFGiZjojRfXD9P8tXu004%2Fimage.png?alt=media&#x26;token=61318270-cde3-48db-bb68-9d9b0c521139" alt="" data-size="line"> on the top left to open the **Versions** view. Once open, you can choose to fix the view by clicking <img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2F5ykPvWDUfFGtYmRQ2JI3%2Fimage.png?alt=media&#x26;token=73a72d68-450e-4b4d-b3f5-b83e65c69820" alt="" data-size="line">.

<figure><img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FQhVdhp8KyNTK0pAYEgo5%2Fimage.png?alt=media&#x26;token=25b10383-e4f8-47bd-8a6c-14a9d4a8fcfd" alt=""><figcaption><p>The version view pinned using the top right pinning</p></figcaption></figure>

The **Versions** view lists all the code-model pairs you have in your project. In the Top of the version control you have the Project Name, and below it, the name of the currently selected code-model pair that is viewed within the Network Tab. The selected version is also highlighted in a different background color than the other versions.

Many [evaluation](https://docs.tensorleap.ai/user-interface/project/menu-bar/evaluate-a-model) of the same model could be made. Each of these would result in a model run, that could be viewed within the version control by expanding a version. hovering over a Run would present it's start time.

{% hint style="info" %}
Models that were not yet evaluated would not show any available runs
{% endhint %}

<figure><img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FYGZnYFcPWDNIrS63A3YN%2Fimage.png?alt=media&#x26;token=75903793-5831-4527-a0e0-d8c45e8a44a2" alt=""><figcaption><p>An Example of an expanded Model version with its Runs with the mouse hovering the oldest Run.</p></figcaption></figure>

## Switching & modifying Model versions&#x20;

To review and modify different version that exists in the platform - simply hover the mouse over the required model, and click "Open Commit"&#x20;

<figure><img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2Fm08M9rXmPhgDs55iR8XU%2Fimage.png?alt=media&#x26;token=d3be8e90-3635-431e-bd7d-3c425bb454e0" alt=""><figcaption><p>Switching Models in the Network view</p></figcaption></figure>

{% hint style="info" %}
Switching Reviewed versions in the Network Tab has no effect on the Dashboard analysis
{% endhint %}

## Deleting and renaming Models and Model Runs

To delete a model or a model run: hover over it, and click the trash can icon.

To rename a model or a model run: click over the name of the requested version and enter a new name.

### Adding a model run to dashboard analysis

Once an evaluate is completed, multiple Model Runs could be added to the dashboard panel for analysis purposes. To do so, click the "Add To Dashboard" Icon that is to right of each Model Run.

{% hint style="info" %}
If the "Add To Dashboard" Icon is not selectable next to a Model Run it indicates that the evaluate didn't start yet or it was finished unsuccessfully, and there's no data to analyze.
{% endhint %}

## Export & Upload a model from Tensorleap

### Exporting a model

<figure><img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FelMiDmNEukkrhW4ENje0%2Fnew_export.gif?alt=media&#x26;token=6b0ae766-c9dd-4ee2-bf63-642e2925c142" alt=""><figcaption></figcaption></figure>

To export a trained model out of Tensorleap:

1. With the **Versions** view open, search for the model
2. Hover your mouse on the model, then click <img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FwYsyiQFWH7DaQQiyKxPL%2Fimage.png?alt=media&#x26;token=6b4b95ba-74e2-46bd-afa2-1fa1148f45a1" alt="" data-size="line"> on the right to open the **Export Model** window.
3. On the **Export Model** window, select the format in which the model will be saved.
4. Click <img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FcFBwyjv2oBFx7jDFbDzw%2Fimage.png?alt=media&#x26;token=15ae2a49-1b46-4deb-98d8-0369b702f777" alt="" data-size="line"> to start the export process.
5. The job appears on the list to the right with status set to ***Pending***. A notification message also appears briefly on your screen.

&#x20; 6\. Once Tensorleap completes compiling the file, status is set to ***Finished***.

{% hint style="info" %}
If status is still set to ***Pending*** after some time, you may need to refresh the page to see the change in status to ***Finished***.
{% endhint %}

&#x20; 7\. Click <img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FPuSI0OejS4cnjo1cHOsK%2Fimage.png?alt=media&#x26;token=d80ad3b0-be42-4978-8687-2c74014c4b21" alt="" data-size="line"> to save the file to your computer.

![Downloading an exported model](https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FKq9yXyBm7sGPlyWPUaMS%2Fdownload-after-compilation.png?alt=media\&token=c3d0e6b1-da3f-415d-ad7b-274aad338496)

The available export formats are [Json](https://www.tensorflow.org/api_docs/python/tf/keras/models/model_from_json) (Tensorflow 2), [H5](https://www.tensorflow.org/tutorials/keras/save_and_load) (Tensorflow 2), [ONNX](https://pytorch.org/docs/stable/onnx.html) , [SavedModel](https://www.tensorflow.org/api_docs/python/tf/keras/models/save_model) (Tensorflow)

### Importing a model via the Platform

<figure><img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2FMYbUb1keeE8BN3bVc1gM%2Fimage.png?alt=media&#x26;token=0d5b2049-6ba6-4cb4-a533-4b439abaacdd" alt=""><figcaption><p>Uploading a model to the platform is done via the top most cloud icon in the version panel</p></figcaption></figure>

To import a model from the platform, click the top most cloud icon in the version panel. This would allow you to provide a name for the Model, select its type, select it from a location on your disk and upload it to the Tensorleap system.

<figure><img src="https://3509361326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UXeOlFqlw8pl79U2HGU%2Fuploads%2Fb5XB4RnSiLVn4qPZOEiD%2Fimage.png?alt=media&#x26;token=bcb49cdf-823e-42af-aa84-5f55fbb08e94" alt=""><figcaption><p>The model upload panel</p></figcaption></figure>

{% hint style="info" %}
For the ONNX model platform the option to "Transform Inputs" is available but is default off. The purpose of this flag is to switch the model between a channel-first and a channel-last architecture. Note that if you enable this flag the model would expect a different order of the input tensor than the one tested in your [local integration test](https://docs.tensorleap.ai/tensorleap-integration/integration-test).
{% endhint %}

{% hint style="info" %}
The model upload panel allows to indicate which dataset should be connected with the model after upload. Providing this context would allows automatic [mapping to be applied](https://docs.tensorleap.ai/user-interface/project/network/network-mapping/applying-a-mapping-deprecated) in case it already exists.
{% endhint %}

{% hint style="warning" %}
It is highly recommended to use the [CLI](https://docs.tensorleap.ai/tensorleap-integration/uploading-with-cli/cli-assets-upload) to upload models and codebases into the platform instead of the UI interfaces.&#x20;
{% endhint %}
