zhengr commited on
Commit
36e5892
·
verified ·
1 Parent(s): c3bad98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -17,25 +17,26 @@ from datetime import date, datetime, timedelta
17
 
18
  access_token = os.environ["TOKEN"]
19
 
20
- # load model
21
- #model = "NousResearch/Llama-2-7b-chat-hf"
22
- model = "NousResearch/Llama-2-7b-chat-hf"
23
- peft_model = "FinGPT/fingpt-forecaster_sz50_llama2-7B_lora"
24
-
25
- tokenizer = AutoTokenizer.from_pretrained(model, token = access_token, trust_remote_code=True)
26
- tokenizer.pad_token = tokenizer.eos_token
27
- tokenizer.padding_side = "right"
28
-
29
- streamer = TextStreamer(tokenizer)
30
-
31
- #model = AutoModelForCausalLM.from_pretrained(model, trust_remote_code=True, token = access_token, device_map="cuda", load_in_8bit=True, offload_folder="offload/")
32
- #model = PeftModel.from_pretrained(model, peft_model, offload_folder="offload/")
33
-
34
- model = AutoModelForCausalLM.from_pretrained(model, trust_remote_code=True, token = access_token, load_in_8bit=True, offload_folder="offload/")
35
- model = PeftModel.from_pretrained(model, peft_model, offload_folder="offload/")
36
-
37
  model = model.eval()
38
 
 
 
 
 
 
39
  # Inference Data
40
  # get company news online
41
 
 
17
 
18
  access_token = os.environ["TOKEN"]
19
 
20
+ base_model = AutoModelForCausalLM.from_pretrained(
21
+ 'NousResearch/Llama-2-7b-chat-hf',
22
+ token=access_token,
23
+ trust_remote_code=True,
24
+ device_map="auto",
25
+ load_in_8bit=True,
26
+ offload_folder="offload/"
27
+ )
28
+ model = PeftModel.from_pretrained(
29
+ base_model,
30
+ 'FinGPT/fingpt-forecaster_dow30_llama2-7b_lora',
31
+ offload_folder="offload/"
32
+ )
 
 
 
 
33
  model = model.eval()
34
 
35
+ tokenizer = AutoTokenizer.from_pretrained(
36
+ 'NousResearch/Llama-2-7b-chat-hf',
37
+ token=access_token
38
+ )
39
+
40
  # Inference Data
41
  # get company news online
42