Working with Watson Machine Learning Accelerator notebooks in IBM Cloud Pak for Data

Use IBM Watson® Machine Learning Accelerator notebooks to run elastic distributed training workloads in IBM® Cloud Pak for Data.

  1. Before using Watson Machine Learning Accelerator notebooks, complete the following tasks:
    1. Considerations for upgrading from IBM Cloud Pak for Data Version 4.7 to Version 4.8
    2. Considerations for upgrading from IBM Cloud Pak for Data Version 4.6 to Version 4.8
  2. Submitting workloads using Watson Machine Learning Accelerator notebooks, see Using elastic distributed training API in notebooks.

Considerations for upgrading from IBM Cloud Pak for Data Version 4.7 to Version 4.8

If you are upgrading from IBM Cloud Pak for Data Version 4.7 to Version 4.8, you will need to update your notebooks. After upgrading, you must:
  • Edit the notebook runtime
  • Edit the notebook code

Edit the notebook runtime

From IBM Cloud Pak for Data, follow these steps to find and edit a notebook runtime:
  1. In the project navigation trail, click your project name to return to your project.

  2. Click the Assets tab to find the notebook.

  3. When you click the notebook, it will open in READ ONLY mode.

  4. To edit the notebook, click the pencil icon .

  5. Click the Information icon to open the Information panel.

  6. On the General tab, edit the name and description of the notebook.

  7. Click the Environment tab to change the environment used to run the notebook and update the runtime to either Runtime 23.1 on Python 3.10 (recommended) or GPU Runtime 23.1 on Python 3.10.

    Here

Edit notebook code

To ensure that your notebook code runs using notebook runtime Runtime 23.1 on Python 3.10 or GPU Runtime 23.1 on Python 3.10, you must:
  • Update import FabricModel statement
  • Remove references to DATA_DIR

Update import FabricModel statement

The following notebook code must be updated.

Change the following import statement from:
from fabric_model import FabricModel
To:
from pyedt.fabric_model import FabricModel

Update references to DATA_DIR

Update any instances of DATA_DIR in the notebook code as it is no longer supported. Data must now be downloaded from a directory.

For example, change the following code from:
"DATA_DIR = os.getenv("DATA_DIR")"
"print("DATA_DIR: " + os.getenv("DATA_DIR"))"
To:
"DATA_DIR = os.getenv("DATA_DIR", "/gpfs/mydatafs")"
"print("DATA_DIR: " + DATA_DIR)"
Example: to download data from a directory, replace the following by removing the following code:
datasets.MNIST(DATA_DIR, download=True)

def getDatasets():
    return (datasets.MNIST(DATA_DIR, train=True, download=False, transform=transforms.Compose([
                           transforms.ToTensor()
                       ])),
            datasets.MNIST(dataset_dir, train=False, download=False, transform=transforms.Compose([
                           transforms.ToTensor()
                       ]))
            )
Replacing the code referencing DATA_DIR with the following code:
dataset_dir = <your_storage_volume_path>
def getDatasets():
    return (datasets.MNIST(dataset_dir, train=True, download=True, transform=transforms.Compose([
                           transforms.ToTensor()
                       ])),
            datasets.MNIST(dataset_dir, train=False, download=Ture, transform=transforms.Compose([
                           transforms.ToTensor()
                       ]))
            )

For additional examples, see IBM Git.

Considerations for upgrading from IBM Cloud Pak for Data Version 4.6 to Version 4.8

Before you upgrade IBM Cloud Pak for Data Version 4.6 to Version 4.8, you can backup existing notebooks to your local system. After upgrading, you are able to restore these notebooks.

When upgrading all previously installed Watson Machine Learning Accelerator notebooks are removed.

To export your notebooks, do the following:
  1. Login to the Watson Machine Learning Accelerator console.
  2. Go to Workload > My Notebook Server and start the notebook server.
  3. In the JupyterLab page, navigate to the notebook file you want to migrate using the left menu.
  4. Right-click on the notebook file.
  5. Click Download to save the notebook file to your local system.
After upgrade, the exported notebooks can be imported into Watson Studio:
  1. Navigate to the user project page in Watson Studio.
  2. Click New Asset.
  3. Select Jupyter Notebook Editor.
  4. Click the From File tab, select the Watson Machine Learning Accelerator notebook runtime and upload the notebook file you just save.
  5. After importing notebooks, make sure to edit the notebook to work with IBM Cloud Pak for Data 4.8. Refer to the Edit notebook code section.

Create a notebook

To create a notebook in Cloud Pak for Data, see Creating notebooks.

Open a notebook

You can find and open notebooks from the Assets page of the project.

To open the notebook, click on the notebook for it to open in edit mode.