Skip to content
Snippets Groups Projects
Commit c1ca208f authored by Manon Blanco's avatar Manon Blanco Committed by Manon Blanco
Browse files

Allow to force to a single GPU

parent 69c8df89
No related branches found
No related tags found
1 merge request!299Allow specifying device to use when training
This commit is part of merge request !299. Comments created here will be created in the context of that merge request.
......@@ -101,7 +101,7 @@ class GenericTrainingManager:
def init_hardware_config(self):
# Debug mode
if self.device_params["force"] == "cpu":
if self.device_params["force"] not in [None, "cuda"] or not torch.cuda.is_available():
self.device_params["use_ddp"] = False
self.device_params["use_amp"] = False
......
......@@ -146,7 +146,8 @@ def serialize_config(config):
def start_training(config, mlflow_logging: bool) -> None:
if (
config["training"]["device"]["use_ddp"]
and config["training"]["device"]["force"] != "cpu"
and config["training"]["device"]["force"] in [None, "cuda"]
and torch.cuda.is_available()
):
mp.spawn(
train_and_test,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment