Closed rullo16 closed 2 weeks ago
i've had this issue, there are two fixes for this:
simply disabling threading in the config file for your agent
if you wanna keep threading enabled, you could also use the (deprecated, so it may not work in the future) PyTorch API: Add this line torch.set_default_tensor_type(torch.cuda.FloatTensor)
to this following file C:\Users\rullo\anaconda3\envs\ml_agents\lib\site-packages\mlagents\torch_utils\torch.py
(assuming it's where it's located)
anyways here's an example of the fix for threading:
def set_torch_config(torch_settings: TorchSettings) -> None:
global _device
if torch_settings.device is None:
device_str = "cuda" if torch.cuda.is_available() else "cpu"
else:
device_str = torch_settings.device
_device = torch.device(device_str)
if _device.type == "cuda":
torch.set_default_device(_device.type)
torch.set_default_dtype(torch.float32)
torch.set_default_tensor_type(torch.cuda.FloatTensor) # deprecated
else:
torch.set_default_dtype(torch.float32)
logger.debug(f"default Torch device: {_device}")
Ok thank you for your reply, this solved my issue :)
Hello, I have been trying to follow the hummingbird tutorial and to train it using the gpu, however, when I start training I get a message saying that there are multiple devices "cuda:0" and "cpu". I have tried using the different InferenceDevices from the configuration but still get the same error.
This is the error:
Environment (please complete the following information):