This topic describes how to work with the development environments of Data Science Workshop (DSW) 1.0.

Prerequisites

An instance of DSW 1.0 is created. For more information, see Manage instances.

Run a preset case

If you are a first-time user of DSW, we recommend that you use one of the preset cases to familiarize yourself with related features.

  1. Navigate to the Data Science Workshop page to use the development environments of DSW.
    1. Log on to the Machine Learning Platform for AI console.
    2. In the left-side navigation pane, choose Model Training > DSW-Notebook Service.
    3. In the upper-left corner of the page, select the region of the DSW instance that you want to launch.
    4. In the search bar on the Notebook Models page, enter the name or ID of the DSW instance.
    5. Click Launch DSW in the Actions column.
  2. Download a preset case.
    1. On the Data Science Workshop page, click the Preset case icon icon.
    2. Find a case that you want to download, such as Getting Started, and click the Download a preset case icon next to the case.
      The downloaded case is stored in the /Demo/Cases path.
  3. Open the model file of the downloaded case. The Getting Started case is used as an example in this topic.
    1. In the left-side navigation pane, click the Folder icon icon.
    2. Switch to the /Demo path.
      You can switch to the path by using one of the following methods:
      • Double-click Demo in the Name column.
      • Right-click Demo in the Name column. In the shortcut menu that appears, click Open.
    3. Switch to the /Demo/Cases path.
      You can switch to the path by using one of the following methods:
      • Double-click Cases in the Name column.
      • Right-click Cases in the Name column. In the shortcut menu that appears, click Open.
    4. Switch to the /Demo/Cases/dsw_tutorial path.
      You can switch to the path by using one of the following methods:
      • Double-click dsw_tutorial in the Name column.
      • Right-click dsw_tutorial in the Name column. In the shortcut menu that appears, click Open.
    5. Switch to the /Demo/Cases/dsw_tutorial/dsw_new path.
      You can switch to the path by using one of the following methods:
      • Double-click dsw_new in the Name column.
      • Right-click dsw_new in the Name column. In the shortcut menu that appears, click Open.
    6. Open the model file of the downloaded case.
      You can open the model file by using one of the following methods:
      • Double-click the file name in the Name column.
      • Right-click the file name in the Name column. In the shortcut menu that appears, click Open.
  4. In the top navigation bar, choose Run > Run All Cells to run the case.

Manage third-party libraries

If you use a Python development environment, you can perform the following operations to manage third-party libraries in Terminal.
  • Install a third-party library
    pip install --user <yourLibraryName>
    You need to replace <yourLibraryName> with the name of the third-party library that you want to install. For example, you can run the pip install --user sklearn command to install a sklearn library.
  • View third-party libraries
    pip list
    You can view all third-party libraries that you have installed.
  • Remove a third-party library
    pip uninstall <yourLibraryName>
    You need to replace <yourLibraryName> with the name of the third-party library that you want to remove.
    Note You can remove only the third-party libraries that are installed by yourself.
tensoflow-gpu cannot be removed. You can only run the update command to install a specified version of tensoflow-gpu. The specified version must be compatible with the Compute Unified Device Architecture (CUDA) version of the DSW instance that you are using. Subscription DSW instances use CUDA 10. Pay-as-you-go DSW instances use CUDA 9.
pip install --upgrade --user tensorflow-gpu=<versionNumber>
You need to replace <versionNumber> with the version number of tensoflow-gpu that you want to install.
Notice Do not upgrade pip. Otherwise, the installation may fail.
DSW provides the following development environments: Python2, Python3, PyTorch, and TensorFlow2.0. By default, third-party libraries are installed in Python3. If you want to install a third-party library in another development environment, you must manually switch to the environment where you want to install the third-party library.
Install in Python2.
source activate python2
pip install --user <yourLibraryName>
Install in TensorFlow2.0.
source activate tf2
pip install --user <yourLibraryName>
You need to replace <yourLibraryName> with the name of the third-party library that you want to install.

Upload files

  • Small files

    You can click the Upload files icon in the toolbar to upload files. Resumable uploading is supported.

  • Large files

    Store large files in a NAS file system. For more information, see Upload and download files.

Deploy models

EASCMD is a built-in command-line tool of DSW. You can use the command-line tool in Terminal to deploy models to Elastic Algorithm Service (EAS).

  1. Use your AccessKey pair to complete identity verification.
    You must provide your AccessKey ID and AccessKey secret to complete identity verification when you deploy a model in Terminal to EAS.
    eascmd config -i <AccessKey ID> -k <AccessKey Secret> -e pai-eas-share.cn-beijing.aliyuncs.com
    Modify <AccessKey ID>, <AccessKey Secret>, and the parameter following -e based on your requirements. The parameter following -e indicates the endpoint of the region to which you want to deploy the model. The following table lists the supported regions and corresponding endpoints.
    Region Endpoint
    China (Shanghai) pai-eas.cn-shanghai.aliyuncs.com
    China (Beijing) pai-eas.cn-beijing.aliyuncs.com
    China (Hangzhou) pai-eas.cn-hangzhou.aliyuncs.com
    China (Shenzhen) pai-eas.cn-shenzhen.aliyuncs.com
    China (Hong Kong) pai-eas.cn-hongkong.aliyuncs.com
    Singapore (Singapore) pai-eas.ap-southeast-1.aliyuncs.com
    India (Mumbai) pai-eas.ap-south-1.aliyuncs.com
    Indonesia (Jakarta) pai-eas.ap-southeast-5.aliyuncs.com
    Germany (Frankfurt) pai-eas.eu-central-1.aliyuncs.com
    User verification
  2. Upload model files.
    When you create a model service, you must store the model files and Processor in an HTTP address or an Object Storage Service (OSS) path. You can run the upload command of EASCMD to upload the model files of a trained model to the OSS bucket provided by EAS. After the files are uploaded, the OSS path where the model files are stored is returned.
    eascmd upload <yourFileName> --inner
    <yourFileName> indicates the model files or custom processor of the trained model. Set the parameters based on your requirements.
    After you upload model files, the OSS path oss target path is returned.
    sh-4.2$ eascmd upload xlab_m_random_forests__638730_v0-random forest-1-Model.pmml --inner
    [OK] oss endpoint:    [http://oss-cn-beijing-internal.aliyuncs.com]
    [OK] oss target path: [oss://eas-model-beijing/129571599519****/xlab_m_random_forests__638730_v0-random forest-1-Model.pmml]
    Succeed: Total num: 1, size: 23,846. OK num: 1(upload 1 files).
    oss://eas-model-beijing/129571599519****/xlab_m_random_forests__638730_v0-random forest-1-Model.pmml indicates the OSS path where the random forest model is stored.
  3. Create a model service in EAS.
    1. Create a JSON file in EAS, such as pmml.json, to describe the model service.
      {
        "name": "model_example",
        "generate_token": "true",
        "model_path": "oss://eas-model-shanghai/129571599519****/xlab_m_random_forests__638730_v0-random forest-1-Model.pmml",
        "processor": "pmml",
        "metadata": {
          "instance": 1,
          "cpu": 1
        }
      }
      model_path indicates the OSS path where the model files are stored. For more information about other parameters, see EASCMD客户端使用说明.
    2. Run the create command to create a model service.
      eascmd create pmml.json
      Create a model serviceYou can navigate to the Elastic Algorithm Service page to view the deployed model service. For more information, see View deployed model services.