Update space
Browse files- app.py +7 -7
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
3 |
import torch
|
4 |
|
5 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
6 |
|
7 |
model_path = "Hack337/WavGPT-1.0" # Replace with the actual model path
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
)
|
13 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
14 |
|
15 |
|
16 |
def respond(
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
|
3 |
+
from peft import PeftModel
|
4 |
import torch
|
5 |
|
6 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
7 |
|
8 |
model_path = "Hack337/WavGPT-1.0" # Replace with the actual model path
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-1.5B-Instruct")
|
10 |
+
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-1.5B-Instruct",
|
11 |
+
torch_dtype="auto", device_map="auto")
|
12 |
+
|
13 |
+
model = PeftModel.from_pretrained(model, model_path)
|
|
|
14 |
|
15 |
|
16 |
def respond(
|
requirements.txt
CHANGED
@@ -3,4 +3,5 @@ minijinja
|
|
3 |
torch
|
4 |
transformers
|
5 |
gradio
|
6 |
-
accelerate
|
|
|
|
3 |
torch
|
4 |
transformers
|
5 |
gradio
|
6 |
+
accelerate
|
7 |
+
peft
|