Spaces:
Runtime error
Runtime error
Update demo/agent.py
Browse files- demo/agent.py +0 -12
demo/agent.py
CHANGED
@@ -12,21 +12,9 @@ class ConversationalAgent:
|
|
12 |
def __init__(self,
|
13 |
model_path,
|
14 |
outputs_dir) -> None:
|
15 |
-
|
16 |
-
# 自动检测设备
|
17 |
-
# self.device = device or torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
18 |
-
# print(f"Using device: {self.device}")
|
19 |
-
|
20 |
self.pipe = pipeline(model_path,
|
21 |
chat_template_config=ChatTemplateConfig(model_name='internvl2-internlm2'),
|
22 |
backend_config=TurbomindEngineConfig(session_len=8192))
|
23 |
-
# 初始化 pipeline,并显式指定设备
|
24 |
-
# self.pipe = pipeline(
|
25 |
-
# model_path,
|
26 |
-
# chat_template_config=ChatTemplateConfig(model_name='internvl2-internlm2'),
|
27 |
-
# backend_config=TurbomindEngineConfig(session_len=8192, device=self.device) # 在 Turbomind 中添加设备
|
28 |
-
# )
|
29 |
-
|
30 |
self.uploaded_images_storage = os.path.join(outputs_dir, "uploaded")
|
31 |
self.uploaded_images_storage = os.path.abspath(self.uploaded_images_storage)
|
32 |
os.makedirs(self.uploaded_images_storage, exist_ok=True)
|
|
|
12 |
def __init__(self,
|
13 |
model_path,
|
14 |
outputs_dir) -> None:
|
|
|
|
|
|
|
|
|
|
|
15 |
self.pipe = pipeline(model_path,
|
16 |
chat_template_config=ChatTemplateConfig(model_name='internvl2-internlm2'),
|
17 |
backend_config=TurbomindEngineConfig(session_len=8192))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
self.uploaded_images_storage = os.path.join(outputs_dir, "uploaded")
|
19 |
self.uploaded_images_storage = os.path.abspath(self.uploaded_images_storage)
|
20 |
os.makedirs(self.uploaded_images_storage, exist_ok=True)
|