mrpoons-studio commited on
Commit
27a0eb7
·
verified ·
1 Parent(s): 9297198

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -21,9 +21,14 @@ if not torch.cuda.is_available():
21
 
22
  if torch.cuda.is_available():
23
  model_id = "deepseek-ai/deepseek-r1"
24
- model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
25
- tokenizer = AutoTokenizer.from_pretrained(model_id)
26
- tokenizer.use_default_system_prompt = False
 
 
 
 
 
27
 
28
  @spaces.GPU
29
  def generate(message: str,
 
21
 
22
  if torch.cuda.is_available():
23
  model_id = "deepseek-ai/deepseek-r1"
24
+ if torch.cuda.is_available():
25
+ model = AutoModelForCausalLM.from_pretrained(
26
+ model_id, torch_dtype=torch.bfloat16, device_map="auto"
27
+ )
28
+ else:
29
+ model = AutoModelForCausalLM.from_pretrained(model_id)
30
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
31
+ tokenizer.use_default_system_prompt = False
32
 
33
  @spaces.GPU
34
  def generate(message: str,