All Products
Search
Document Center

Platform For AI:Notebook Lab

Last Updated:Jul 24, 2026

Notebook Lab provides a lightweight editor that lets you preview and edit Notebook files stored on OSS without starting any compute resources. When you're ready to run code, connect the Notebook to a DSW instance. Multiple Notebooks can share a single instance, improving resource utilization.

Notebook Lab vs. DSW

Feature

Notebook Lab

DSW Instance

Core concept

Lightweight Notebook editor; multiple Notebooks share one instance

Full AI development environment

File storage

Stored on OSS; decoupled from compute

Bound to the instance working directory

Billing model

No charge for editing

Billed from the moment the instance starts

Toolset

Focused on Notebook authoring

Includes Notebook, WebIDE, and Terminal

Constraints

Notebook Lab is currently available in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Ulanqab), and China (Shenzhen).

Quick Start

Step 1: Open Notebook

  1. Log on to the PAI console, and select the target Region in the upper-left corner.

  2. In the left navigation pane, choose Workspaces, then click the target workspace name to enter the workspace.

  3. In the left navigation pane, choose Model Training > Data Science Workshop (DSW), then click the Notebook tab.

Step 2: Select a Code Directory

Click Select Code Directory, select an OSS bucket, and create a directory (for example, notebook_test) to use as the storage location for your Notebook files. Once configured, the Notebook list scans this directory and displays all Notebook files (*.ipynb) found under the OSS path.

Step 3: Create a Notebook and Write Code

  1. Click Create Instance. This opens the Notebook development environment and creates a new Notebook file.

  2. Write your code. Click +Python to add a Python cell, then start writing code in the cell.

    The following is a sample code snippet:

    Sample code

    # Include dependency installation logic in the Notebook file so the environment
    # is set up correctly whenever you switch DSW instances.
    !pip install pandas
    # 1. Import the pandas library and alias it as pd
    import pandas as pd
    # 2. Prepare the raw data
    data = {
        'fruit': ['apple', 'banana', 'orange', 'strawberry', 'blueberry'],
        'sales_kg': [120, 200, 150, 80, 50],
        'price_per_kg': [8.5, 3.2, 5.0, 15.0, 25.0]
    }
    # 3. Create a DataFrame
    df = pd.DataFrame(data)
    # 4. Display the data
    print(df.head())
    Note
    • Install dependencies first: Because Notebook files and DSW instances are decoupled, include dependency installation commands in the Notebook file so the environment is set up correctly whenever you switch DSW instances.

    • Save your work regularly: Notebook Lab does not auto-save by default. Make sure to save your changes promptly.

Step 4: Link a DSW Instance and Run Code

  1. Click Link DSW, then select an instance that is in the Running state. Multiple Notebooks can be linked to the same DSW instance, which improves resource utilization.

  2. Click the Run icon to run the code.

    # Include dependency installation in the Notebook file to support any DSW instance.
    !pip install pandas
    import pandas as pd

    If the kernel fails to load in the Select Kernel area in the upper-right corner of the Notebook, try refreshing your browser to reload the environment.

    Sample output:

            fruit  sales_kg  price_per_kg
    0       apple       120           8.5
    1      banana       200           3.2
    2      orange       150           5.0
    3  strawberry        80          15.0
    4   blueberry        50          25.0
Important

Stop your DSW instance when not in use: If you are using a pay-as-you-go instance, billing begins as soon as the instance enters the Running state — even if you are not using WebIDE or running any code. Stop or delete the instance when it is no longer needed to avoid unexpected charges.

Use Copilot for AI-Assisted Coding

You can use Copilot to assist with coding. To activate it:

  • Option 1: Click Generate in the Notebook Lab toolbar.

  • Option 2: Select a cell and use the following keyboard shortcut:

    • Windows: Ctrl+I

    • macOS: Command+I

Billing

Writing code in Notebook Lab is free. When a Notebook is linked to a running DSW instance, DSW billing rules apply. For details, see Data Science Workshop (DSW) billing.

If you run SQL using MaxCompute resources, MaxCompute billing rules apply. For details, see MaxCompute Billing Overview.