> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab-5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-science-lab-5/notebook-operations/transforms.md).

# Transforms

Save and load models with transform script, register them or publish them as an API through DS Lab module.

{% hint style="success" %}
*Check out a walk-through on how to use the Transform script inside Notebook.*
{% endhint %}

You can write or upload a script containing the transform function to a Notebook and save a model based on it. You can also register the model as an API service. This entire process is completed in the below-given steps:

## Saving and loading a Model with Transform script <a href="#saving-and-loading-a-model-with-transform-script" id="saving-and-loading-a-model-with-transform-script"></a>

* Navigate to a Notebook.
* Add a Code cell. Write or provide a transform script to the cell (In this case, it has been supplied in three cells).&#x20;
* Run the cell(s) (In this case, run all the three cells).

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FHJThL308A3n9Gt7KEybv%2Fimage.png?alt=media&amp;token=69e2754f-484e-425c-a8f6-3b6d7eac93d4" alt=""><figcaption></figcaption></figure>

* Add a new code cell and define the model.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FTSVDp19Kb2F4dIQJP74e%2Fimage.png?alt=media&amp;token=fa8ddddc-2889-4c33-b161-d922705330ef" alt=""><figcaption></figcaption></figure>

* Add another cell and click the ***Save Model*** option for the newly added code cell.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fivnhl3JgfJeYsJgNXY2G%2Fimage.png?alt=media&amp;token=7f059e0b-b96f-4ff4-802d-1f01389719f7" alt=""><figcaption></figcaption></figure>

* Specify the model name and type in the auto-generated script in the next code cell.
* Run the cell.
* Open the ***Transforms*** tab.
* The model gets saved under the ***Transforms*** tab.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FmIN8Ic5qteWH53BLsLP4%2Fimage.png?alt=media&amp;token=619010d9-9030-415a-bcdc-394060b1fe27" alt=""><figcaption></figcaption></figure>

* Add a new code cell.
* Load the transform model by using the checkbox.
* Run that cell.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FoIsqK80ZFwKXTS7990mA%2Fimage.png?alt=media&amp;token=7e356748-6d51-495f-88dd-0e0df8da8e03" alt=""><figcaption></figcaption></figure>

* Insert a new code cell.
* Click the Transforms option for the code cell.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FLQmFSHqTTJirR1jG9Cnh%2Fimage.png?alt=media&amp;token=6a288d6b-a976-481b-bd25-409419ac395b" alt=""><figcaption></figcaption></figure>

* The auto-generated script appears.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FssxwUbgd8MKaxSPmPwhp%2Fimage.png?alt=media&amp;token=d3e1fe3d-a6a8-419d-accb-85197ce903c5" alt=""><figcaption></figcaption></figure>

* Specify the train data.
* Run the code cell.
* It will display the transformed data below.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FSuRgtiqACi0LFQMHrZsk%2Fimage.png?alt=media&amp;token=575a3def-8e48-4b9b-8d36-df4567df11cf" alt=""><figcaption></figcaption></figure>

## Registering a Transform Model <a href="#registering-a-transform-model" id="registering-a-transform-model"></a>

* Open the ***Transforms*** tab inside a Notebook.
* Click the ellipsis icon for the saved transform.
* Select the ***Register*** option for a listed transform.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FA9HasRkeVze7RM5wQh0Q%2Fimage.png?alt=media&amp;token=dd8858a4-e2d2-4967-b929-ef310c4790b8" alt=""><figcaption></figcaption></figure>

* The Register Model dialog box opens to confirm the action.
* Click the ***Yes*** option.

&#x20;       ![](https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F39TtHuCiF5OhiaKfNesz%2Fimage.png?alt=media\&token=550abc5c-b6f9-4d78-b844-7a9a24835ccd)

* A confirmation message appears to inform the completion of the action.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FHVZ2gLdvsbgwv0UM7vdB%2Fimage.png?alt=media&amp;token=1b667e86-3ec4-4cf3-9aee-e9b2141b3593" alt=""><figcaption></figcaption></figure>

* The model gets registered and listed under the ***Registered*** list of the models.​​

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FcNSb39XZxpGcYXdx06x2%2Fimage.png?alt=media&amp;token=a8728418-dabd-423c-af6e-2f9ba162282b" alt=""><figcaption></figcaption></figure>

* Open a pipeline workflow with a DS Lab model runner component.
* The registered model gets listed under the ***Meta Information*** tab of the DS Lab model runner component inside the Data Pipeline module.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fg6pa3pEasBwDGTE5kaeo%2Fimage.png?alt=media&amp;token=a4b551de-54e4-406e-aa8a-49b7668b17fe" alt=""><figcaption></figcaption></figure>

## Publishing a Transform Model as API <a href="#publishing-a-transform-model-as-api" id="publishing-a-transform-model-as-api"></a>

The steps to publish a model as an API that contains transform remain the same as described for a Data Science Model. Refer to the [***Register a Model as an API Service*** page.](/data-science-lab-5/tabs-for-a-dsl-project/model/register-a-model-as-an-api-service.md)
