LinkangZhan commited on
Commit
d04c3ba
1 Parent(s): a6636f6

remove device_map

Browse files
Files changed (1) hide show
  1. app.py +8 -6
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, device_map="auto", trust_remote_code=True)
10
- model = PeftModel.from_pretrained(model, r"Junity/Genshin-World-Model", torch_dtype=torch.float32, device_map="auto", 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,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.0,
33
- top_p=0.75,
34
- repetition_penalty=1.2,
35
- max_new_tokens=256
 
 
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)