zeyadusf commited on
Commit
ac83cb7
1 Parent(s): 574f9e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -5,6 +5,7 @@ from peft import PeftModel, PeftConfig
5
  config = PeftConfig.from_pretrained("zeyadusf/FlanT5Summarization-samsum")
6
  base_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-large")
7
  model = PeftModel.from_pretrained(base_model, "zeyadusf/FlanT5Summarization-samsum")
 
8
  def summarize(text):
9
  inputs = tokenizer(text, return_tensors="pt", truncation=True)
10
  summary_ids = model.generate(inputs.input_ids, max_length=512, min_length=64, length_penalty=2.0, num_beams=4, early_stopping=True)
 
5
  config = PeftConfig.from_pretrained("zeyadusf/FlanT5Summarization-samsum")
6
  base_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-large")
7
  model = PeftModel.from_pretrained(base_model, "zeyadusf/FlanT5Summarization-samsum")
8
+ tokenizer = AutoTokenizer.from_pretrained("zeyadusf/FlanT5Summarization-samsum")
9
  def summarize(text):
10
  inputs = tokenizer(text, return_tensors="pt", truncation=True)
11
  summary_ids = model.generate(inputs.input_ids, max_length=512, min_length=64, length_penalty=2.0, num_beams=4, early_stopping=True)