Finally, we have everything set up to run the training code—these steps will allow you to create the files and run the code:
- Create a file under the src folder called run.py and add the following code:
#!/usr/bin/env python3
from train import Trainer
# Command Line Argument Method
CUBE_SIDE=16
EPOCHS = 100000
BATCH = 64
CHECKPOINT = 10
LATENT_SPACE_SIZE = 256
DATA_DIR = "/3d-mnist/full_dataset_vectors.h5"
trainer = Trainer(side=CUBE_SIDE,
latent_size=LATENT_SPACE_SIZE,
epochs =EPOCHS,
batch=BATCH,
checkpoint=CHECKPOINT,
data_dir = DATA_DIR)
trainer.train()
This code simply defines the input needed for the training class and runs the training method for our GAN architecture.
- We need to create the run.sh script at the root directory (make sure it's executable) and add the following to the file:
#/bin/bash
# Training Step
xhost +
docker run -it
--runtime=nvidia
--rm
-e DISPLAY=$DISPLAY
-v /tmp/.X11-unix:/tmp/.X11-unix
-v $HOME/3d-gan-from-images/out:/out
-v $HOME/3d-gan-from-images/src:/src
ch8 python3 /src/run.py
- To run the code, execute the following command from a Terminal with the directory as the root directory of this code:
sudo ./run.sh
That's it! You're training this architecture now!