Created
September 24, 2024 03:10
-
-
Save ag-chirag/8383a302d03abd4e546df0b4911b0520 to your computer and use it in GitHub Desktop.
Loading Data Gemma from HuggingFace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DataGemma: | |
def __init__(self, model_id: str = "bartowski/datagemma-rag-27b-it-GGUF", model_file: str = "datagemma-rag-27b-it-Q2_K.gguf"): | |
self.generation_kwargs = { | |
"max_tokens": 4096, # Max number of new tokens to generate | |
} | |
self.model_path = hf_hub_download(model_id, model_file) | |
self.llm = Llama( | |
self.model_path | |
) | |
self.name = "DataGemma" | |
def complete(self, question: str) -> str: | |
llm_resp = self.llm(question, **self.generation_kwargs) | |
return llm_resp["choices"][0]["text"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment