Last modified 2025-09-05 |
Start an AI/ML Training Run (Tutorial)
![]() | Abbreviations Key | ||||
AI | artificial intelligence | hp | hisepy | ||
cpu | central processing units | IDE | integrated development environment | ||
dirs | directories | int | integer | ||
gb | gigabytes | ML | machine learning | ||
gpu | graphics processing units | SDK | software development kit | ||
HISE | Human Immune System Explorer | str | string |
At a Glance
This document explains how to use the HISE SDK and a Python script to launch a remote, resource-configurable training job for an AI/ML model. These jobs consume significant resources. Before you begin, make sure you have approval from your manager or project lead to use this SDK, and confirm that you have a large enough quota to accommodate the necessary training runs.
The box below shows the start_training_run()
signature, and the method parameters follow.
![]() start_training_run()hp.start_training_run( provider: str = 'ray', cpu_count: int = 1, gpu_count: int = 0, memory_size: int = 10, worker_count: int = 0, training_job_file_path: str, title: str, description: str, file_set_id: str, project: str, additional_dirs: list = [], additional_files: list = [], requirements_file_path: str = None, image_id: str = None, use_conda: bool = False, output_file_size: int = 5, ) |
Parameter | Data type | Required or optional | Default (if any) | Description |
provider | string | optional | 'ray' | Compute resource provider or backend for the training run |
cpu_count | integer | optional | 1 | Number of CPUs allocated to the training job |
gpu_count | integer | optional | 0 | Number of GPUs allocated to the training job |
memory_size | integer | optional | 10 | Amount of memory (GB) allocated to the training job |
worker_count | integer | optional | 0 | Number of worker nodes for distributed training |
training_job_file_path | string | required | NA | Path to the training job script |
title | string | required | NA | Training job titile |
description | string | required | NA | Training job description |
file_set_id | string | required | NA | File set ID used as the training job input |
project | string | optional | Project selected on IDE creation | Short name of project that the Ray job cost will be billed under |
additional_dirs | list | optional | [] | Additional directories your script requires |
additional_files | list | optional | [] | Additional files your script requires |
requirements_file_path | string | optional | None | Path to the requirements.in file (to install additional Python packages) |
image_id | string | optional | None | Image ID (e.g., Docker) for the training job |
use_conda | boolean | optional | False (pip) | Indicator of whether to use Conda environment for training |
output_file_size | integer | optional | 5 | Estimated output file size (GB) |
Get Help
If you get stuck during a start_training_run()
call, refer to the steps of this tutorial. To use the baked-in help in your IDE, try one of the following commands. Still not working? Click Support to file a ticket.
Python | Output |
help(hp.start_training_run) | Function signature, list of parameters, class, and a brief description of the method in a compact plain-text format |
hp.start_training_run? | Method signature, docstring (description), file location, and file type in more readable format |
hp.start_training_run?? | Signature, docstring, file path, a verbose set of metadata, and the source code for the method |
Instructions
|
Import libraries
To get started, set up your environment to interact with HISE programmatically and access all available SDK functions. For details, see Use Hise SDK Methods.
1. Navigate to HISE, and use your organizational email address to sign in.
2. Open an IDE. For instructions, see Create Your First HISE IDE (Tutorial).
3. Install the HISE SDK if you haven't already done so.
# Use pip to install the SDK!pip install hisepy
4. To import hisepy
, enter the following code into a new cell in your IDE.
# Import the Python SDK to enable programmatic access to HISE functionsimport hisepy as hp
Prepare your script
1. Prepare your script, as in the following example.
# Ray is a unified open-source framework for scaling AI and Python applications.
The time module provides various time-related functions.
The random module provides functions for generating pseudo-random numbers and performing random operations.
import ray
import time
import random
def compute_square(x):
time.sleep(random.uniform(0.5, 1.5)) # Simulate some delay
return x * x
def main():
inputs = list(range(10))
# Launch tasks in a list comprehension
results = [compute_square(x) for x in inputs]
# write some random output
with open("/home/workspace/output/empty.txt", "w") as f:
pass
print("Results:", results)
if __name__ == "__main__":
Note on Ray IntegrationWhen you use Ray, the HISE SDK automatically transforms your script for distributed execution. This allows your Transformed app.py for Ray Execution
|
Call start_training_run()
1. In a new cell in your IDE, call hp.start_training_run()
with all required and optional parameters.
hp.start_training_run( provider='ray', cpu_count=1, gpu_count=0, memory_size=4, worker_count=1, training_job_file_path="/home/workspace/app.py", title="Training Run Example", description="Simplified example of an AI/ML training run.", file_set_id="60b4e815-85e6-4aaa-84c2-000b48f5fff5", additional_dirs=[], additional_files=[] )
A. If the run is successful, you receive a message similar to this one.
Using default project: aifiDevTest Ray-conformant code written to: /home/workspace/.artifacts/app.py |
B. At the prompts, make any necessary changes to the decorators.
i. Answer the prompts. If you're not sure, choose 2) None.
The following methods now have ray decorators: ['compute_square']. Please select the methods from which you want to remove the Ray decorators 1) compute_square 2) None [1 - 2] The following methods now have ray decorators: ['compute_square']. Please select the methods whose Ray decorator parameters you want to edit 1) compute_square 2) None [1 - 2] |
ii. You receive a final success notification like this one.
{ 'workflowName': 'hise-ray-workflow', 'executionId': '009bfa68-2748-4a71-9056-9c4969935714', 'status': 'ACTIVE', 'message': 'Execution Created', 'trainingJobId': '00000000-0000-0000-0000-000000000000', 'trainingImageId': '00000000-0000-0000-0000-000000000000', 'providerDashboard': 'https://stage.allenimmunology.org/orchestrate/ray/dashboard/workflow/be7327a2-6644-4bbb-8fc8-d94dba2c63eb', 'executionDetails': 'https://console.cloud.google.com/workflows/workflow/us-west1/hise-ray-workflow/execution/be7327a2-6644-4bbb-8fc8-d94dba2c63eb/summary?inv=1&invt=Abx65A&project=stage-pipeline-internal&supportedpurview=project' } |
C. If you encounter any issues, check the error message, and see the following Troubleshooting tips.
|
Monitor your run
1. To watch your job start, view logs, iterate on your script, and track progress, go to RESEARCH > AI/ML > Training Runs, and click View Details. To see the most recent runs, sort by date. For details, see Review an AI/ML Training Run (Tutorial).