zurd46 commited on
Commit
8bf32ee
·
verified ·
1 Parent(s): 7b9d97a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -32,8 +32,13 @@ torch_dtype = torch.bfloat16 # Set the appropriate torch data type
32
 
33
  # Display device and CPU thread information
34
  device = get_device()
35
- print("Running on device:", device)
36
- print("CPU threads:", torch.get_num_threads())
 
 
 
 
 
37
 
38
  # Load tokenizer
39
  tokenizer = AutoTokenizer.from_pretrained(model_name)
 
32
 
33
  # Display device and CPU thread information
34
  device = get_device()
35
+ print(f"Number of GPUs available: {torch.cuda.device_count()}")
36
+ print(f"Running on device: {device}")
37
+ print(f"CPU threads: {torch.get_num_threads()}")
38
+
39
+ # Check if CUDA is available and set the device accordingly
40
+ if not torch.cuda.is_available():
41
+ raise RuntimeError("CUDA is not available. Ensure that a GPU is available and properly configured.")
42
 
43
  # Load tokenizer
44
  tokenizer = AutoTokenizer.from_pretrained(model_name)