Woziii commited on
Commit
9255c5c
·
verified ·
1 Parent(s): f81f42c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -45,20 +45,20 @@ def load_model(model_name, progress=gr.Progress()):
45
  model = AutoModelForCausalLM.from_pretrained(
46
  model_name,
47
  torch_dtype=torch.float16,
48
- device_map="cuda:0",
49
  load_in_8bit=True
50
  )
51
  elif "llama" in model_name.lower() or "mistral" in model_name.lower():
52
  model = AutoModelForCausalLM.from_pretrained(
53
  model_name,
54
  torch_dtype=torch.float16,
55
- device_map="cuda:0"
56
  )
57
  else:
58
  model = AutoModelForCausalLM.from_pretrained(
59
  model_name,
60
  torch_dtype=torch.float16,
61
- device_map="cuda:0"
62
  )
63
 
64
  if tokenizer.pad_token is None:
 
45
  model = AutoModelForCausalLM.from_pretrained(
46
  model_name,
47
  torch_dtype=torch.float16,
48
+ device_map="auto",
49
  load_in_8bit=True
50
  )
51
  elif "llama" in model_name.lower() or "mistral" in model_name.lower():
52
  model = AutoModelForCausalLM.from_pretrained(
53
  model_name,
54
  torch_dtype=torch.float16,
55
+ device_map="cpu"
56
  )
57
  else:
58
  model = AutoModelForCausalLM.from_pretrained(
59
  model_name,
60
  torch_dtype=torch.float16,
61
+ device_map="cpu"
62
  )
63
 
64
  if tokenizer.pad_token is None: