Update chatbot.py
Browse files- chatbot.py +10 -0
chatbot.py
CHANGED
|
@@ -18,6 +18,16 @@ def load_model():
|
|
| 18 |
model = AutoModelForCausalLM.from_pretrained(my_model_id, device_map="auto") #,quantization_config=quantization_config
|
| 19 |
|
| 20 |
return tokenizer,model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def demo_miny_memory(model):
|
| 23 |
# llm_data = get_Model(hugging_face_key)
|
|
|
|
| 18 |
model = AutoModelForCausalLM.from_pretrained(my_model_id, device_map="auto") #,quantization_config=quantization_config
|
| 19 |
|
| 20 |
return tokenizer,model
|
| 21 |
+
|
| 22 |
+
@st.cache_resource
|
| 23 |
+
def load_pipeline():
|
| 24 |
+
pipe = pipeline("text-generation", model="KvrParaskevi/Llama-2-7b-Hotel-Booking-Model",
|
| 25 |
+
max_tokens = 50,top_k = 30, temperature = 0.1,repetition_penalty = 1.03)
|
| 26 |
+
hf = HuggingFacePipeline(pipeline=pipe)
|
| 27 |
+
return hf
|
| 28 |
+
|
| 29 |
+
def generate_from_pipeline(text, pipe):
|
| 30 |
+
return pipe(text)
|
| 31 |
|
| 32 |
def demo_miny_memory(model):
|
| 33 |
# llm_data = get_Model(hugging_face_key)
|