Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

MLC import fix

Omar Khattabb8aee110d4d2
diff --git a/dsp/modules/hf_client.py b/dsp/modules/hf_client.py
index 549340b5d..34aa18da7 100644
--- a/dsp/modules/hf_client.py
+++ b/dsp/modules/hf_client.py
@@ -27,9 +27,6 @@ from dsp.modules.cache_utils import CacheMemory, NotebookCacheMemory, cache_turn
# from dsp.modules.adapter import TurboAdapter, DavinciAdapter, LlamaAdapter
-from mlc_chat import ChatModule
-from mlc_chat import ChatConfig
-
class HFClientTGI(HFModel):
def __init__(self, model, port, url="http://future-hgx-1", **kwargs):
super().__init__(model=model, is_client=True)
@@ -90,7 +87,6 @@ class HFClientTGI(HFModel):
raise Exception("Received invalid JSON response from server")
-
@CacheMemory.cache
def send_hftgi_request_v00(arg, **kwargs):
return requests.post(arg, **kwargs)
@@ -98,6 +94,10 @@ def send_hftgi_request_v00(arg, **kwargs):
class ChatModuleClient(HFModel):
def __init__(self, model, model_path):
super().__init__(model=model, is_client=True)
+
+ from mlc_chat import ChatModule
+ from mlc_chat import ChatConfig
+
self.cm = ChatModule(model=model, lib_path=model_path, chat_config=ChatConfig(conv_template="LM"))
def _generate(self, prompt, **kwargs):