mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
fix: Support mps device where available
This commit is contained in:
@@ -20,7 +20,11 @@ class BasePyTorchModel(IFreqaiModel, ABC):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(config=kwargs["config"])
|
super().__init__(config=kwargs["config"])
|
||||||
self.dd.model_type = "pytorch"
|
self.dd.model_type = "pytorch"
|
||||||
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
self.device = (
|
||||||
|
"mps"
|
||||||
|
if torch.backends.mps.is_available() and torch.backends.mps.is_built()
|
||||||
|
else ("cuda" if torch.cuda.is_available() else "cpu")
|
||||||
|
)
|
||||||
test_size = self.freqai_info.get("data_split_parameters", {}).get("test_size")
|
test_size = self.freqai_info.get("data_split_parameters", {}).get("test_size")
|
||||||
self.splits = ["train", "test"] if test_size != 0 else ["train"]
|
self.splits = ["train", "test"] if test_size != 0 else ["train"]
|
||||||
self.window_size = self.freqai_info.get("conv_width", 1)
|
self.window_size = self.freqai_info.get("conv_width", 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user