MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / start_instance

Method start_instance

CommonKG/llm_infer.py:30–35  ·  view source on GitHub ↗

启动ollama实例在特定GPU和端口上

(self, num, port)

Source from the content-addressed store, hash-verified

28 time.sleep(startup_delay) # 等待所有实例启动
29
30 def start_instance(self, num, port):
31 """启动ollama实例在特定GPU和端口上"""
32 # cmd = f"CUDA_VISIBLE_DEVICES={num} OLLAMA_HOST={self.base_url}:{port} ollama serve"
33 cmd = f"OLLAMA_HOST={self.base_url}:{port} ollama serve"
34 print("Running command:", cmd)
35 # subprocess.Popen(cmd, shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
36
37 def get_available_instance(self):
38 """使用轮询策略获取一个可用的实例"""

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected