-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtest_llm_huggingface.py
33 lines (27 loc) · 1.2 KB
/
test_llm_huggingface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# !usr/bin/env python
# -*- coding:utf-8 -*-
'''
Description :
Version : 1.0
Author : MrYXJ
Mail : [email protected]
Github : https://github.com/MrYxJ
Date : 2023-09-03 11:21:30
LastEditTime : 2023-09-09 00:56:46
Copyright (C) 2023 mryxj. All rights reserved.
'''
from calflops import calculate_flops_hf
batch_size = 1
max_seq_length = 128
# model_name = "baichuan-inc/Baichuan-13B-Chat"
# flops, macs, params = calculate_flops_hf(model_name=model_name,
# input_shape=(batch_size, max_seq_length))
# print("%s FLOPs:%s MACs:%s Params:%s \n" %(model_name, flops, macs, params))
model_name = "baichuan-inc/Baichuan2-13B-Chat"
flops, macs, params, print_results = calculate_flops_hf(model_name=model_name,
input_shape=(batch_size, max_seq_length),
forward_mode="forward",
print_results=False,
return_results=True)
print(print_results)
print("%s FLOPs:%s MACs:%s Params:%s \n" %(model_name, flops, macs, params))