Skip to content

Commit 6fd5949

Browse files
v0.0.44 DataParallel
1 parent d2fb74a commit 6fd5949

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

notebooks/11_spot_hpt_torch.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
"data": {
3434
"text/plain": [
35-
"'11-torch_p040025_360min_10init_2023-04-26_23-24-12'"
35+
"'11-torch_p040025_360min_10init_2023-04-27_00-08-17'"
3636
]
3737
},
3838
"execution_count": 2,
@@ -79,7 +79,7 @@
7979
"name": "stdout",
8080
"output_type": "stream",
8181
"text": [
82-
"spotPython 0.0.43\n",
82+
"spotPython 0.0.44\n",
8383
"spotRiver 0.0.92\n",
8484
"Note: you may need to restart the kernel to use updated packages.\n"
8585
]
@@ -644,8 +644,8 @@
644644
"output_type": "stream",
645645
"text": [
646646
"Using mps device\n",
647-
"[1, 2000] loss: 2.320\n",
648-
"[1, 4000] loss: 1.162\n"
647+
"[1, 2000] loss: 2.323\n",
648+
"[1, 4000] loss: 1.159\n"
649649
]
650650
}
651651
],

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotPython"
10-
version = "0.0.43"
10+
version = "0.0.44"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/torch/net.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ def __init__(self, l1, l2, lr, batch_size, epochs):
2121
self.lr = lr
2222
self.batch_size = batch_size
2323
self.epochs = epochs
24+
if torch.cuda.device_count() > 1:
25+
print("We will use", torch.cuda.device_count(), "GPUs!")
26+
self = nn.DataParallel(self)
2427

2528
def forward(self, x):
2629
x = self.pool(F.relu(self.conv1(x)))

0 commit comments

Comments
 (0)