Q4234 commited on
Commit
5dd95bc
1 Parent(s): eb52c26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -9,19 +9,23 @@ class Z(object):
9
  def init(self):
10
  pass
11
 
12
- def greet(self, txt0, paramTemp):
13
  prompt0 = txt0
14
 
15
  # for Wizard-Vicuna-13B
16
  prompt00 = f'''USER: {prompt0}
17
  ASSISTANT:'''
18
 
 
19
  prompt00 = f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
20
 
21
  ### Instruction:
22
  {prompt0}
23
 
24
  ### Response:'''
 
 
 
25
 
26
  response0 = llm(prompt00, max_new_tokens=198, temperature=paramTemp) # 0.5, 0.3
27
 
@@ -29,22 +33,34 @@ ASSISTANT:'''
29
 
30
  from ctransformers import AutoModelForCausalLM
31
 
 
 
 
 
 
 
 
32
  # wizzard vicuna
33
  # see https://github.com/melodysdreamj/WizardVicunaLM
34
  llm = AutoModelForCausalLM.from_pretrained('TheBloke/Wizard-Vicuna-13B-Uncensored-GGML', model_file='Wizard-Vicuna-13B-Uncensored.ggmlv3.q4_0.bin', model_type='llama')
35
 
36
- #llm = AutoModelForCausalLM.from_pretrained('mverrilli/dolly-v2-12b-ggml', model_file='ggml-model-q5_0.bin', model_type='dolly-v2')
37
 
38
- #llm = AutoModelForCausalLM.from_pretrained('mverrilli/dolly-v2-7b-ggml', model_file='ggml-model-q5_0.bin', model_type='dolly-v2')
 
 
 
 
 
 
39
 
40
 
41
  z = Z()
42
  z.llm = llm
43
  z.init()
44
 
45
- def greet(prompt, temperature):
46
  global z
47
- return z.greet(prompt, temperature)
48
 
49
- iface = gr.Interface(fn=greet, inputs=["text", gr.Slider(0.0, 1.0, value=0.41)], outputs="text")
50
  iface.launch()
 
9
  def init(self):
10
  pass
11
 
12
+ def run0(self, txt0, paramTemp):
13
  prompt0 = txt0
14
 
15
  # for Wizard-Vicuna-13B
16
  prompt00 = f'''USER: {prompt0}
17
  ASSISTANT:'''
18
 
19
+ # for TheBloke/Wizard-Vicuna-13B-Uncensored-GGML
20
  prompt00 = f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
21
 
22
  ### Instruction:
23
  {prompt0}
24
 
25
  ### Response:'''
26
+
27
+ # raw
28
+ prompt00 = prompt0
29
 
30
  response0 = llm(prompt00, max_new_tokens=198, temperature=paramTemp) # 0.5, 0.3
31
 
 
33
 
34
  from ctransformers import AutoModelForCausalLM
35
 
36
+ # experiment
37
+ #llm = AutoModelForCausalLM.from_pretrained('mverrilli/dolly-v2-12b-ggml', model_file='ggml-model-q5_0.bin', model_type='dolly-v2')
38
+
39
+ # experiment
40
+ #llm = AutoModelForCausalLM.from_pretrained('mverrilli/dolly-v2-7b-ggml', model_file='ggml-model-q5_0.bin', model_type='dolly-v2')
41
+
42
+
43
  # wizzard vicuna
44
  # see https://github.com/melodysdreamj/WizardVicunaLM
45
  llm = AutoModelForCausalLM.from_pretrained('TheBloke/Wizard-Vicuna-13B-Uncensored-GGML', model_file='Wizard-Vicuna-13B-Uncensored.ggmlv3.q4_0.bin', model_type='llama')
46
 
 
47
 
48
+ modelInfo = {'path2':'TheBloke/hippogriff-30b-chat-GGML:hippogriff-30b.ggmlv3.q4_1.bin', 'promptType':'raw', 'modelType':'llama'}
49
+
50
+ print('[D] load LMt...')
51
+
52
+ self.lm0 = AutoModelForCausalLM.from_pretrained(modelInfo['path2'].split(':')[0], model_file=modelInfo['path2'].split(':')[1], model_type=modelInfo['modelType'])
53
+
54
+ print('[D] ...done')
55
 
56
 
57
  z = Z()
58
  z.llm = llm
59
  z.init()
60
 
61
+ def run0(prompt, temperature):
62
  global z
63
+ return z.run0(prompt, temperature)
64
 
65
+ iface = gr.Interface(fn=run0, inputs=["text", gr.Slider(0.0, 1.0, value=0.41)], outputs="text")
66
  iface.launch()