lucas-w commited on
Commit
a2023d1
β€’
1 Parent(s): 99832bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -17,7 +17,7 @@ demo.launch()
17
  #!pip install accelerate
18
  #!pip install -i
19
 
20
- """
21
 
22
  import gradio as gr
23
  import torch
@@ -29,17 +29,17 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
29
  peft_model_id = "charansr/llama2-7b-chat-hf-therapist"
30
 
31
  config = PeftConfig.from_pretrained(peft_model_id,
32
- use_auth_token="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", load_in_8bit=True, device_map='auto',)
33
 
34
- newmodel = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto',
35
  use_auth_token="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")
36
 
37
  newtokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path,
38
- use_auth_token="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", load_in_8bit=True, device_map='auto',)
39
 
40
  # Load the Lora model
41
  newmodel = PeftModel.from_pretrained(newmodel, peft_model_id,
42
- use_auth_token="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", load_in_8bit=True, device_map='auto')
43
 
44
  def givetext(input_text,lmodel,ltokenizer):
45
  eval_prompt_pt1 = "\nBelow is an instruction that describes a task. Write a response that appropriately completes the request.\n### Instruction: Act like a therapist and respond\n\n### Input: "
@@ -62,7 +62,6 @@ demo.launch()
62
 
63
  """
64
 
65
-
66
  import gradio as gr
67
  import torch
68
  from peft import PeftModel, PeftConfig
@@ -93,3 +92,5 @@ def mental_chat(message, history):
93
  demo = gr.ChatInterface(mental_chat)
94
 
95
  demo.launch()
 
 
 
17
  #!pip install accelerate
18
  #!pip install -i
19
 
20
+
21
 
22
  import gradio as gr
23
  import torch
 
29
  peft_model_id = "charansr/llama2-7b-chat-hf-therapist"
30
 
31
  config = PeftConfig.from_pretrained(peft_model_id,
32
+ use_auth_token="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", load_in_8bit=True, device_map='cpu',)
33
 
34
+ newmodel = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='cpu',
35
  use_auth_token="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")
36
 
37
  newtokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path,
38
+ use_auth_token="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", load_in_8bit=True, device_map='cpu',)
39
 
40
  # Load the Lora model
41
  newmodel = PeftModel.from_pretrained(newmodel, peft_model_id,
42
+ use_auth_token="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", load_in_8bit=True, device_map='cpu')
43
 
44
  def givetext(input_text,lmodel,ltokenizer):
45
  eval_prompt_pt1 = "\nBelow is an instruction that describes a task. Write a response that appropriately completes the request.\n### Instruction: Act like a therapist and respond\n\n### Input: "
 
62
 
63
  """
64
 
 
65
  import gradio as gr
66
  import torch
67
  from peft import PeftModel, PeftConfig
 
92
  demo = gr.ChatInterface(mental_chat)
93
 
94
  demo.launch()
95
+
96
+ """