smartdigitalnetworks commited on
Commit
e077787
·
verified ·
1 Parent(s): 2d30a36

Update appnvlm.py

Browse files
Files changed (1) hide show
  1. appnvlm.py +2 -0
appnvlm.py CHANGED
@@ -13,6 +13,8 @@ def split_model():
13
  # Since the first GPU will be used for ViT, treat it as half a GPU.
14
  num_layers_per_gpu = math.ceil(num_layers / (world_size - 0.5))
15
  num_layers_per_gpu = [num_layers_per_gpu] * world_size
 
 
16
  num_layers_per_gpu[0] = math.ceil(num_layers_per_gpu[0] * 0.5)
17
  layer_cnt = 0
18
  for i, num_layer in enumerate(num_layers_per_gpu):
 
13
  # Since the first GPU will be used for ViT, treat it as half a GPU.
14
  num_layers_per_gpu = math.ceil(num_layers / (world_size - 0.5))
15
  num_layers_per_gpu = [num_layers_per_gpu] * world_size
16
+ if not num_layers_per_gpu:
17
+ raise RuntimeError("No GPUs detected. NVML failed to initialize.")
18
  num_layers_per_gpu[0] = math.ceil(num_layers_per_gpu[0] * 0.5)
19
  layer_cnt = 0
20
  for i, num_layer in enumerate(num_layers_per_gpu):