跳到主要内容

Notebook User Guide

AtomGit Notebook provides a powerful online development environment that allows you to perform data analysis, model training, and experiments directly in your browser. This guide will help you understand how to use the Notebook feature.

Notebook Startup

Create a New Notebook

  1. Log in to your AtomGit account
  2. Go to "Notebook" > "Activate Notebook"
  3. Select the computing type:
    • NPU
    • CPU
  4. Select computing resources:
    • Container image
    • Storage size
  5. Click "Start"

Environment Configuration

You can predefine the environment via notebook-config.yaml:

name: my-notebook
version: 1.0.0
python_version: "3.9"
cuda_version: "11.7"
packages:
- torch>=2.0.0
- transformers>=4.30.0
- pandas>=2.0.0
resources:
cpu: 4
memory: 16GB
gpu: "T4"

Notebook Usage

Basic Operations

  1. File Management

    • Create a new file
    • Upload files
    • Export notebook
    • Version control
  2. Editing Features

    • Code completion
    • Syntax highlighting
    • Real-time error checking
    • Shortcut key support
  3. Execution Control

    • Run a single cell
    • Run all
    • Restart kernel
    • Interrupt execution

Code Examples

# Import common libraries
import torch
import pandas as pd
import matplotlib.pyplot as plt

# Data visualization
%matplotlib inline
plt.style.use('seaborn')

# Display progress bar
from tqdm.notebook import tqdm

# Use GPU
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

Magic Commands

# Show all magic commands
%lsmagic

# Timing
%%time
# your code here

# Display variables
%who

# Run shell commands
!pip install package-name

Advanced Features

Remote Storage Integration

# Mount cloud storage
!gitcode mount storage://my-bucket /mnt/data

# Read data
import pandas as pd
df = pd.read_csv('/mnt/data/dataset.csv')

Model Training Monitoring

# Use TensorBoard
%load_ext tensorboard
%tensorboard --logdir runs/

# Custom progress display
from gitcode.tracking import track_progress

@track_progress
def train_epoch():
# training code
pass

Resource Monitoring

# Display GPU usage
!nvidia-smi

# Display system resources
!top -n 1

# Display disk usage
!df -h

Best Practices

  1. Code Organization

    • Use Markdown for explanations
    • Modularize code structure
    • Save regularly
    • Add comments
  2. Resource Management

    • Free up memory in time
    • Use generators for large data
    • Use cache wisely
    • Close unused kernels
  3. Version Control

    • Submit changes regularly
    • Use meaningful commit messages
    • Create checkpoints
    • Backup important data
  4. Collaborative Development

    • Share notebooks
    • Add documentation
    • Use consistent coding styles
    • Synchronize changes promptly

Frequently Asked Questions

Q: How to install additional packages? A: You can use !pip install package-name or define them in the configuration file.

Q: What kernels does Notebook support? A: It supports multiple programming language kernels such as Python, R, and Julia.

Q: How to handle memory shortage issues? A: You can use generators, clean variables, or upgrade resource configurations.

Q: How to share a Notebook? A: You can share it through a sharing link, export the file, or use collaboration mode.

Shortcut Keys Reference

FunctionWindows/LinuxMac
Run CellShift + EnterShift + Return
Add CellBB
Delete CellD, DD, D
Switch to MarkdownMM
Save FileCtrl + SCmd + S
Interrupt ExecutionI, II, I