[object Object]

← back to Exo

fix filter to include 169.254.* since thats what mac uses for ethernet

9ba8bbbcf8398e64cd789f5df8070d5d050f791b · 2025-01-22 23:47:43 +0000 · Alex Cheema

Files touched

Diff

commit 9ba8bbbcf8398e64cd789f5df8070d5d050f791b
Author: Alex Cheema <alexcheema123@gmail.com>
Date:   Wed Jan 22 23:47:43 2025 +0000

    fix filter to include 169.254.* since thats what mac uses for ethernet
---
 exo/helpers.py                                | 20 +++++++++++---------
 exo/inference/mlx/sharded_inference_engine.py |  1 -
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/exo/helpers.py b/exo/helpers.py
index 5f3554f9..ff0205f0 100644
--- a/exo/helpers.py
+++ b/exo/helpers.py
@@ -14,6 +14,7 @@ from pathlib import Path
 import tempfile
 import json
 from concurrent.futures import ThreadPoolExecutor
+import traceback
 
 DEBUG = int(os.getenv("DEBUG", default="0"))
 DEBUG_DISCOVERY = int(os.getenv("DEBUG_DISCOVERY", default="0"))
@@ -230,20 +231,21 @@ def pretty_print_bytes_per_second(bytes_per_second: int) -> str:
 
 
 def get_all_ip_addresses_and_interfaces():
-  try:
     ip_addresses = []
     for interface in get_if_list():
-      ip = get_if_addr(interface)
-      # Include all addresses, including loopback
-      # Filter out link-local addresses
-      if not ip.startswith('169.254.') and not ip.startswith('0.0.'):
-        # Remove "\\Device\\NPF_" prefix from interface name
+      try:
+        ip = get_if_addr(interface)
+        if ip.startswith("0.0."): continue
         simplified_interface = re.sub(r'^\\Device\\NPF_', '', interface)
         ip_addresses.append((ip, simplified_interface))
+      except:
+        if DEBUG >= 1: print(f"Failed to get IP address for interface {interface}")
+        if DEBUG >= 1: traceback.print_exc()
+    if not ip_addresses:
+      if DEBUG >= 1: print("Failed to get any IP addresses. Defaulting to localhost.")
+      return [("localhost", "lo")]
     return list(set(ip_addresses))
-  except:
-    if DEBUG >= 1: print("Failed to get all IP addresses. Defaulting to localhost.")
-    return [("localhost", "lo")]
+
 
 
 async def get_macos_interface_type(ifname: str) -> Optional[Tuple[int, str]]:
diff --git a/exo/inference/mlx/sharded_inference_engine.py b/exo/inference/mlx/sharded_inference_engine.py
index 281b9e3d..9a0d28a2 100644
--- a/exo/inference/mlx/sharded_inference_engine.py
+++ b/exo/inference/mlx/sharded_inference_engine.py
@@ -165,4 +165,3 @@ class MLXDynamicShardInferenceEngine(InferenceEngine):
 
   async def cleanup(self):
     self._mlx_thread.shutdown(wait=True)
-

← 8ab9977f fix stable diffusion case for tui, make mlx run on its own t  ·  back to Exo  ·  fix check for sd2.1 bbb68569 →