> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-science-lab/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/project/tabs-for-a-data-science-lab-project/tabs-for-tensorflow-and-pytorch-environment/model/import-model.md).

# Import Model

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The External models can be registered to the Data Pipeline module and they can be inferred using the Data Science Lab script runner.*
* Only the **Native prediction functionality** will work for the External models.
  {% endhint %}

### Importing the Model

* Navigate to the ***Model*** tab.
* Click the ***Import Model*** option.

<figure><img src="/files/kTd53NLnPHkEBughWjUG" alt=""><figcaption><p>Using the Import Model option from the Model tab</p></figcaption></figure>

* The user gets redirected to upload the model file.

&#x20;     ![](/files/zEteQzcLd9yiSDM7pEAL)

* A notification message appears.
* The imported model gets added to the model list.&#x20;

<figure><img src="/files/C9fwdYprfPkmxfULRk2n" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> The Imported models are referred as **External models** in model list and they are marked with* <img src="/files/G1D9xE16CWy777Ev7UJj" alt="" data-size="line"> *as pre-fix to their names (as displayed in the given image)**.***&#x20;

![](/files/6QpPnxlUeF2uZSa6bKDR)
{% endhint %}

### Exporting the Model to Data Pipeline

* The user can start a new Notebook with wrapper function that includes Data, Imported Model, Predict function, and output Dataset with predictions.

<figure><img src="/files/3wd9k8fVfCaGtOh8n2b8" alt=""><figcaption></figcaption></figure>

* Register the Imported Model from the model tab given on the Notebook page.

&#x20;     ![](/files/oKzjgHEEbrEMZfQl0D7Z)

* The Register Model confirmation dialog box appears.
* Click the ***Yes*** option.

&#x20;     ![](/files/DnjkrzEmHWiv4pvNUKOq)

* A notification message appears, and the model gets registered.   &#x20;

<figure><img src="/files/UhkOXgJsN1hGtunPwuaT" alt=""><figcaption></figcaption></figure>

* Export the script using the ***Export*** functionality provided for the Notebooks on the ***Notebook List*** page.   &#x20;

<figure><img src="/files/2vx5NOPJgJoo413qdRYf" alt=""><figcaption></figcaption></figure>

* The ***Export to Pipeline*** window appears.
* Select a specific script from the Notebook.
* Select the ***Next*** option. &#x20;

<figure><img src="/files/MjlBfTDYGIvAT6caGLoM" alt=""><figcaption></figcaption></figure>

* Click the ***Export*** option from the screen that appears.      &#x20;

<figure><img src="/files/vt4RPPyFkk5J7nyGEyQL" alt=""><figcaption></figcaption></figure>

* A notification message appears.

<figure><img src="/files/H0uzRuosd8GZvE9qVapY" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note</mark>: The imported model gets registered to the Data Pipeline module.*
{% endhint %}

### Accessing the Exported Model within the Pipeline User interface

* Navigate to the ***Data Pipeline Workflow editor***.
* Drag the ***DS Lab Script Runner*** component and configure it.
* Select the ***script name*** from the drop-down option.
* The exported model along with the script can be accessed inside the ***Script Runner*** component.
* The user can connect the DS Lab Script Runner component to an Input Event.
* Run the Pipeline.    &#x20;

<figure><img src="/files/bxEQNAGyTEEyRhwD6EU8" alt=""><figcaption></figcaption></figure>

* The model predictions can be generated in the **Preview tab** of the connected Input Event.

<figure><img src="/files/ZjV4XWM6BtefLGcTQAQH" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Only the **Exported Models** are accessed through the **DS Lab Script Runner** component, the other models can be accessed through the **Model Runner** component inside the Data Pipeline.*
{% endhint %}

<details>

<summary>Try out the Import Model Functionality yourself</summary>

Some of the Sample models and related scripts are provided below for the user to try his hands on this functionality. Please download them by a click, and use them in your Notebook by following the above mentioned steps.

</details>

### Sample files for Sklearn

{% file src="/files/z4lz5oUQ2ajd2cRh7oxc" %}
Sample Sklearn model for import.
{% endfile %}

{% file src="/files/2pTNuCwfLp2bSwF5cqBy" %}
Sample python script based on the imported Sklearn model.
{% endfile %}

### Sample files for Keras

{% file src="/files/rgsI4afzv9q3KUoRwzup" %}
Sample Keras model for import.
{% endfile %}

{% file src="/files/N83zk98T1su5rAcShxfi" %}
Sample python script based on the imported Keras model.
{% endfile %}

### Sample files for PyTorch

{% file src="/files/jrBPSL4WEpIf87TPmpdN" %}
Sample PyTorch model for import.
{% endfile %}

{% file src="/files/4ovDb8XfupI7ON007qzm" %}
Sample python script based on the imported PyTorch model.
{% endfile %}

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The supported  extensions for External models - .pkl, .h5, .pth & .pt*
* *Refer the **Data Science Lab Quick Start Flow** page to get an overview of the **Data Science Lab** module in nutshell.* [***Click here***](https://docs.bdb.ai/data-science-lab/data-science-lab-quick-start-flow) *to get redirected to the quick start flow page.*
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bdb.ai/data-science-lab/project/tabs-for-a-data-science-lab-project/tabs-for-tensorflow-and-pytorch-environment/model/import-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
