-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathexamples.txt
More file actions
98 lines (97 loc) · 3.03 KB
/
examples.txt
File metadata and controls
98 lines (97 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#huggingface
rag = PathRAG(
working_dir=WORKING_DIR,
llm_model_func=hf_model_complete,
llm_model_name="Qwen/Qwen3-0.6B",
embedding_func=EmbeddingFunc(
embedding_dim=384,
max_token_size=5000,
func=lambda texts: hf_embedding(
texts,
tokenizer=AutoTokenizer.from_pretrained(
"sentence-transformers/all-MiniLM-L6-v2"
),
embed_model=AutoModel.from_pretrained(
"sentence-transformers/all-MiniLM-L6-v2"
),
),
),
)
#local
rag = PathRAG(
working_dir=WORKING_DIR,
llm_model_func=local_model_complete,
llm_model_name="./modelscope/Qwen3-0.6B",
embedding_func=EmbeddingFunc(
embedding_dim=384,
max_token_size=5000,
func=lambda texts: local_embedding(
texts,
tokenizer=AutoTokenizer.from_pretrained("./modelscope/all-MiniLM-L6-v2"),
embed_model=AutoModel.from_pretrained("./modelscope/all-MiniLM-L6-v2"),
),
),
)
#modelscope
tokenizer = ms.AutoTokenizer.from_pretrained(
"iic/nlp_corom_sentence-embedding_english-base",
trust_remote_code=True
)
model = ms.AutoModel.from_pretrained(
"iic/nlp_corom_sentence-embedding_english-base",
trust_remote_code=True
).to("cuda" if torch.cuda.is_available() else "cpu").eval()
rag = PathRAG(
working_dir=WORKING_DIR,
llm_model_func=ms_model_complete,
llm_model_name="Qwen/Qwen3-0.6B",
embedding_func=EmbeddingFunc(
embedding_dim=768, # corom 模型输出维度
max_token_size=5000,
func=lambda texts: ms_embedding(
texts,
tokenizer,
model,
),
),
)
#vllm
rag = PathRAG(
working_dir=WORKING_DIR,
llm_model_func=vllm_model_complete,
llm_model_name="./modelscope/Qwen3-0.6B",
embedding_func=EmbeddingFunc(
embedding_dim=384,
max_token_size=5000,
func=lambda texts: vllm_embedding(
texts,
tokenizer=AutoTokenizer.from_pretrained(
"./modelscope/all-MiniLM-L6-v2"
),
embed_model=AutoModel.from_pretrained(
"./modelscope/all-MiniLM-L6-v2"
),
),
),
)
#ollama
rag = PathRAG(
working_dir=WORKING_DIR,
llm_model_func=ollama_model_complete,
llm_model_name=os.getenv("LLM_MODEL", "qwen3:0.6b"),
llm_model_max_token_size=8192,
llm_model_kwargs={
"host": os.getenv("LLM_BINDING_HOST", "http://localhost:11434"),
"options": {"num_ctx": 8192},
"timeout": int(os.getenv("TIMEOUT", "300")),
},
embedding_func=EmbeddingFunc(
embedding_dim=int(os.getenv("EMBEDDING_DIM", "1024")),
max_token_size=int(os.getenv("MAX_EMBED_TOKENS", "8192")),
func=lambda texts: ollama_embedding(
texts,
embed_model=os.getenv("EMBEDDING_MODEL", "bge-large"),
host=os.getenv("EMBEDDING_BINDING_HOST", "http://localhost:11434"),
),
),
)