Spaces:
Sleeping

mimi800 commited on
Commit
7ebbb60
·
verified ·
1 Parent(s): 6161016

Upload model.py

Browse files
Files changed (1) hide show
  1. model.py +2 -2
model.py CHANGED
@@ -14,11 +14,11 @@ MODEL_NAME = "bigcode/starcoderbase-1b"
14
  HF_TOKEN = os.getenv("HF_TOKEN")
15
 
16
  # Initialize text generation pipeline
17
- # Use 'dtype="auto"' to avoid deprecation warning
18
  generator = pipeline(
19
  "text-generation",
20
  model=MODEL_NAME,
21
- dtype="auto", # Modern way to set model dtype
22
  device_map="auto", # Automatically choose device (CPU if no GPU)
23
  token=HF_TOKEN # Pass token for gated models
24
  )
 
14
  HF_TOKEN = os.getenv("HF_TOKEN")
15
 
16
  # Initialize text generation pipeline
17
+ # We'll use FP16 for better performance on CPU (if supported)
18
  generator = pipeline(
19
  "text-generation",
20
  model=MODEL_NAME,
21
+ torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
22
  device_map="auto", # Automatically choose device (CPU if no GPU)
23
  token=HF_TOKEN # Pass token for gated models
24
  )