Spaces:
Runtime error
Runtime error
LinkangZhan
commited on
Commit
•
d04c3ba
1
Parent(s):
a6636f6
remove device_map
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ import gradio as gr
|
|
6 |
import torch
|
7 |
|
8 |
config = PeftConfig.from_pretrained("Junity/Genshin-World-Model", trust_remote_code=True)
|
9 |
-
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Base", torch_dtype=torch.float32,
|
10 |
-
model = PeftModel.from_pretrained(model, r"Junity/Genshin-World-Model", torch_dtype=torch.float32,
|
11 |
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Base", trust_remote_code=True)
|
12 |
history = []
|
13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
@@ -29,10 +29,12 @@ def respond(role_name, msg, textbox):
|
|
29 |
gen_kwargs = {}
|
30 |
gen_kwargs.update(dict(
|
31 |
input_ids=input_ids,
|
32 |
-
temperature=1.
|
33 |
-
top_p=0.
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
))
|
37 |
outputs = []
|
38 |
print(input_ids)
|
|
|
6 |
import torch
|
7 |
|
8 |
config = PeftConfig.from_pretrained("Junity/Genshin-World-Model", trust_remote_code=True)
|
9 |
+
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Base", torch_dtype=torch.float32, trust_remote_code=True)
|
10 |
+
model = PeftModel.from_pretrained(model, r"Junity/Genshin-World-Model", torch_dtype=torch.float32, trust_remote_code=True)
|
11 |
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Base", trust_remote_code=True)
|
12 |
history = []
|
13 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
29 |
gen_kwargs = {}
|
30 |
gen_kwargs.update(dict(
|
31 |
input_ids=input_ids,
|
32 |
+
temperature=1.5,
|
33 |
+
top_p=0.7,
|
34 |
+
top_k=50,
|
35 |
+
repetition_penalty=1.0,
|
36 |
+
max_new_tokens=256,
|
37 |
+
do_sample=True,
|
38 |
))
|
39 |
outputs = []
|
40 |
print(input_ids)
|