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
Log on to the PAI console, and select the target Region in the upper-left corner.
In the left navigation pane, choose Workspaces, then click the target workspace name to enter the workspace.
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
Click Create Instance. This opens the Notebook development environment and creates a new Notebook file.
-
Write your code. Click +Python to add a Python cell, then start writing code in the cell.
The following is a sample code snippet:
NoteInstall 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
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.
-
Click the
icon to run the code.# Include dependency installation in the Notebook file to support any DSW instance. !pip install pandas import pandas as pdIf 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
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+ImacOS:
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.