Updated on 2024-10-29 GMT+08:00

Getting Started

This document describes how to call MoXing Framework APIs in ModelArts.

Logging In to ModelArts and Creating a Notebook Instance

  1. Log in to the ModelArts management console. In the left navigation pane, choose DevEnviron > Notebook to access the Notebook page.
  2. Click Create. On the Create Notebook page that is displayed, create a notebook instance by referring to Creating a Notebook Instance.
  3. After a notebook instance is created and enters the Running status, click Open in the Operation column to go to the JupyterLab Notebook page.
  4. On the Launcher tab page of JupyterLab, for example, click TensorFlow to create a file for encoding.
    Figure 1 Selecting an AI engine

    After the file is created, the JupyterLab page is displayed by default.

    Figure 2 Encoding page

Calling mox.file.

Enter the following code to implement the following simple functions:

  1. Introduce MoXing Framework.
  2. Create the test01 folder in the existing modelarts-test08/moxing directory.
  3. Check whether the test01 folder exists. If the folder exists, the preceding operation is successful.
1
2
3
4
import moxing as mox

mox.file.make_dirs('obs://modelarts-test08/moxing/test01')
mox.file.exists('obs://modelarts-test08/moxing/test01')

Figure 3 shows the result. Note that each time you enter a line of code, click Run. You can also go to OBS Console and check whether the test01 folder has been created in the modelarts-test08/moxing directory. For more common MoXing operations, see Sample Code for Common Operations.

Figure 3 Example