Downloading a File from JupyterLab
Only files within 100 MB in JupyterLab can be downloaded to a local PC. You can perform operations in different scenarios based on the storage location selected when creating a notebook instance.
Notebook Instances with EVS Attached
For notebook instances with EVS attached, you can perform the following operations to download large files to the local PC:
- In the notebook instance, create an ipynb file. Use MoXing to upload the large files from notebook instances to OBS. The sample code is as follows:
1 2
import moxing as mox mox.file.copy('/home/ma-user/work/obs_file.txt', 'obs://bucket_name/obs_file.txt')
In the preceding code, /home/ma-user/work/obs_file.txt indicates a file storage path in a notebook instance, and obs://bucket_name/obs_file.txt indicates a file storage path on OBS.
- Use OBS or the ModelArts SDKs to download the files from OBS to the local PC.
- Method 1: Downloading the files using OBS
Use OBS to download the files. You can download the obs_file.txt file in the example to the local PC. If you have a large amount of data, you are advised to use OBS Browser+ to download data or folders.
- Method 2: Downloading the files using the ModelArts SDKs
- Download and install the ModelArts SDKs on your local PC. For details, see SDK Download.
- Authenticate sessions of the ModelArts SDKs. For details, see Session Authentication.
- Download the files from OBS to the local PC. The sample code is as follows:
1 2 3
from modelarts.session import Session session=Session(access_key='***',secret_key='***',project_id='***',region_name='***') session.download_data(bucket_path="/bucket_name/obs_file.txt",path="/home/user/obs_file.txt")
- Method 1: Downloading the files using OBS
Notebook Instances Using OBS Storage
For notebook instances that use OBS storage, you can use OBS or the ModelArts SDK to download files from OBS to a local PC.
- Method 1: Downloading the files using OBS
Use OBS to download the files to the local PC. If you have a large amount of data, you are advised to use OBS Browser+ to download data or folders.
- Method 2: Downloading the files using the ModelArts SDKs
- Download and install the ModelArts SDKs on your local PC. For details, see SDK Download.
- Authenticate sessions of the ModelArts SDKs. For details, see Session Authentication.
- Download the files from OBS to the local PC. The sample code is as follows:
1 2 3
from modelarts.session import Session session=Session(access_key='***',secret_key='***',project_id='***',region_name='***') session.download_data(bucket_path="/bucket_name/obs_file.txt",path="/home/user/obs_file.txt")
Last Article: Uploading Data to JupyterLab
Next Article: Using Sample Notebook Instances of ModelArts
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.