Skip to content

Commit b0cd3ae

Browse files
authored
Merge pull request #152 from openclimatefix/fix-multiprocessing-save-batches
Fix multiprocessing for batch creation
2 parents b539bc7 + ef3752e commit b0cd3ae

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ conda create -n ocf_datapipes python=3.10
101101
Then go inside the ocf_datapipes repo to add packages
102102

103103
```bash
104-
pip install -r requirements.txt requirements-dev.txt
104+
pip install -r requirements.txt -r requirements-dev.txt
105105
```
106106

107107
Then exit this environment, and enter back into the pvnet conda environment and install ocf_datapies in editable mode (-e). This means the package is directly linked to the source code in the ocf_datapies repo.

scripts/save_batches.py

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
```
1616
1717
"""
18+
# This is needed to get multiprocessing/multiple workers to behave
19+
try:
20+
import torch.multiprocessing as mp
21+
22+
mp.set_start_method("spawn", force=True)
23+
except RuntimeError:
24+
pass
25+
1826
import logging
1927
import os
2028
import shutil

0 commit comments

Comments
 (0)