boryasbora commited on
Commit
4f6dfb1
·
verified ·
1 Parent(s): eaac83b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -81,11 +81,21 @@ def get_chain(temperature):
81
 
82
  # Replace the local OLMOLLM with the Hugging Face model
83
 
84
- model_name = "gpt2"
85
- pipe = pipeline("text-generation", model=model_name,
86
- max_length=2500, # Allows for 2,093 input tokens + some generated tokens
87
- max_new_tokens=200,
88
- temperature = temperature)
 
 
 
 
 
 
 
 
 
 
89
 
90
 
91
  # Initialize the LangChain HuggingFacePipeline
 
81
 
82
  # Replace the local OLMOLLM with the Hugging Face model
83
 
84
+ model_name = "OLMo-7B-Instruct-Q4_K_M"
85
+
86
+ # Load the tokenizer and model
87
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
88
+ model = AutoModelForCausalLM.from_pretrained(model_name)
89
+
90
+ # Create a text generation pipeline with the model
91
+ pipe = pipeline(
92
+ "text-generation",
93
+ model=model,
94
+ tokenizer=tokenizer,
95
+ max_length=2200, # Adjust based on your input length
96
+ max_new_tokens=100, # Number of tokens to generate
97
+ temperature=temperature # Adjust the creativity of the output
98
+ )
99
 
100
 
101
  # Initialize the LangChain HuggingFacePipeline