From 95772be6b9a3c6c5e85d91bd1f844cd62c42f01a Mon Sep 17 00:00:00 2001 From: Alexander Borzunov Date: Thu, 31 Aug 2023 11:32:16 +0400 Subject: [PATCH] Force DHT to be mp.context.ForkProcess (#589) This doesn't change anything on Linux but helps macOS users. Specifically, it's helps to: - Avoid [this error](https://github.com/bigscience-workshop/petals/issues/405#issuecomment-1699185359) for people who don't use `if __name__ == "__main__"` in simple scripts on macOS (that uses spawn for processes by default). - Make DHT consistent with other code that inherits from `mp.context.ForkProcess` directly. (cherry picked from commit 1eb5d189fdc4f7c66ca6b3fbd8bb94c84019e568) --- hivemind/dht/dht.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hivemind/dht/dht.py b/hivemind/dht/dht.py index aad880fd4..85b371d1c 100644 --- a/hivemind/dht/dht.py +++ b/hivemind/dht/dht.py @@ -20,7 +20,7 @@ ReturnType = TypeVar("ReturnType") -class DHT(mp.Process): +class DHT(mp.context.ForkProcess): """ A high-level interface to a hivemind DHT that runs a single DHT node in a background process. * hivemind servers periodically announce their experts via declare_experts (dht_handler.py)