llm-benchmark 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 aidatatools (Jason Chuang)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.1
2
+ Name: llm_benchmark
3
+ Version: 0.3.1
4
+ Summary: LLM Benchmark for Throughputs via Ollama
5
+ Home-page: https://github.com/aidatatools/ollama-benchmark/
6
+ License: MIT
7
+ Keywords: benchmark,llama,ollama,llms,local
8
+ Author: Jason Chuang
9
+ Author-email: chuangtcee@gmail.com
10
+ Requires-Python: >=3.8,<4.0
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Dist: gputil (>=1.4.0,<2.0.0)
19
+ Requires-Dist: lib-platform (>=1.2.10,<2.0.0)
20
+ Requires-Dist: ollama (>=0.1.8,<0.2.0)
21
+ Requires-Dist: psutil (>=5.9.8,<6.0.0)
22
+ Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
23
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
24
+ Requires-Dist: typer[all] (>=0.9.0,<0.10.0)
25
+ Description-Content-Type: text/markdown
26
+
27
+ # ollama-benchmark
28
+
29
+ LLM Benchmark for Throughput via Ollama (Local LLMs)
30
+
31
+ ## Installation Steps
32
+
33
+ ```bash
34
+ pip3 install ollama-benchmark
35
+ ```
36
+
37
+ It's tested on Python 3.9 and above.
38
+
39
+ ## ollama installation with the following models installed
40
+
41
+ 7B model can be run on machines with 8GB of RAM
42
+
43
+ 13B model can be run on machines with 16GB of RAM
44
+
45
+ ## Usage explaination
46
+
47
+ On Windows, Linux, and macOS, it will detect memory RAM size to first download required LLM models.
48
+
49
+ When memory RAM size is greater than or equal to 4GB, but less than 7GB, it will check if gemma:2b exist. The program implicitly pull the model.
50
+
51
+ ```bash
52
+ ollama pull gemma:2b
53
+ ```
54
+
55
+ When memory RAM size is greater than 7GB, but less than 15GB, it will check if these models exist. The program implicitly pull these models
56
+
57
+ ```bash
58
+ ollama pull gemma:2b
59
+ ollama pull gemma:7b
60
+ ollama pull mistral:7b
61
+ ollama pull llama2:7b
62
+ ollama pull llava:7b
63
+ ```
64
+
65
+ When memory RAM siz is greater than 15GB, it will check if these models exist. The program implicitly pull these models
66
+
67
+ ```bash
68
+ ollama pull gemma:2b
69
+ ollama pull gemma:7b
70
+ ollama pull mistral:7b
71
+ ollama pull llama2:7b
72
+ ollama pull llama2:13b
73
+ ollama pull llava:7b
74
+ ollama pull llava:13b
75
+ ```
76
+
77
+ ## Usage for general users directly
78
+
79
+ ```bash
80
+ pip install llm-benchmark
81
+ llm_benchmark hello jason
82
+ llm_benchmark run
83
+ ```
84
+
85
+ ## Python Poetry manually(advanced) installation
86
+
87
+ <https://python-poetry.org/docs/#installing-manually>
88
+
89
+ ## For developers to develop new features on Windows Powershell or on Ubuntu Linux or macOS
90
+
91
+ ```bash
92
+ python3 -m venv .venv
93
+ . ./.venv/bin/activate
94
+ pip install -U pip setuptools
95
+ pip install poetry
96
+ ```
97
+
98
+ ## Usage in Python virtual environment
99
+
100
+ ```bash
101
+ poetry shell
102
+ poetry install
103
+ llm_benchmark hello jason
104
+ ```
105
+
106
+ ### The default sending back the info is
107
+
108
+ Memory Size: 32GB
109
+
110
+ CPU: Intel i5-12400
111
+
112
+ GPU: 3060
113
+
114
+ OS: Microsoft Windows 11
115
+
116
+ ### Example #1 send systeminfo and bechmark results to a remote server
117
+
118
+ ```bash
119
+ llm_benchmark run
120
+ ```
121
+
122
+ ### Example #2 Do not send systeminfo and bechmark results to a remote server
123
+
124
+ ```bash
125
+ llm_benchmark run --no-sendinfo
126
+ ```
127
+
128
+ ## Reference
129
+
130
+ [Ollama](https://ollama.com)
131
+
@@ -0,0 +1,104 @@
1
+ # ollama-benchmark
2
+
3
+ LLM Benchmark for Throughput via Ollama (Local LLMs)
4
+
5
+ ## Installation Steps
6
+
7
+ ```bash
8
+ pip3 install ollama-benchmark
9
+ ```
10
+
11
+ It's tested on Python 3.9 and above.
12
+
13
+ ## ollama installation with the following models installed
14
+
15
+ 7B model can be run on machines with 8GB of RAM
16
+
17
+ 13B model can be run on machines with 16GB of RAM
18
+
19
+ ## Usage explaination
20
+
21
+ On Windows, Linux, and macOS, it will detect memory RAM size to first download required LLM models.
22
+
23
+ When memory RAM size is greater than or equal to 4GB, but less than 7GB, it will check if gemma:2b exist. The program implicitly pull the model.
24
+
25
+ ```bash
26
+ ollama pull gemma:2b
27
+ ```
28
+
29
+ When memory RAM size is greater than 7GB, but less than 15GB, it will check if these models exist. The program implicitly pull these models
30
+
31
+ ```bash
32
+ ollama pull gemma:2b
33
+ ollama pull gemma:7b
34
+ ollama pull mistral:7b
35
+ ollama pull llama2:7b
36
+ ollama pull llava:7b
37
+ ```
38
+
39
+ When memory RAM siz is greater than 15GB, it will check if these models exist. The program implicitly pull these models
40
+
41
+ ```bash
42
+ ollama pull gemma:2b
43
+ ollama pull gemma:7b
44
+ ollama pull mistral:7b
45
+ ollama pull llama2:7b
46
+ ollama pull llama2:13b
47
+ ollama pull llava:7b
48
+ ollama pull llava:13b
49
+ ```
50
+
51
+ ## Usage for general users directly
52
+
53
+ ```bash
54
+ pip install llm-benchmark
55
+ llm_benchmark hello jason
56
+ llm_benchmark run
57
+ ```
58
+
59
+ ## Python Poetry manually(advanced) installation
60
+
61
+ <https://python-poetry.org/docs/#installing-manually>
62
+
63
+ ## For developers to develop new features on Windows Powershell or on Ubuntu Linux or macOS
64
+
65
+ ```bash
66
+ python3 -m venv .venv
67
+ . ./.venv/bin/activate
68
+ pip install -U pip setuptools
69
+ pip install poetry
70
+ ```
71
+
72
+ ## Usage in Python virtual environment
73
+
74
+ ```bash
75
+ poetry shell
76
+ poetry install
77
+ llm_benchmark hello jason
78
+ ```
79
+
80
+ ### The default sending back the info is
81
+
82
+ Memory Size: 32GB
83
+
84
+ CPU: Intel i5-12400
85
+
86
+ GPU: 3060
87
+
88
+ OS: Microsoft Windows 11
89
+
90
+ ### Example #1 send systeminfo and bechmark results to a remote server
91
+
92
+ ```bash
93
+ llm_benchmark run
94
+ ```
95
+
96
+ ### Example #2 Do not send systeminfo and bechmark results to a remote server
97
+
98
+ ```bash
99
+ llm_benchmark run --no-sendinfo
100
+ ```
101
+
102
+ ## Reference
103
+
104
+ [Ollama](https://ollama.com)
File without changes
@@ -0,0 +1,51 @@
1
+ import argparse
2
+ import yaml
3
+ import subprocess
4
+ import ollama
5
+
6
+ parser = argparse.ArgumentParser(
7
+ prog="python3 check_models.py",
8
+ description="Before running check_models.py, please make sure you installed ollama successfully \
9
+ on macOS, Linux, or WSL2 on Windows. You can check the website: https://ollama.ai",
10
+ epilog="Author: Jason Chuang")
11
+
12
+ parser.add_argument("-v",
13
+ "--verbose",
14
+ action="store_true",
15
+ help="this program helps you check whether you have ollama benchmark models installed")
16
+
17
+ parser.add_argument("-m",
18
+ "--models",
19
+ type=str,
20
+ help="provide benchmark models YAML file path. ex. ../data/benchmark_models.yml")
21
+
22
+ def parse_yaml(yaml_file_path):
23
+ with open(yaml_file_path, 'r') as stream:
24
+ try:
25
+ data=yaml.safe_load(stream)
26
+ #print(d)
27
+ except yaml.YAMLError as e:
28
+ print(e)
29
+ return data
30
+
31
+ def pull_models(models_file_path):
32
+ print(f"LLM models file path:{models_file_path}")
33
+ print(f"Checking and pulling the following LLM models")
34
+ models_dict = parse_yaml(models_file_path)
35
+ for x in models_dict['models']:
36
+ model_name = x['model']
37
+ print(model_name)
38
+ ollama.pull(model_name)
39
+
40
+ if __name__ == "__main__":
41
+ args = parser.parse_args()
42
+ #print(f"args.verbose value:{args.verbose}")
43
+ if (args.models is not None):
44
+ print(f"args.models file path:{args.models}")
45
+ models_dict = parse_yaml(args.models)
46
+ for x in models_dict['models']:
47
+ model_name = x['model']
48
+ print(model_name)
49
+ result = subprocess.run(['ollama', 'pull', model_name], stdout=subprocess.PIPE)
50
+ result.stdout
51
+
@@ -0,0 +1,16 @@
1
+ import subprocess
2
+
3
+ def run_command(command):
4
+ try:
5
+ result = subprocess.run(command, capture_output=True, text=True, check=True)
6
+ return result.stdout.strip() # Return the output of the command
7
+ except subprocess.CalledProcessError as e:
8
+ print(f"Error executing command '{command}': {e}")
9
+ return None
10
+
11
+ def check_ollama_version():
12
+ res = run_command(['ollama', '--version'])
13
+ print(res)
14
+
15
+ if __name__ == "__main__":
16
+ check_ollama_version()
@@ -0,0 +1,85 @@
1
+ import typer, base64
2
+ from llm_benchmark import check_models
3
+ from llm_benchmark import check_ollama
4
+ from llm_benchmark import run_benchmark
5
+
6
+ from systeminfo import sysmain
7
+
8
+ from security_connection import connection
9
+ app = typer.Typer()
10
+
11
+
12
+ @app.command()
13
+ def hello(name: str):
14
+ print(f"Hello {name}!")
15
+
16
+
17
+ @app.command()
18
+ def run(sendinfo: bool = True):
19
+ sys_info = sysmain.get_extra()
20
+ print(f"Total memory size : {sys_info['memory']:.2f} GB")
21
+ print(f"cpu_info: {sys_info['cpu']}")
22
+ print(f"gpu_info: {sys_info['gpu']}")
23
+ print(f"os_version: {sys_info['os_version']}")
24
+
25
+ check_ollama.check_ollama_version()
26
+ print('-'*10)
27
+
28
+ ft_mem_size = float(f"{sys_info['memory']:.2f}")
29
+ models_file_path = 'data/benchmark_models_16gb_ram.yml'
30
+ if(ft_mem_size>=4 and ft_mem_size <7):
31
+ models_file_path = 'data/benchmark_models_4gb_ram.yml'
32
+ elif(ft_mem_size>=7 and ft_mem_size <15):
33
+ models_file_path = 'data/benchmark_models_8gb_ram.yml'
34
+
35
+ check_models.pull_models(models_file_path)
36
+ print('-'*10)
37
+
38
+ benchmark_file_path = 'data/benchmark1.yml'
39
+
40
+ bench_results_info = {}
41
+ result1 = run_benchmark.run_benchmark(models_file_path,benchmark_file_path, 'instruct')
42
+ bench_results_info.update(result1)
43
+ result2 = run_benchmark.run_benchmark(models_file_path,benchmark_file_path, 'question-answer')
44
+ bench_results_info.update(result2)
45
+ result3 = run_benchmark.run_benchmark(models_file_path,benchmark_file_path, 'vision-image')
46
+ bench_results_info.update(result3)
47
+
48
+ if (sendinfo==True):
49
+ print(f"Sending the following data to a remote server")
50
+ print(f"Your machine UUID : {sysmain.get_uuid()}")
51
+ print(f"{bench_results_info.items()}")
52
+ print('=='*10)
53
+ #print(f"{sys_info.items()}")
54
+ #sys_info = sysmain.get_extra()
55
+ x = connection.send_sysinfo(sys_info)
56
+ print(x)
57
+
58
+
59
+ @app.command()
60
+ def goodbye(name: str, formal: bool = False):
61
+ if formal:
62
+ print(f"Goodbye Mr.(Ms.) {name}. Have a good day.")
63
+ else:
64
+ print(f"Bye {name}!")
65
+
66
+ @app.command()
67
+ def sysinfo(formal: bool = True):
68
+ if formal:
69
+ sys_info = sysmain.get_extra()
70
+ sys_info['uuid'] = f"{sysmain.get_uuid()}"
71
+ #print(sys_info.items())
72
+ print(f"memory : {sys_info['memory']:.2f} GB")
73
+ print(f"cpu_info: {sys_info['cpu']}")
74
+ print(f"gpu_info: {sys_info['gpu']}")
75
+ print(f"os_version: {sys_info['os_version']}")
76
+ print(f"Your machine UUID : {sys_info['uuid']}")
77
+
78
+ x = connection.send_sysinfo(sys_info)
79
+ print(x)
80
+ else:
81
+ print(f"No print!")
82
+
83
+
84
+ if __name__ == "__main__":
85
+ app()
@@ -0,0 +1,50 @@
1
+ import requests
2
+
3
+ headers = {
4
+ 'Content-Type': 'application/json',
5
+ }
6
+ #"model" : "phi"
7
+ #"model" : "llama2"
8
+ #"model" : "mistral"
9
+
10
+ data = '{\n "model": "llama2:7b",\n "prompt": "Why is the sky blue? Is it related to sunshine?",\n "stream": false\n}'
11
+
12
+ response = requests.post('http://localhost:11434/api/generate', headers=headers, data=data)
13
+ jsonResponse = response.json()
14
+
15
+ model = ""
16
+ total_duration = 0.0
17
+ load_duration = 0.0
18
+ prompt_eval_count = 0
19
+ prompt_eval_duration = 0.0
20
+ eval_count = 0
21
+ eval_duration = 0.0
22
+ for key, value in jsonResponse.items():
23
+ if (key=="response"):
24
+ pass
25
+ elif (key=="context"):
26
+ pass
27
+ elif (key=="model"):
28
+ model = value
29
+ elif (key=="total_duration"):
30
+ total_duration = float(value)/(10**6)
31
+ elif (key=="load_duration"):
32
+ load_duration = float(value)/(10**6)
33
+ elif (key=="prompt_eval_count"):
34
+ prompt_eval_count=int(value)
35
+ elif (key=="prompt_eval_duration"):
36
+ prompt_eval_duration=float(value)/(10**6)
37
+ elif (key=="eval_count"):
38
+ eval_count=int(value)
39
+ elif (key=="eval_duration"):
40
+ eval_duration=float(value)/(10**6)
41
+
42
+ print(f"model = {model}")
43
+
44
+ print(f"{'total_duration time': >20} = {total_duration:10.2f} ms")
45
+ print(f"{'load_duration time': >20} = {load_duration:10.2f} ms")
46
+
47
+ print(f"{'prompt eval time ': >20} = {prompt_eval_duration:10.2f} ms / {prompt_eval_count:>6} tokens")
48
+ print(f"{'eval time ': >20} = {eval_duration:10.2f} ms / {eval_count:>6} tokens ")
49
+ print(f"Performance: {eval_count/eval_duration*1000:10.2f}(tokens/s)")
50
+
@@ -0,0 +1,117 @@
1
+ import argparse
2
+ import yaml
3
+ import subprocess
4
+ import datetime
5
+
6
+ parser = argparse.ArgumentParser(
7
+ prog="python3 check_models.py",
8
+ description="Before running check_models.py, please make sure you installed ollama successfully \
9
+ on macOS, Linux, or WSL2 on Windows. You can check the website: https://ollama.com",
10
+ epilog="Author: Jason Chuang")
11
+
12
+ parser.add_argument("-v",
13
+ "--verbose",
14
+ action="store_true",
15
+ help="this program helps you check whether you have ollama benchmark models installed")
16
+
17
+ parser.add_argument("-m",
18
+ "--models",
19
+ type=str,
20
+ help="provide benchmark models YAML file path. ex. ../data/benchmark_models.yml")
21
+
22
+ parser.add_argument("-b",
23
+ "--benchmark",
24
+ type=str,
25
+ help="provide benchmark YAML file path. ex. ../data/benchmark1.yml")
26
+
27
+ parser.add_argument("-t",
28
+ "--type",
29
+ type=str,
30
+ help="provide benchmark model type. ex, instruct")
31
+
32
+
33
+ def parse_yaml(yaml_file_path):
34
+ with open(yaml_file_path, 'r') as stream:
35
+ try:
36
+ data=yaml.safe_load(stream)
37
+ #print(d)
38
+ except yaml.YAMLError as e:
39
+ print(e)
40
+ return data
41
+
42
+ def run_benchmark(models_file_path, benchmark_file_path, type):
43
+
44
+ models_dict = parse_yaml(models_file_path)
45
+ benchmark_dict = parse_yaml(benchmark_file_path)
46
+ model_type = type
47
+ allowed_models = {e['model'] for e in models_dict['models']}
48
+ #print(allowed_models)
49
+ ans={}
50
+ # Writing to file
51
+ for one_model_type in benchmark_dict['modeltypes']:
52
+ #print(one_model_type)
53
+ if (one_model_type['type']==model_type):
54
+ #print(one_model_type['models'])
55
+ #print(one_model_type['prompts'])
56
+ for onemodel in one_model_type['models']:
57
+ if (onemodel['model'] in allowed_models ):
58
+ loc_dt = datetime.datetime.today()
59
+ with open(f'log_{loc_dt.strftime("%Y-%m-%d-%H%M%S")}.log', "w", encoding='utf-8') as file1:
60
+ #print(onemodel)
61
+ stored_nums=[]
62
+ model_name = onemodel['model']
63
+ print(f'model_name = {model_name}')
64
+ file1.write(f'\nmodel_name = {model_name}\n')
65
+
66
+ if model_name.startswith('llava'):
67
+ for one_prompt in one_model_type['prompts']:
68
+ img_file_names = one_prompt['keywords'].split(',')
69
+ for img in img_file_names:
70
+ prompt = f"{one_prompt['prompt']} 'data/img/{img}' "
71
+ print(f"prompt = {prompt}")
72
+ result = subprocess.run(['ollama', 'run', model_name, one_prompt['prompt'],'--verbose'], capture_output=True, text=True, check=True, encoding='utf-8')
73
+ std_err = result.stderr
74
+ #print(result.stderr)
75
+ file1.write(std_err)
76
+
77
+ for line in std_err.split('\n'):
78
+ if ('eval rate' in line) and ('prompt' not in line):
79
+ print(line)
80
+ number = float(line[-20:-8])
81
+ stored_nums.append(number)
82
+ #print(number)
83
+ else:
84
+ for one_prompt in one_model_type['prompts']:
85
+ print(f"prompt = {one_prompt['prompt']}")
86
+ result = subprocess.run(['ollama', 'run', model_name, one_prompt['prompt'],'--verbose'], capture_output=True, text=True, check=True, encoding='utf-8')
87
+ std_err = result.stderr
88
+ #print(result.stderr)
89
+ file1.write(std_err)
90
+
91
+ for line in std_err.split('\n'):
92
+ if ('eval rate' in line) and ('prompt' not in line):
93
+ print(line)
94
+ number = float(line[-20:-8])
95
+ stored_nums.append(number)
96
+ #print(number)
97
+
98
+ print("-"*20)
99
+ if(len(stored_nums)!=0):
100
+ average = sum(stored_nums)/len(stored_nums)
101
+ print("Average of eval rate: ", round(average,3), " tokens/s")
102
+ ans[f"{model_name}"]=f"{round(average,3):.2f}"
103
+
104
+ print("-"*40)
105
+ file1.write("\n"+"-"*40)
106
+ file1.close()
107
+
108
+ return ans
109
+
110
+ if __name__ == "__main__":
111
+ args = parser.parse_args()
112
+ #print(f"args.verbose value:{args.verbose}")
113
+ if (args.models is not None) and (args.benchmark is not None) and (args.type is not None):
114
+ run_benchmark(args.models, args.benchmark, args.type)
115
+ print('-'*40)
116
+
117
+
@@ -0,0 +1,59 @@
1
+ import argparse
2
+ import yaml
3
+ import subprocess
4
+ import datetime
5
+
6
+ parser = argparse.ArgumentParser(
7
+ prog="python3 check_models.py",
8
+ description="Before running check_models.py, please make sure you installed ollama successfully \
9
+ on macOS, Linux, or WSL2 on Windows. You can check the website: https://ollama.ai",
10
+ epilog="Author: Jason Chuang")
11
+
12
+ parser.add_argument("-v",
13
+ "--verbose",
14
+ action="store_true",
15
+ help="this program helps you check whether you have ollama benchmark models installed")
16
+
17
+ parser.add_argument("-m",
18
+ "--models",
19
+ type=str,
20
+ help="provide benchmark models YAML file path. ex. ../data/benchmark_models.yml")
21
+
22
+ def parse_yaml(yaml_file_path):
23
+ with open(yaml_file_path, 'r') as stream:
24
+ try:
25
+ data=yaml.safe_load(stream)
26
+ #print(d)
27
+ except yaml.YAMLError as e:
28
+ print(e)
29
+ return data
30
+
31
+ if __name__ == "__main__":
32
+ args = parser.parse_args()
33
+ #print(f"args.verbose value:{args.verbose}")
34
+ if (args.models is not None):
35
+ #print(f"args.models file path:{args.models}")
36
+ models_dict = parse_yaml(args.models)
37
+
38
+ loc_dt = datetime.datetime.today()
39
+ # Writing to file
40
+ with open(f'log_{loc_dt.strftime("%Y-%m-%d-%H%M%S")}.log', "w") as file1:
41
+ for onemodel in models_dict['models']:
42
+ model_name = onemodel['model']
43
+ print(f'model_name = {model_name}')
44
+ file1.write(f'\nmodel_name = {model_name}\n')
45
+
46
+ result = subprocess.run(['ollama', 'run', model_name,f'"Why is the sky blue?"','--verbose'], capture_output=True, text=True, check=True)
47
+ std_err = result.stderr
48
+ #print(result.stderr)
49
+ file1.write(std_err)
50
+
51
+ for line in std_err.split('\n'):
52
+ if ('eval rate' in line) and ('prompt' not in line):
53
+ print(line)
54
+ number = float(line[-20:-8])
55
+ print(number)
56
+
57
+
58
+ print("-"*40)
59
+ file1.write("\n"+"-"*40)
@@ -0,0 +1,35 @@
1
+ [tool.poetry]
2
+ name = "llm_benchmark"
3
+ version = "0.3.1"
4
+ description = "LLM Benchmark for Throughputs via Ollama"
5
+ authors = ["Jason Chuang <chuangtcee@gmail.com>"]
6
+ license = "MIT"
7
+ homepage = "https://github.com/aidatatools/ollama-benchmark/"
8
+ readme = "README.md"
9
+ keywords = [
10
+ "benchmark",
11
+ "llama",
12
+ "ollama",
13
+ "llms",
14
+ "local",
15
+ ]
16
+
17
+ [tool.poetry.dependencies]
18
+ python = "^3.8"
19
+ typer = {extras = ["all"], version = "^0.9.0"}
20
+ ollama = "^0.1.8"
21
+ pyyaml = "^6.0.1"
22
+ requests = "^2.31.0"
23
+ psutil = "^5.9.8"
24
+ gputil = "^1.4.0"
25
+ lib-platform = "^1.2.10"
26
+
27
+ [tool.poetry.group.dev.dependencies]
28
+ pytest = "^8.1.1"
29
+
30
+ [tool.poetry.scripts]
31
+ llm_benchmark = "llm_benchmark.main:app"
32
+
33
+ [build-system]
34
+ requires = ["poetry-core"]
35
+ build-backend = "poetry.core.masonry.api"