Open ahuang11 opened 9 months ago
Equivalent in funcchain
from pydantic import BaseModel
from huggingface_hub import hf_hub_download
from funcchain.model.patches.llamacpp import ChatLlamaCpp
from funcchain import settings, chain
pn.extension()
class Translations(BaseModel):
chinese: str
french: str
spanish: str
def create_translations(text: str) -> Translations:
"""
Translate the given text into three languages.
"""
return chain()
model_path = hf_hub_download(
"TheBloke/OpenHermes-2.5-Mistral-7B-GGUF",
"openhermes-2.5-mistral-7b.Q4_K_M.gguf",
)
llama = ChatLlamaCpp(
model_path=model_path,
n_gpu_layers=-1,
model_kwargs=dict(chat_format="chatml"),
n_ctx=2048,
verbose=False,
)
json_pane = pn.pane.JSON()
create_translations("Teach me how to say `Hello` in three languages!")
Would we be able to deploy the local model to Hugging Face?
It would be nice to have live versions of the apps. And not just source code.
Potentially? not sure whether huggingface cpus/memory are strong enough to load local llama models. I think when panel 1.4.0 is released, I want to rework a lot of these examples to reflect best practices.