Run STSGCN on Microsoft OpenPAI
masterpai_jobs directory to match your cluster's specifications.repository·master·Indexed 19 days ago
https://github.com/davidham3/stsgcnA framework for spatial-temporal network data forecasting presented in AAAI 2020. The project provides a training pipeline via main.py, supporting Docker with NVIDIA and Microsoft OpenPAI deployments. It utilizes JSON configuration files to define model parameters, hyperparameters, and MXNet GPU contexts.
pai_jobs directory to match your cluster's specifications.The recommended way to run STSGCN is via Docker with NVIDIA support. Follow these steps to build the environment and run the training pipeline:
docker directory:cd docker && docker build -t stsgcn/mxnet_1.41_cu100 .STSGCN_data.tar.gz) and uncompress it:tar -zxvf data.tar.gzconfig/PEMS03/individual_GLU_mask_emb.json) and modify the ctx term to match your available GPU devices./mxnet inside the container:docker run -ti --rm --runtime=nvidia -v $PWD:/mxnet stsgcn/mxnet_1.41_cu100 python3 main.py --config config/PEMS03/individual_GLU_mask_emb.jsoncd docker && docker build -t stsgcn/mxnet_1.41_cu100 .
tar -zxvf data.tar.gz
docker run -ti --rm --runtime=nvidia -v $PWD:/mxnet stsgcn/mxnet_1.41_cu100 python3 main.py --config config/PEMS03/individual_GLU_mask_emb.jsonThe model expects data to be structured in specific dimensions for both input (data) and targets (label). The shapes are derived from the configuration file as follows:
data): (batch_size, points_per_hour, num_of_vertices, 1)label): (batch_size, points_per_hour, num_of_vertices)Data is loaded using generate_data(graph_signal_matrix_filename), which yields training, validation, and testing sets.
The training process is driven by a JSON configuration file. Based on the implementation in main.py, the following keys are required or used:
batch_size: Integer size for training batches.num_of_vertices: Number of nodes in the graph.graph_signal_matrix_filename: Path to the graph signal matrix data.epochs: Total number of training epochs.learning_rate: Initial learning rate for the optimizer.optimizer: Name of the optimizer to use (e.g., via MXNet).points_per_hour: The temporal dimension size for the input data shapes.max_update_factor: Factor used to calculate the max_update for the PolyScheduler.num_for_predict: Number of steps used for evaluating test performance.ctx: Specifies the MXNet context. Can be an int (e.g., 0 for GPU 0) or a list of integers (e.g., [0, 1] for multiple GPUs).The main.py script serves as the entrypoint for training the STSGCN model. It requires a JSON configuration file to define model parameters, data paths, and training hyperparameters. You can trigger training, testing, or visualization using command-line flags.
--config <path>: Required. Path to the JSON configuration file.--test: If provided, the program runs in test mode (limiting data to the first 100 samples) and sets the epoch count to 5.--plot: If provided, renders the network graph as a graph.png file.--save: If provided, saves the model checkpoint using the name STSGCN and the current epoch number.python main.py --config config.json --save --plot