INNER CODE UNIT · Python
gpu_i
allenai/objaverse-xl · scripts/rendering/main.py:109
gpu_i = random.randint(0, num_gpus - 1)
elif isinstance(gpu_devices, list):
gpu_i = random.choice(gpu_devices)
elif isinstance(gpu_devices, int) and gpu_devices == 0:
using_gpu = False
else:
raise ValueError(
f"gpu_devices must be an int > 0, 0, or a list of ints. Got {gpu_devices}."
)
with tempfile.TemporaryDirectory() as temp_dir:
# get the target directory for the rendering job
target_directory = os.path.join(temp_dir, save_uid)
os.makedirs(target_directory, exist_ok=True)
args += f" --output_dir {target_directory}"
# check for Linux / Ubuntu or MacOS
if platform.system() == "Linux" and using_gpu: