tackhwa commited on
Commit
7b0dab2
·
1 Parent(s): f5452a1

pre-commit

Browse files
Files changed (1) hide show
  1. examples/lightrag_lmdeploy_demo.py +4 -3
examples/lightrag_lmdeploy_demo.py CHANGED
@@ -10,10 +10,11 @@ WORKING_DIR = "./dickens"
10
  if not os.path.exists(WORKING_DIR):
11
  os.mkdir(WORKING_DIR)
12
 
 
13
  async def lmdeploy_model_complete(
14
  prompt=None, system_prompt=None, history_messages=[], **kwargs
15
  ) -> str:
16
- model_name = kwargs["hashing_kv"].global_config["llm_model_name"]
17
  return await lmdeploy_model_if_cache(
18
  model_name,
19
  prompt,
@@ -23,7 +24,7 @@ async def lmdeploy_model_complete(
23
  ## or model_name is a pytorch model on huggingface.co,
24
  ## you can refer to https://github.com/InternLM/lmdeploy/blob/main/lmdeploy/model.py
25
  ## for a list of chat_template available in lmdeploy.
26
- chat_template = "llama3",
27
  # model_format ='awq', # if you are using awq quantization model.
28
  # quant_policy=8, # if you want to use online kv cache, 4=kv int4, 8=kv int8.
29
  **kwargs,
@@ -33,7 +34,7 @@ async def lmdeploy_model_complete(
33
  rag = LightRAG(
34
  working_dir=WORKING_DIR,
35
  llm_model_func=lmdeploy_model_complete,
36
- llm_model_name="meta-llama/Llama-3.1-8B-Instruct", # please use definite path for local model
37
  embedding_func=EmbeddingFunc(
38
  embedding_dim=384,
39
  max_token_size=5000,
 
10
  if not os.path.exists(WORKING_DIR):
11
  os.mkdir(WORKING_DIR)
12
 
13
+
14
  async def lmdeploy_model_complete(
15
  prompt=None, system_prompt=None, history_messages=[], **kwargs
16
  ) -> str:
17
+ model_name = kwargs["hashing_kv"].global_config["llm_model_name"]
18
  return await lmdeploy_model_if_cache(
19
  model_name,
20
  prompt,
 
24
  ## or model_name is a pytorch model on huggingface.co,
25
  ## you can refer to https://github.com/InternLM/lmdeploy/blob/main/lmdeploy/model.py
26
  ## for a list of chat_template available in lmdeploy.
27
+ chat_template="llama3",
28
  # model_format ='awq', # if you are using awq quantization model.
29
  # quant_policy=8, # if you want to use online kv cache, 4=kv int4, 8=kv int8.
30
  **kwargs,
 
34
  rag = LightRAG(
35
  working_dir=WORKING_DIR,
36
  llm_model_func=lmdeploy_model_complete,
37
+ llm_model_name="meta-llama/Llama-3.1-8B-Instruct", # please use definite path for local model
38
  embedding_func=EmbeddingFunc(
39
  embedding_dim=384,
40
  max_token_size=5000,