ssom commited on
Commit
9d26fea
·
1 Parent(s): 3bc062e

Delete main

Browse files
Files changed (1) hide show
  1. main +0 -21
main DELETED
@@ -1,21 +0,0 @@
1
- import torch
2
- from peft import PeftModel, PeftConfig
3
- from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
4
-
5
- peft_model_id = "ybelkada/flan-t5-large-financial-phrasebank-lora"
6
- config = PeftConfig.from_pretrained(peft_model_id)
7
-
8
- model = AutoModelForSeq2SeqLM.from_pretrained(config.base_model_name_or_path, torch_dtype="auto", device_map="auto")
9
- tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
10
-
11
- # Load the Lora model
12
- model = PeftModel.from_pretrained(model, peft_model_id)
13
-
14
- model.eval()
15
- input_text = "In January-September 2009 , the Group 's net interest income increased to EUR 112.4 mn from EUR 74.3 mn in January-September 2008 ."
16
- inputs = tokenizer(input_text, return_tensors="pt")
17
-
18
- outputs = model.generate(input_ids=inputs["input_ids"], max_new_tokens=10)
19
-
20
- print("input sentence: ", input_text)
21
- print(" output prediction: ", tokenizer.batch_decode(outputs.detach().cpu().numpy(), skip_special_tokens=True))