Q4234
commited on
Commit
•
bff1360
0
Parent(s):
Duplicate from Q4234/a1
Browse files- .gitattributes +34 -0
- README.md +13 -0
- app.py +50 -0
- requirements.txt +1 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: A1
|
3 |
+
emoji: 🏆
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: yellow
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.32.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
duplicated_from: Q4234/a1
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
import ctransformers
|
4 |
+
|
5 |
+
class Z(object):
|
6 |
+
def __init__(self):
|
7 |
+
self.llm = None
|
8 |
+
|
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 |
+
|
28 |
+
return f'{response0}'
|
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()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ctransformers
|