StevenChen16 commited on
Commit
a442892
·
verified ·
1 Parent(s): 39ab905

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -9,6 +9,12 @@ from threading import Thread
9
  HF_TOKEN = os.environ.get("HF_TOKEN", None)
10
 
11
 
 
 
 
 
 
 
12
  DESCRIPTION = '''
13
  <div>
14
  <h1 style="text-align: center;">AI Lawyer</h1>
@@ -43,8 +49,8 @@ h1 {
43
  """
44
 
45
  # Load the tokenizer and model
46
- tokenizer = AutoTokenizer.from_pretrained("StevenChen16/llama3-8b-Lawyer")
47
- model = AutoModelForCausalLM.from_pretrained("StevenChen16/llama3-8b-Lawyer", device_map="auto") # to("cuda:0")
48
  terminators = [
49
  tokenizer.eos_token_id,
50
  tokenizer.convert_tokens_to_ids("<|eot_id|>")
@@ -86,7 +92,6 @@ As an AI legal assistant, you are a highly trained expert in U.S. and Canadian l
86
  Please remember that your role is to provide general legal information and analysis, but also to actively guide and interact with the user during the conversation in a personalized and professional manner. If you feel that necessary information is missing to provide targeted analysis and advice, take the initiative to ask until you believe you have sufficient details. However, also be mindful to avoid over-inquiring or disregarding the user's needs and concerns. Now, please guide me step by step to describe the legal issues I am facing, according to the above requirements.
87
  '''
88
 
89
-
90
  @spaces.GPU(duration=120)
91
  def chat_llama3_8b(message: str,
92
  history: list,
 
9
  HF_TOKEN = os.environ.get("HF_TOKEN", None)
10
 
11
 
12
+
13
+ MODEL_NAME_OR_PATH = 'mattshumer/Llama-3-8B-16K'
14
+
15
+
16
+
17
+
18
  DESCRIPTION = '''
19
  <div>
20
  <h1 style="text-align: center;">AI Lawyer</h1>
 
49
  """
50
 
51
  # Load the tokenizer and model
52
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME_OR_PATH)
53
+ model = AutoModelForCausalLM.from_pretrained(MODEL_NAME_OR_PATH, device_map="auto") # to("cuda:0")
54
  terminators = [
55
  tokenizer.eos_token_id,
56
  tokenizer.convert_tokens_to_ids("<|eot_id|>")
 
92
  Please remember that your role is to provide general legal information and analysis, but also to actively guide and interact with the user during the conversation in a personalized and professional manner. If you feel that necessary information is missing to provide targeted analysis and advice, take the initiative to ask until you believe you have sufficient details. However, also be mindful to avoid over-inquiring or disregarding the user's needs and concerns. Now, please guide me step by step to describe the legal issues I am facing, according to the above requirements.
93
  '''
94
 
 
95
  @spaces.GPU(duration=120)
96
  def chat_llama3_8b(message: str,
97
  history: list,