Spaces using CPU
Hi All,I am new here. I have built a model using pytorch on a GPU. I want to create a space which leverages the model on a CPU. Is that possible? The reason I ask is because when I load the model on my computer(without GPU), the predict function throws an errorAssertionError: Torch not compiled with CUDA enabledAppreciate any help.
2023-05-11T04:41:03Z
hi@anisharitakulayou can use this statement to set the available device, and use torch to load to that specific define, that will make your model work on both environments CPU/GPUdevice = torch.device("cuda" if torch.cuda.is_available() else "cpu")
r = torch.randn(2).to(device)
2023-05-11T04:47:08Z
Thanks@radames!