Skip to content

Commit 67a3c38

Browse files
committed
fix connection bug
1 parent 2eaa709 commit 67a3c38

File tree

7 files changed

+29
-36
lines changed

7 files changed

+29
-36
lines changed

lightllm/models/qwen_vl/layer_infer/pre_layer_infer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def context_forward(self, input_ids, infer_state: LlamaInferStateInfo, layer_wei
5454
continue
5555
# pull the img_embeds by uid from shm or afs
5656
if self.args.enable_remote_vit:
57-
embed = read_afs(get_shm_name_embed(img["uuid"], self.args.image_embed_dir))
57+
embed = read_afs(get_shm_name_embed(img["uuid"]), self.args.image_embed_dir)
5858
else:
5959
embed = read_shm(get_shm_name_embed(img["uuid"]))
6060
img_weight.append(bytes2tensor(embed).cuda().reshape(img["token_num"], -1))

lightllm/server/api_start.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ def config_server_start(args):
495495

496496
logger.info(f"all start args:{args}")
497497

498+
if args.start_redis:
499+
start_redis_service(args)
500+
498501
set_env_start_args(args)
499502

500503
command = [

lightllm/server/embed_cache/impl/memory_cache_with_redis.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
class MemoryCacheWithRedis(InMemoryCache):
1818
def __init__(self, args) -> None:
1919
super().__init__(args)
20-
redis_url = f"redis://{args.config_server_host}:{args.redis_port}"
20+
redis_url = f"redis://{args.config_server_host}:{args.redis_port}/0"
21+
print(redis_url, flush=True)
2122
self.redis_cache = EmbedRefCountRedis(
2223
redis_url=redis_url,
2324
capacity=args.cache_capacity,
@@ -28,6 +29,7 @@ def __init__(self, args) -> None:
2829
# 便于 dynamic prompt cache 的使用。所以要把cache_capacity * 2,保障其保留的图片cache > redis 服务维护的
2930
# 硬盘里的图片image embed 数量。
3031
self.cache_capacity = args.cache_capacity * 2
32+
print(self.redis_cache.stats(), flush=True)
3133

3234
def release(self, ids: list[int]) -> None:
3335
with self.lock:
@@ -44,7 +46,7 @@ def get_items_data(self, ids: list[int]) -> list[Optional[bool]]:
4446

4547
def set_items_embed(self, ids: list[int]) -> None:
4648
for id in ids:
47-
self.redis_cache.insert(id)
49+
self.redis_cache.insert(str(id))
4850

4951
def get_items_embed(self, ids: list[int]) -> list[Optional[bool]]:
50-
return [self.redis_cache.query_and_incre(id) for id in ids]
52+
return [self.redis_cache.query_and_incre(str(id)) for id in ids]

lightllm/server/embed_cache/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(
113113
evict_fraction: float = 0.2,
114114
key_prefix: str = "md5:",
115115
image_embed_dir: str = None,
116-
path_ext: str = ".embed",
116+
path_ext: str = "-embed",
117117
**redis_kwargs,
118118
) -> None:
119119
"""

lightllm/server/httpserver/manager.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async def _alloc_resource(self, items, md5sums, token_nums, datas):
134134
uid_list.append(rec["id"])
135135

136136
# # If enable the vit/audio-llm disaggregation, no need to cache the data in the memory of the server
137-
if self.enable_remote_vit:
137+
if self.args.enable_remote_vit:
138138
return
139139

140140
ready_flags = obtain(self.cache_client.root.get_items_data(uid_list))
@@ -263,35 +263,6 @@ def alloc_req_id(self, sampling_params, is_health_req: bool = False):
263263
assert False, "dead code path"
264264
return group_request_id
265265

266-
async def _log_req_header_for_visual_only(self, request_headers, group_request_id: int, image_count: int):
267-
268-
x_request_id = request_headers.get("X-Request-Id", "")
269-
x_session_id = request_headers.get("X-Session-Id", "")
270-
271-
format_in_time = datetime.datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d %H:%M:%S")
272-
logger.info(
273-
f"recieved req X-Request-Id:{x_request_id} "
274-
f"X-Session-Id:{x_session_id} start_time:{format_in_time} "
275-
f"lightllm_req_id:{group_request_id} "
276-
f"image_count:{image_count}"
277-
)
278-
return
279-
280-
async def _initialize_multimodal_metadata(
281-
self, multimodal_params: MultimodalParams, sampling_params: SamplingParams
282-
):
283-
for img in multimodal_params.images:
284-
self.tokenizer.init_imageitem_extral_params(img, multimodal_params, sampling_params)
285-
data = img.read()
286-
# must after init_imageitem_extral_params
287-
token_num = self.tokenizer.get_image_token_length(img)
288-
md5sum = "{}_{}".format(
289-
hashlib.md5(data).hexdigest(),
290-
hashlib.md5(pickle.dumps(img.extra_params, protocol=4)).hexdigest(),
291-
)
292-
img.uuid = int(md5sum, 16)
293-
img.token_num = token_num
294-
295266
async def generate(
296267
self,
297268
prompt: Union[str, List[int]],

lightllm/server/visualserver/-

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
529205:C 28 Aug 2025 13:07:04.500 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2+
529205:C 28 Aug 2025 13:07:04.501 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=529205, just started
3+
529205:C 28 Aug 2025 13:07:04.503 # Configuration loaded
4+
529205:M 28 Aug 2025 13:07:04.505 * Running mode=standalone, port=6379.
5+
529205:M 28 Aug 2025 13:07:04.506 # Server initialized
6+
529205:M 28 Aug 2025 13:07:04.507 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7+
529205:M 28 Aug 2025 13:07:04.509 * Ready to accept connections
8+
529205:signal-handler (1756386794) Received SIGINT scheduling shutdown...
9+
529205:M 28 Aug 2025 13:13:14.912 # User requested shutdown...
10+
529205:M 28 Aug 2025 13:13:14.914 # Redis is now ready to exit, bye bye...
11+
533706:C 28 Aug 2025 13:13:21.718 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
12+
533706:C 28 Aug 2025 13:13:21.719 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=533706, just started
13+
533706:C 28 Aug 2025 13:13:21.720 # Configuration loaded
14+
533706:M 28 Aug 2025 13:13:21.723 * Running mode=standalone, port=6379.
15+
533706:M 28 Aug 2025 13:13:21.724 # Server initialized
16+
533706:M 28 Aug 2025 13:13:21.724 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
17+
533706:M 28 Aug 2025 13:13:21.727 * Ready to accept connections

lightllm/server/visualserver/model_infer/model_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def exposed_encode(self, images: List[ImageItem]):
121121
uid = uuids[i]
122122
start, end = valid_ids[i]
123123
cur_embed_bytes = tensor2bytes(all_img_embeds[start:end])
124-
if self.args.enable_remote_vit:
124+
if self.args.run_mode == "visual":
125125
create_afs(get_shm_name_embed(uid), cur_embed_bytes, self.args.image_embed_dir)
126126
else:
127127
create_shm(get_shm_name_embed(uid), cur_embed_bytes)

0 commit comments

Comments
 (0)