Developing Projects in CLI

All How-To topics assume that your local terminal is in an Active Location, e.g. local.

Note

The CLI commands are always run in a local terminal, even when you are working with a remote Location.

Listing Available Projects in the Location

Run

Copy
Copied!
            

nvwb list projects

Example Output:

Copy
Copied!
            

(nvwb:local) workbench@SH-Razer16:~$ nvwb list projects NAME │ DESCRIPTION │ CONTAINER │ APPS ──────────────────────────────────────────────────────────────────────────────────── llama-2-chatusd │ Fine-tune LLM for USD │ ⚫ Stopped │ ⚫jupyterlab, ⚫tensorboard │ development │ sdxl-dev │ Image generation customization │ ⚫ Stopped │ ⚫jupyterlab, ⚫tensorboard winai-rag-demo │ Demonstrating Llama2 RAG for │ ⚫ Stopped │ ⚫jupyterlab, ⚫tensorboard │ NVIDIA Documentation │ │ rapids-cudf │ Accelerate RAPIDS workflows │ ⚫ Stopped │ ⚫tensorboard, ⚫jupyterlab │ with cuDF │ │

What can go wrong:

  • Your terminal isn’t in an Active Location

Creating a Project

Run the following command and follow the instructions to enter the relevant information.

Hit enter to proceed through the fields. :

Copy
Copied!
            

nvwb create project [project_name]

Example Output:

Copy
Copied!
            

(nvwb:local) workbench@NV-2G4NGG3:~$ nvwb create project ? Enter a unique name for the project: first-new-project ? Enter a description: caching python basic base ? Choose a base environment: Python Basic Created new project 'first-new-project' (/home/workbench/nvidia-workbench/first-new-project) ✓ Container build complete (17.703274949s)

What can go wrong:

  • Your terminal isn’t in an Active Location

  • You chose a name for a Project that is already on disk

Cloning a Project

Get the URL of the Project you wish to clone, <project_url>, and run the following command.

Copy
Copied!
            

nvwb clone project <project_url>

Example Output

NA

What can go wrong:

  • The Project is private and you don’t have access to it.

Opening or Closing a Project

Open a Project

Run the following command, where <project_name> is optional. Leaving it out will let you select the desired Project from a drop-down.

Copy
Copied!
            

nvwb open [<project_name>]

Example Output

Copy
Copied!
            

(nvwb:local) workbench@windows:~$ nvwb open ? Select a project [Use arrows to move, type to filter] > /home/workbench/nvidia-workbench/NVIDIA-workbench-example-rapids-cudf - rapids-cudf: Accelerate RAPIDS workflows with cuDF /home/workbench/nvidia-workbench/my-rapids-project - my-rapids-project: test /home/workbench/nvidia-workbench/NVIDIA-workbench-example-rapids-cuml - rapids-cuml: Accelerate machine learning workflows with RAPIDS cuML

Close a Project

Run the following command, where the flag -f is optional. The flag will shutdown the container if it is running.

Copy
Copied!
            

nvwb close [-f]

What can go wrong:

  • Your terminal isn’t in an open Project

  • You are trying to close an open Project that has a running container without the -f flag.

Getting the Project Status

Run

Copy
Copied!
            

nvwb status

Example Output:

Copy
Copied!
            

(nvwb:local/rapids-cudf) workbench@windows:~/nvidia-workbench/NVIDIA-workbench-example-rapids-cudf$ nvwb status • Name: rapids-cudf (/home/workbench/nvidia-workbench/NVIDIA-workbench-example-rapids-cudf) • Description: Accelerate RAPIDS workflows with cuDF • Environment: 🟢 No Build Required • Container: ⚫ Stopped • Applications: • jupyterlab: ⚫ Stopped • Remote Repository: https://github.com/NVIDIA/workbench-example-rapids-cudf (1 🔼) • Local Repository: 3 🟡 Modified

What can go wrong:

  • Your terminal isn’t in an open Project

  • You are trying to check the status of Project that you can’t access on the relevant Git server.

Updating the Number of GPUs for the Container

Run the following command, select the resources to update, and then enter desired values and hit return.

Copy
Copied!
            

nvwb update resources

Example Output:

Copy
Copied!
            

(nvwb:local/example-gpu-project) workbench@NV-2G4NGG3:~/nvidia-workbench/example-gpu-project$ nvwb update resources ? Choose a resource type to update: GPUs [0], Shared Memory in MB [0] ? Enter the value for resource type 'GPUs': 2 ? Enter the value for resource type 'Shared Memory in MB': 1024 Project resources updated GPUs Requesed: 2 Shared Memory in MB: 1024

What Can Go Wrong

  • You selected several GPUs or shared memory that isn’t available.

Versioning a Project

Run the following command and review the auto-generated commit message. If desired, modify the commit message by tabbing through the fields and hitting enter when the Commit bar is green.

Copy
Copied!
            

nvwb commit

Example Output:

commit-cli.jpg

What Can Go Wrong

  • You are trying to commit files to a folder that has git storage but they are too large. NVIDIA AI Workbench is prompting you to move them to a folder with gitlfs or .gitignore storage.

Publishing a Project to a Git Server with the CLI

Run the following command and follow the instructions to enter the relevant information, hitting Return to move to the next entry. You need to select the desired Git server, Git username, and permissions for the repository.

Copy
Copied!
            

nvwb publish

Example Output:

Copy
Copied!
            

(nvwb:local/example) workbench@windows:~/nvidia-workbench/example$ nvwb publish ? Choose a remote git server: https://github.com ? Choose a namespace: <your_user_name> ? Select the repository visibility: [Use arrows to move, type to filter, ? for more help] > private public internal

What can go wrong:

  • You have not yet configured an integration for a Git server.

  • Your access to the Git server has changed, e.g. your credentials are outdated.

Fetching a Project

Run the following command inside your project to fetch any changes from the remote repository into the local repository.

Copy
Copied!
            

nvwb fetch [flags]

Example Output:

Copy
Copied!
            

(nvwb:local/example-finetune) workbench@windows:~/nvidia-workbench/user-example-finetune$ nvwb fetch ✓ Project Fetch complete (3.029104446s) Successfully Fetched project 'example-finetune'

What can go wrong:

  • There is no remote repository URL for the project, eg. it is unpublished.

  • You have not yet configured an integration for a Git server.

  • Your access to the Git server has changed, e.g. your credentials are outdated.

Pulling a Project

Run the following command inside your project to pull the latest commits from the remote git server to the current branch of the local project repository in the specified context, if the --context flag is provided. Otherwise, the currently activated context is used. This operation is aborted if any merge conflicts are detected.

Copy
Copied!
            

nvwb pull [flags]

Example Output:

Copy
Copied!
            

(nvwb:local/example-finetune) workbench@windows:~/nvidia-workbench/user-example-finetune$ nvwb pull ✓ Project Pull complete (3.03248096s) Successfully pulled project 'example-finetune'

What can go wrong:

  • There is no remote repository URL for the project, eg. the project is unpublished.

  • You have uncommitted or untracked changes in the project that need committing or stashing.

  • You have not yet configured an integration for a Git server.

  • Your access to the Git server has changed, e.g. your credentials are outdated.

Pushing a Project

Run the following command inside your project after committing changes locally to push the local commits to the remote git server.

Copy
Copied!
            

nvwb push [flags]

Example Output:

Copy
Copied!
            

(nvwb:local/example-finetune) workbench@windows:~/nvidia-workbench/user-example-finetune$ nvwb commit ✓ Changes committed successfully (nvwb:local/example-finetune) workbench@windows:~/nvidia-workbench/user-example-finetune$ nvwb push ✓ Project Push complete (4.036818604s) Successfully Pushed project 'example-finetune'

What can go wrong:

  • There is no remote repository URL for the project, eg. the project is unpublished.

  • You have uncommitted or untracked changes in the project that need committing or stashing.

  • You have not yet configured an integration for a Git server.

  • Your access to the Git server has changed, e.g. your credentials are outdated.

Assumptions

  • Your terminal is in an open Project

  • JupyterLab is running

Requirements

  • You will need to restart, and potentially rebuild, the container to make sure the changes are available in the Project container.

Adding Environment Variables

Through JupyterLab

Open the variables.env file in the root folder and edit the file with your environment variables. Save and restart the project container.

Example Output:

jupyterlab-env-vars.png

Through the CLI

Run nvwb create environment-variable, enter the desired values, and then restart the Project container.

Example Output:

Copy
Copied!
            

(nvwb:local/example-for-docs) workbench@NV-2G4NGG3:~$ nvwb create environment-variable ? Enter the environment variable name: HF_HOME ? Enter a value for the environment variable:: /mnt/hf_home ? Enter a description: Local storage for HF models and data. VARIABLE │ VALUE │ DESCRIPTION ───────────┼──────────────┼───────────────────────────────── HF_HOME │ /mnt/hf_home │ Local storage for HF models │ │ and data.

Adding Secrets

Open a project inside an activated context and then run

Copy
Copied!
            

nvwb create secret

Provide the secret variable name and a description.

Copy
Copied!
            

(nvwb:local/hello-world) nvidia@host:~/nvidia-workbench/hello-world$ nvwb create secret ? Enter the secret variable name: MY_VAR ? Enter a description: An example secret variable VARIABLE │ DESCRIPTION │ CONFIGURED ───────────┼────────────────────────────┼───────────── MY_VAR │ An example secret variable │ false

Next, to configure your secret, run

Copy
Copied!
            

nvwb configure secrets

Navigate to the secret you would like to configure and press Space to select. Then press Enter.

Enter the value for your secret and press Enter to confirm.

Copy
Copied!
            

(nvwb:local/hello-world) nvidia@host:~/nvidia-workbench/hello-world$ nvwb configure secrets ? Choose a secret variable: MY_VAR [❌ Not Configured] - An example secret variable ? Enter the value for Secret 'MY_VAR': 123 1 secrets configured VARIABLE │ DESCRIPTION │ CONFIGURED ───────────┼────────────────────────────┼───────────── MY_VAR │ An example secret variable │ true

If already running, restart your project for the changes to take effect in your environment.

Configuring Mounts

Open a project inside an activated context and then run

Copy
Copied!
            

nvwb create mount

Read the description of the options and select the type of mount (PROJECT, HOST, VOLUME, or TMP)

Copy
Copied!
            

(nvwb:local/hello-world) nvidia@host:~/nvidia-workbench/hello-world$ nvwb create mount ? Choose a mount type: [Use arrows to move, type to filter] > PROJECT - Where the Project will be mounted within the container HOST - Mount a directory from the system where the Project is located VOLUME - Create a persistent volume for storing data within a Project container that will not be erased by Project rebuilds TMP - Create a temporary file location within a Project container

Depending on the type of mount selected, follow the instructions to create the mount.

Copy
Copied!
            

(nvwb:local/hello-world) nvidia@host:~/nvidia-workbench/hello-world$ nvwb create mount ? Choose a mount type: HOST ? Enter the target directory or file: /home/nvidia ? Enter a description: This is my host mount ? Enter any mount options: TYPE │ TARGET │ DESCRIPTION │ CONFIGURED ──────────┼───────────────┼───────────────────────┼───────────── PROJECT │ /project/ │ Project directory │ true HOST │ /home/nvidia/ │ This is my host mount │ false

Next, to configure your mount, run

Copy
Copied!
            

nvwb configure mounts

Navigate to the secret you would like to configure and press Space to select. Then press Enter.

Enter the value for your secret and press Enter to confirm.

Copy
Copied!
            

(nvwb:local/hello-world) nvidia@host:~/nvidia-workbench/hello-world$ nvwb configure mounts ? Enter the source directory or file for Mount '/home/nvidia/': /home/nvidia/nvidia-workbench 1 mounts configured TYPE │ TARGET │ DESCRIPTION │ CONFIGURED ──────────┼───────────────┼───────────────────────┼───────────── PROJECT │ /project/ │ Project directory │ true HOST │ /home/nvidia/ │ This is my host mount │ true

If already running, restart your project for the changes to take effect in your environment.

Previous Configuring Integrations with CLI
Next Running Applications with CLI
© Copyright 2023-2024, NVIDIA. Last updated on Jan 21, 2024.