Tips for using BML CodeLab

1 terminal

Terminal opening process: file browser (Ctrl + Shift + F) - new startup page (Ctrl + Shift + L) - terminal

terminal

  • The terminal does not have sudo privileges;
  • You can only open up to 5 terminals at the same time;
  • Both python and pip environment variables have been configured;
  • The address of the home directory is /home/aistudio.

2 Files (File Browser)

Open file browser process: File Browser (Ctrl + Shift + F)

document

  • The file browser displays folders and files under /home/aistudiothe path ;
  • Among them, /home/aistudio/datais the mounted dataset directory, not the persistent directory. Changes in this directory will be automatically restored after restarting the environment.

2.1 Upload files

Upload file process: file browser (Ctrl + Shift + F) - upload file

upload files

3 datasets

View Dataset Process: Dataset

data set

  • On the page, only copying the path of the dataset file is supported, but not modifying the dataset (if you need to modify the dataset, you need to modify it on the project details page);
  • Datasets are stored at /home/aistudio/datathe path .

4 environment

View Dataset Process: Environment Information

environment

5 monitoring

View monitoring process: Monitoring

monitor

Among them, you can click "CPU usage" or "AI accelerator card usage" to view the monitoring over time.

Monitor - CPU usage

6 Package Management

6.1 Persistent installation of third-party packages for Python

If you need to perform persistent installation, you need to use the persistent path installation, for example:

!mkdir /home/aistudio/external-libraries
!pip install paddlenlp -t /home/aistudio/external-libraries

At the same time, the following code needs to be run every time the environment starts:

import sys 
sys.path.append('/home/aistudio/external-libraries')

6.2 Configure matplotlib to display Chinese

matplotlibThe default font used does not support displaying Chinese, which can be adjusted as follows:

import matplotlib

matplotlib.rcParams["font.sans-serif"] = ["FZSongYi-Z13S"] # 指定支持中文的默认字体
matplotlib.rcParams["axes.unicode_minus"] = False # 解决保存图像是负号'-'显示为方块的问题

Guess you like

Origin blog.csdn.net/Changxing_J/article/details/128749769