ldhldh commited on
Commit
3e48437
โ€ข
1 Parent(s): 8fefd32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -35,9 +35,11 @@ model_name = "daekeun-ml/Llama-2-ko-instruct-13B"
35
 
36
  #daekeun-ml/Llama-2-ko-instruct-13B
37
  #quantumaikr/llama-2-70b-fb16-korean
38
-
39
  tokenizer = AutoTokenizer.from_pretrained(model_name)
40
- model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
 
 
 
41
 
42
 
43
  def check(model_name):
@@ -51,7 +53,7 @@ def check(model_name):
51
 
52
 
53
  def chat(id, npc, prompt):
54
-
55
  # get_coin endpoint
56
  response = requests.post("https://ldhldh-api-for-unity.hf.space/run/predict_6", json={
57
  "data": [
@@ -63,6 +65,8 @@ def chat(id, npc, prompt):
63
  return "no coin"
64
 
65
  # model inference
 
 
66
  if check:
67
  prom = ""
68
  inputs = tokenizer(prom, return_tensors="pt")["input_ids"]
 
35
 
36
  #daekeun-ml/Llama-2-ko-instruct-13B
37
  #quantumaikr/llama-2-70b-fb16-korean
 
38
  tokenizer = AutoTokenizer.from_pretrained(model_name)
39
+
40
+ def init():
41
+ if check:
42
+ model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
43
 
44
 
45
  def check(model_name):
 
53
 
54
 
55
  def chat(id, npc, prompt):
56
+
57
  # get_coin endpoint
58
  response = requests.post("https://ldhldh-api-for-unity.hf.space/run/predict_6", json={
59
  "data": [
 
65
  return "no coin"
66
 
67
  # model inference
68
+
69
+ init()
70
  if check:
71
  prom = ""
72
  inputs = tokenizer(prom, return_tensors="pt")["input_ids"]