orionweller commited on
Commit
e629710
·
verified ·
1 Parent(s): 70aaa0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -14,8 +14,17 @@ def analyze_model_parameters(model_path, hf_token=None, show_layer_details=False
14
  # Load model configuration first
15
  config = AutoConfig.from_pretrained(model_path, trust_remote_code=True, **token_kwargs)
16
 
17
- # Load model on CPU
18
- model = AutoModel.from_pretrained(model_path, device_map="cpu", trust_remote_code=True, **token_kwargs)
 
 
 
 
 
 
 
 
 
19
 
20
  # Initialize counters
21
  total_params = 0
 
14
  # Load model configuration first
15
  config = AutoConfig.from_pretrained(model_path, trust_remote_code=True, **token_kwargs)
16
 
17
+ # Load model on CPU - FIXED: Use low_cpu_mem_usage=False to avoid meta tensors
18
+ model = AutoModel.from_pretrained(
19
+ model_path,
20
+ torch_dtype=torch.float32, # Explicitly set dtype
21
+ low_cpu_mem_usage=False, # Disable meta tensors
22
+ trust_remote_code=True,
23
+ **token_kwargs
24
+ )
25
+
26
+ # Ensure model is on CPU
27
+ model = model.cpu()
28
 
29
  # Initialize counters
30
  total_params = 0