Update elm/utils.py
Browse files- elm/utils.py +0 -6
elm/utils.py
CHANGED
@@ -1,21 +1,15 @@
|
|
1 |
# Copyright (c) 2024, SliceX AI, Inc. All Rights Reserved.
|
2 |
|
3 |
-
from prettytable import PrettyTable
|
4 |
-
|
5 |
def count_parameters(model):
|
6 |
"""Count the number of parameters in the model."""
|
7 |
-
table = PrettyTable(["Modules", "Parameters"])
|
8 |
total_params = 0
|
9 |
|
10 |
for name, parameter in model.named_parameters():
|
11 |
if not parameter.requires_grad: continue
|
12 |
params = parameter.numel()
|
13 |
-
table.add_row([name, params])
|
14 |
total_params+=params
|
15 |
|
16 |
-
print(table)
|
17 |
print(f"Total Trainable Params: {total_params}")
|
18 |
-
|
19 |
return total_params
|
20 |
|
21 |
|
|
|
1 |
# Copyright (c) 2024, SliceX AI, Inc. All Rights Reserved.
|
2 |
|
|
|
|
|
3 |
def count_parameters(model):
|
4 |
"""Count the number of parameters in the model."""
|
|
|
5 |
total_params = 0
|
6 |
|
7 |
for name, parameter in model.named_parameters():
|
8 |
if not parameter.requires_grad: continue
|
9 |
params = parameter.numel()
|
|
|
10 |
total_params+=params
|
11 |
|
|
|
12 |
print(f"Total Trainable Params: {total_params}")
|
|
|
13 |
return total_params
|
14 |
|
15 |
|