Fred808 commited on
Commit
1a079db
·
verified ·
1 Parent(s): 4242f85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -28,7 +28,7 @@ class Settings:
28
  AGGREGATOR_URL = os.getenv("AGGREGATOR_URL", "http://192.168.1.104:8002")
29
 
30
  # Model settings
31
- MODEL_REPO = "https://huggingface.co/facebook/opt-125m"
32
 
33
  # Server settings
34
  TENSOR_SERVER_TIMEOUT = 30 # seconds
@@ -1119,21 +1119,20 @@ async def startup_event():
1119
  print("[INFO] Starting chunk distribution...")
1120
  distribution_tasks = []
1121
 
1122
- # Round-robin distribution to tensor servers
1123
  for chunk_id, chunk in state.model_chunks.items():
1124
- # Determine target servers (distribute each chunk to 2 servers for redundancy)
1125
- server_indices = [i % len(Settings.TENSOR_SERVER_URLS) for i in range(chunk_id * 2, chunk_id * 2 + 2)]
1126
- target_servers = [Settings.TENSOR_SERVER_URLS[i] for i in server_indices]
 
 
 
 
 
 
1127
 
1128
- for server_url in target_servers:
1129
- print(f"[INFO] Sending chunk {chunk_id} to {server_url}")
1130
- task = asyncio.create_task(
1131
- send_chunk_to_server(server_url, chunk_id, chunk)
1132
- )
1133
- distribution_tasks.append(task)
1134
-
1135
- # Track assignments for future reference
1136
- chunk.server_assignments.append(server_url)
1137
 
1138
  if distribution_tasks:
1139
  print(f"[INFO] Distributing {len(distribution_tasks)} chunks...")
 
28
  AGGREGATOR_URL = os.getenv("AGGREGATOR_URL", "http://192.168.1.104:8002")
29
 
30
  # Model settings
31
+ MODEL_REPO = "https://huggingface.co/microsoft/florence-2-large"
32
 
33
  # Server settings
34
  TENSOR_SERVER_TIMEOUT = 30 # seconds
 
1119
  print("[INFO] Starting chunk distribution...")
1120
  distribution_tasks = []
1121
 
1122
+ # One chunk per server distribution
1123
  for chunk_id, chunk in state.model_chunks.items():
1124
+ # Assign each chunk to exactly one server
1125
+ server_index = chunk_id % len(Settings.TENSOR_SERVER_URLS)
1126
+ server_url = Settings.TENSOR_SERVER_URLS[server_index]
1127
+ # Create task for distributing this chunk to its assigned server
1128
+ task = asyncio.create_task(
1129
+ send_chunk_to_server(server_url, chunk_id, {"chunk_id": chunk_id})
1130
+ )
1131
+ distribution_tasks.append(task)
1132
+ print(f"[INFO] Sending chunk {chunk_id} to {server_url}")
1133
 
1134
+ # Track assignments for future reference
1135
+ chunk.server_assignments.append(server_url)
 
 
 
 
 
 
 
1136
 
1137
  if distribution_tasks:
1138
  print(f"[INFO] Distributing {len(distribution_tasks)} chunks...")