MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / get_free_port

Function get_free_port

SwissArmyTransformer/sat/helpers.py:158–164  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156 print_all(f"state: {name}, min: {s.min()}, max: {s.max()}, mean: {s.mean()}, std: {s.std()}, scale: {s.abs().mean()}, first5: {s.flatten()[:5]}")
157
158def get_free_port():
159 import socket
160 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
161 s.bind(('localhost', 0))
162 port = s.getsockname()[1]
163 # At this point, the socket is closed, and the port is released
164 return port
165
166def check_if_zero3(args):
167 return hasattr(args, 'deepspeed_config') and (args.deepspeed_config is not None) and (args.deepspeed_config.get('zero_optimization',{}).get('stage', 0) >= 3)

Callers 2

initialize_distributedFunction · 0.90
initialize_distributedFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected