llmflux 0.1.0__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.
- llmflux-0.1.0/LICENSE +21 -0
- llmflux-0.1.0/PKG-INFO +223 -0
- llmflux-0.1.0/README.md +193 -0
- llmflux-0.1.0/pyproject.toml +55 -0
- llmflux-0.1.0/setup.cfg +4 -0
- llmflux-0.1.0/src/aiflux/__init__.py +20 -0
- llmflux-0.1.0/src/aiflux/benchmark_utils.py +233 -0
- llmflux-0.1.0/src/aiflux/cli.py +371 -0
- llmflux-0.1.0/src/aiflux/container/container.def +74 -0
- llmflux-0.1.0/src/aiflux/converters/__init__.py +43 -0
- llmflux-0.1.0/src/aiflux/converters/csv.py +196 -0
- llmflux-0.1.0/src/aiflux/converters/directory.py +202 -0
- llmflux-0.1.0/src/aiflux/converters/json.py +349 -0
- llmflux-0.1.0/src/aiflux/converters/utils.py +171 -0
- llmflux-0.1.0/src/aiflux/converters/vision.py +197 -0
- llmflux-0.1.0/src/aiflux/core/__init__.py +16 -0
- llmflux-0.1.0/src/aiflux/core/client.py +248 -0
- llmflux-0.1.0/src/aiflux/core/config.py +496 -0
- llmflux-0.1.0/src/aiflux/core/config_manager.py +159 -0
- llmflux-0.1.0/src/aiflux/core/processor.py +55 -0
- llmflux-0.1.0/src/aiflux/io/__init__.py +14 -0
- llmflux-0.1.0/src/aiflux/io/base.py +97 -0
- llmflux-0.1.0/src/aiflux/io/input/__init__.py +14 -0
- llmflux-0.1.0/src/aiflux/io/output/__init__.py +7 -0
- llmflux-0.1.0/src/aiflux/io/output/json_output.py +39 -0
- llmflux-0.1.0/src/aiflux/processors/__init__.py +5 -0
- llmflux-0.1.0/src/aiflux/processors/batch.py +345 -0
- llmflux-0.1.0/src/aiflux/slurm/__init__.py +5 -0
- llmflux-0.1.0/src/aiflux/slurm/runner.py +484 -0
- llmflux-0.1.0/src/llmflux.egg-info/PKG-INFO +223 -0
- llmflux-0.1.0/src/llmflux.egg-info/SOURCES.txt +33 -0
- llmflux-0.1.0/src/llmflux.egg-info/dependency_links.txt +1 -0
- llmflux-0.1.0/src/llmflux.egg-info/entry_points.txt +2 -0
- llmflux-0.1.0/src/llmflux.egg-info/requires.txt +6 -0
- llmflux-0.1.0/src/llmflux.egg-info/top_level.txt +1 -0
llmflux-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rohan Marwaha
|
|
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.
|
llmflux-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: llmflux
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tool for running LLM batch processing jobs on HPC systems with Ollama and vLLM
|
|
5
|
+
Author-email: Rohan Marwaha <rohan13@illinois.edu>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Center-for-AI-Innovation/ai-flux
|
|
8
|
+
Project-URL: Repository, https://github.com/Center-for-AI-Innovation/ai-flux
|
|
9
|
+
Project-URL: Issues, https://github.com/Center-for-AI-Innovation/ai-flux/issues
|
|
10
|
+
Keywords: llm,batch-processing,slurm,hpc,ai,machine-learning,ollama,vllm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.31.0
|
|
24
|
+
Requires-Dist: pandas>=2.1.0
|
|
25
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
26
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
27
|
+
Requires-Dist: pydantic>=2.6.0
|
|
28
|
+
Requires-Dist: datasets>=3.0.0
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# AI-Flux: LLM Batch Processing Pipeline for HPC Systems
|
|
32
|
+
|
|
33
|
+
A streamlined solution for running Large Language Models (LLMs) in batch mode on HPC systems powered by Slurm. AI-Flux uses the OpenAI-compatible API format with a JSONL-first architecture for all interactions.
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
JSONL Input Batch Processing Results
|
|
39
|
+
(OpenAI Format) (Ollama + Model) (JSON Output)
|
|
40
|
+
│ │ │
|
|
41
|
+
│ │ │
|
|
42
|
+
▼ ▼ ▼
|
|
43
|
+
┌──────────┐ ┌──────────────┐ ┌──────────┐
|
|
44
|
+
│ Batch │ │ │ │ Output │
|
|
45
|
+
│ Requests │─────────────────▶ │ Model on │─────────────────▶ │ Results │
|
|
46
|
+
│ (JSONL) │ │ GPU(s) │ │ (JSON) │
|
|
47
|
+
└──────────┘ │ │ └──────────┘
|
|
48
|
+
└──────────────┘
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
AI-Flux processes JSONL files in a standardized OpenAI-compatible batch API format, enabling efficient processing of thousands of prompts on HPC systems with minimal overhead.
|
|
52
|
+
|
|
53
|
+
## Documentation
|
|
54
|
+
|
|
55
|
+
- [Configuration Guide](docs/CONFIGURATION.md) - How to configure AI-Flux
|
|
56
|
+
- [Models Guide](docs/MODELS.md) - Supported models and requirements
|
|
57
|
+
- [Repository Structure](docs/REPOSITORY_STRUCTURE.md) - Codebase organization
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
1. **Create and Activate Conda Environment:**
|
|
62
|
+
```bash
|
|
63
|
+
conda create -n aiflux python=3.11 -y
|
|
64
|
+
conda activate aiflux
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. **Install Package:**
|
|
68
|
+
```bash
|
|
69
|
+
pip install -e .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. **Environment Setup:**
|
|
73
|
+
```bash
|
|
74
|
+
cp .env.example .env
|
|
75
|
+
# Edit .env with your SLURM account and model details
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
### Core Batch Processing on SLURM
|
|
81
|
+
|
|
82
|
+
The primary workflow for AI-Flux is submitting JSONL files for batch processing on SLURM:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from aiflux.slurm import SlurmRunner
|
|
86
|
+
from aiflux.core.config import Config
|
|
87
|
+
|
|
88
|
+
# Setup SLURM configuration
|
|
89
|
+
config = Config()
|
|
90
|
+
slurm_config = config.get_slurm_config()
|
|
91
|
+
slurm_config.account = "myaccount"
|
|
92
|
+
|
|
93
|
+
# Initialize runner
|
|
94
|
+
runner = SlurmRunner(config=slurm_config)
|
|
95
|
+
|
|
96
|
+
# Submit JSONL file directly for processing
|
|
97
|
+
job_id = runner.run(
|
|
98
|
+
input_path="prompts.jsonl",
|
|
99
|
+
output_path="results.json",
|
|
100
|
+
model="llama3.2:3b",
|
|
101
|
+
batch_size=4
|
|
102
|
+
)
|
|
103
|
+
print(f"Job submitted with ID: {job_id}")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### JSONL Input Format
|
|
107
|
+
|
|
108
|
+
JSONL input format follows the OpenAI Batch API specification:
|
|
109
|
+
|
|
110
|
+
```jsonl
|
|
111
|
+
{"custom_id":"request1","method":"POST","url":"/v1/chat/completions","body":{"model":"llama3.2:3b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"Explain quantum computing"}],"temperature":0.7,"max_tokens":500}}
|
|
112
|
+
{"custom_id":"request2","method":"POST","url":"/v1/chat/completions","body":{"model":"llama3.2:3b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"What is machine learning?"}],"temperature":0.7,"max_tokens":500}}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
For advanced options like custom batch sizes, processing settings, or SLURM configuration, see the [Configuration Guide](docs/CONFIGURATION.md).
|
|
116
|
+
|
|
117
|
+
For advanced model configuration, see the [Models Guide](docs/MODELS.md).
|
|
118
|
+
|
|
119
|
+
## Command-Line Interface
|
|
120
|
+
|
|
121
|
+
AI-Flux includes a command-line interface for submitting batch processing jobs:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Process JSONL file directly (core functionality)
|
|
125
|
+
aiflux run --model llama3.2:3b --input data/prompts.jsonl --output results/output.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
For detailed command options:
|
|
129
|
+
```bash
|
|
130
|
+
aiflux --help
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Output Format
|
|
134
|
+
|
|
135
|
+
Results are saved in the user's workspace:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
"input": {
|
|
141
|
+
"custom_id": "request1",
|
|
142
|
+
"method": "POST",
|
|
143
|
+
"url": "/v1/chat/completions",
|
|
144
|
+
"body": {
|
|
145
|
+
"model": "llama3.2:3b",
|
|
146
|
+
"messages": [
|
|
147
|
+
{"role": "system", "content": "You are a helpful assistant"},
|
|
148
|
+
{"role": "user", "content": "Original prompt text"}
|
|
149
|
+
],
|
|
150
|
+
"temperature": 0.7,
|
|
151
|
+
"max_tokens": 1024
|
|
152
|
+
},
|
|
153
|
+
"metadata": {
|
|
154
|
+
"source_file": "example.txt"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"output": {
|
|
158
|
+
"id": "chat-cmpl-123",
|
|
159
|
+
"object": "chat.completion",
|
|
160
|
+
"created": 1699123456,
|
|
161
|
+
"model": "llama3.2:3b",
|
|
162
|
+
"choices": [
|
|
163
|
+
{
|
|
164
|
+
"index": 0,
|
|
165
|
+
"message": {
|
|
166
|
+
"role": "assistant",
|
|
167
|
+
"content": "Generated response text"
|
|
168
|
+
},
|
|
169
|
+
"finish_reason": "stop"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"metadata": {
|
|
174
|
+
"model": "llama3.2:3b",
|
|
175
|
+
"timestamp": "2023-11-04T12:34:56.789Z",
|
|
176
|
+
"processing_time": 1.23
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Utility Converters
|
|
183
|
+
|
|
184
|
+
AI-Flux provides utility converters to help prepare JSONL files from various input formats:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Convert CSV to JSONL
|
|
188
|
+
aiflux convert csv --input data/papers.csv --output data/papers.jsonl --template "Summarize: {text}"
|
|
189
|
+
|
|
190
|
+
# Convert directory to JSONL
|
|
191
|
+
aiflux convert dir --input data/documents/ --output data/docs.jsonl --recursive
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
For code examples of converters, see the [examples directory](examples/).
|
|
195
|
+
|
|
196
|
+
## Benchmarking
|
|
197
|
+
|
|
198
|
+
AI-Flux ships with a benchmarking workflow that can source prompts, submit the SLURM job, and collect results/metrics for you.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
aiflux benchmark --model llama3.2:3b --name nightly --num-prompts 60 \
|
|
202
|
+
--account ACCOUNT_NAME --partition PARTITION_NAME --nodes 1
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
- **Prompt sources**: omit `--input` to automatically download and cache LiveBench categories (``benchmark_data/``). Provide `--input path/to/prompts.jsonl` to reuse an existing JSONL file instead. Use `--num-prompts`, `--temperature`, and `--max-tokens` to control synthetic dataset generation.
|
|
206
|
+
- **Outputs**: results default to `results/benchmarks/<name>_results.json` and a metrics summary (`<name>_metrics.txt`) containing elapsed SLURM runtime and number of prompts processed.
|
|
207
|
+
- **Batch tuning**: adjust `--batch-size` for throughput. Pass model arguments such as `--temperature` and `--max-tokens` to forward them to the runner.
|
|
208
|
+
- **SLURM overrides**: forward scheduler settings with `--account`, `--partition`, `--nodes`, `--gpus-per-node`, `--time`, `--mem`, and `--cpus-per-task`.
|
|
209
|
+
- **Job controls**: add `--rebuild` to force an Apptainer image rebuild or `--debug` to keep the generated job script for inspection.
|
|
210
|
+
|
|
211
|
+
For the complete option reference:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
aiflux benchmark --help
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Contributing
|
|
218
|
+
|
|
219
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
[MIT License](LICENSE)
|
llmflux-0.1.0/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# AI-Flux: LLM Batch Processing Pipeline for HPC Systems
|
|
2
|
+
|
|
3
|
+
A streamlined solution for running Large Language Models (LLMs) in batch mode on HPC systems powered by Slurm. AI-Flux uses the OpenAI-compatible API format with a JSONL-first architecture for all interactions.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
JSONL Input Batch Processing Results
|
|
9
|
+
(OpenAI Format) (Ollama + Model) (JSON Output)
|
|
10
|
+
│ │ │
|
|
11
|
+
│ │ │
|
|
12
|
+
▼ ▼ ▼
|
|
13
|
+
┌──────────┐ ┌──────────────┐ ┌──────────┐
|
|
14
|
+
│ Batch │ │ │ │ Output │
|
|
15
|
+
│ Requests │─────────────────▶ │ Model on │─────────────────▶ │ Results │
|
|
16
|
+
│ (JSONL) │ │ GPU(s) │ │ (JSON) │
|
|
17
|
+
└──────────┘ │ │ └──────────┘
|
|
18
|
+
└──────────────┘
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
AI-Flux processes JSONL files in a standardized OpenAI-compatible batch API format, enabling efficient processing of thousands of prompts on HPC systems with minimal overhead.
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
- [Configuration Guide](docs/CONFIGURATION.md) - How to configure AI-Flux
|
|
26
|
+
- [Models Guide](docs/MODELS.md) - Supported models and requirements
|
|
27
|
+
- [Repository Structure](docs/REPOSITORY_STRUCTURE.md) - Codebase organization
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
1. **Create and Activate Conda Environment:**
|
|
32
|
+
```bash
|
|
33
|
+
conda create -n aiflux python=3.11 -y
|
|
34
|
+
conda activate aiflux
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. **Install Package:**
|
|
38
|
+
```bash
|
|
39
|
+
pip install -e .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
3. **Environment Setup:**
|
|
43
|
+
```bash
|
|
44
|
+
cp .env.example .env
|
|
45
|
+
# Edit .env with your SLURM account and model details
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### Core Batch Processing on SLURM
|
|
51
|
+
|
|
52
|
+
The primary workflow for AI-Flux is submitting JSONL files for batch processing on SLURM:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from aiflux.slurm import SlurmRunner
|
|
56
|
+
from aiflux.core.config import Config
|
|
57
|
+
|
|
58
|
+
# Setup SLURM configuration
|
|
59
|
+
config = Config()
|
|
60
|
+
slurm_config = config.get_slurm_config()
|
|
61
|
+
slurm_config.account = "myaccount"
|
|
62
|
+
|
|
63
|
+
# Initialize runner
|
|
64
|
+
runner = SlurmRunner(config=slurm_config)
|
|
65
|
+
|
|
66
|
+
# Submit JSONL file directly for processing
|
|
67
|
+
job_id = runner.run(
|
|
68
|
+
input_path="prompts.jsonl",
|
|
69
|
+
output_path="results.json",
|
|
70
|
+
model="llama3.2:3b",
|
|
71
|
+
batch_size=4
|
|
72
|
+
)
|
|
73
|
+
print(f"Job submitted with ID: {job_id}")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### JSONL Input Format
|
|
77
|
+
|
|
78
|
+
JSONL input format follows the OpenAI Batch API specification:
|
|
79
|
+
|
|
80
|
+
```jsonl
|
|
81
|
+
{"custom_id":"request1","method":"POST","url":"/v1/chat/completions","body":{"model":"llama3.2:3b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"Explain quantum computing"}],"temperature":0.7,"max_tokens":500}}
|
|
82
|
+
{"custom_id":"request2","method":"POST","url":"/v1/chat/completions","body":{"model":"llama3.2:3b","messages":[{"role":"system","content":"You are a helpful assistant"},{"role":"user","content":"What is machine learning?"}],"temperature":0.7,"max_tokens":500}}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For advanced options like custom batch sizes, processing settings, or SLURM configuration, see the [Configuration Guide](docs/CONFIGURATION.md).
|
|
86
|
+
|
|
87
|
+
For advanced model configuration, see the [Models Guide](docs/MODELS.md).
|
|
88
|
+
|
|
89
|
+
## Command-Line Interface
|
|
90
|
+
|
|
91
|
+
AI-Flux includes a command-line interface for submitting batch processing jobs:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Process JSONL file directly (core functionality)
|
|
95
|
+
aiflux run --model llama3.2:3b --input data/prompts.jsonl --output results/output.json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For detailed command options:
|
|
99
|
+
```bash
|
|
100
|
+
aiflux --help
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Output Format
|
|
104
|
+
|
|
105
|
+
Results are saved in the user's workspace:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
[
|
|
109
|
+
{
|
|
110
|
+
"input": {
|
|
111
|
+
"custom_id": "request1",
|
|
112
|
+
"method": "POST",
|
|
113
|
+
"url": "/v1/chat/completions",
|
|
114
|
+
"body": {
|
|
115
|
+
"model": "llama3.2:3b",
|
|
116
|
+
"messages": [
|
|
117
|
+
{"role": "system", "content": "You are a helpful assistant"},
|
|
118
|
+
{"role": "user", "content": "Original prompt text"}
|
|
119
|
+
],
|
|
120
|
+
"temperature": 0.7,
|
|
121
|
+
"max_tokens": 1024
|
|
122
|
+
},
|
|
123
|
+
"metadata": {
|
|
124
|
+
"source_file": "example.txt"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"output": {
|
|
128
|
+
"id": "chat-cmpl-123",
|
|
129
|
+
"object": "chat.completion",
|
|
130
|
+
"created": 1699123456,
|
|
131
|
+
"model": "llama3.2:3b",
|
|
132
|
+
"choices": [
|
|
133
|
+
{
|
|
134
|
+
"index": 0,
|
|
135
|
+
"message": {
|
|
136
|
+
"role": "assistant",
|
|
137
|
+
"content": "Generated response text"
|
|
138
|
+
},
|
|
139
|
+
"finish_reason": "stop"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"metadata": {
|
|
144
|
+
"model": "llama3.2:3b",
|
|
145
|
+
"timestamp": "2023-11-04T12:34:56.789Z",
|
|
146
|
+
"processing_time": 1.23
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Utility Converters
|
|
153
|
+
|
|
154
|
+
AI-Flux provides utility converters to help prepare JSONL files from various input formats:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Convert CSV to JSONL
|
|
158
|
+
aiflux convert csv --input data/papers.csv --output data/papers.jsonl --template "Summarize: {text}"
|
|
159
|
+
|
|
160
|
+
# Convert directory to JSONL
|
|
161
|
+
aiflux convert dir --input data/documents/ --output data/docs.jsonl --recursive
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
For code examples of converters, see the [examples directory](examples/).
|
|
165
|
+
|
|
166
|
+
## Benchmarking
|
|
167
|
+
|
|
168
|
+
AI-Flux ships with a benchmarking workflow that can source prompts, submit the SLURM job, and collect results/metrics for you.
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
aiflux benchmark --model llama3.2:3b --name nightly --num-prompts 60 \
|
|
172
|
+
--account ACCOUNT_NAME --partition PARTITION_NAME --nodes 1
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
- **Prompt sources**: omit `--input` to automatically download and cache LiveBench categories (``benchmark_data/``). Provide `--input path/to/prompts.jsonl` to reuse an existing JSONL file instead. Use `--num-prompts`, `--temperature`, and `--max-tokens` to control synthetic dataset generation.
|
|
176
|
+
- **Outputs**: results default to `results/benchmarks/<name>_results.json` and a metrics summary (`<name>_metrics.txt`) containing elapsed SLURM runtime and number of prompts processed.
|
|
177
|
+
- **Batch tuning**: adjust `--batch-size` for throughput. Pass model arguments such as `--temperature` and `--max-tokens` to forward them to the runner.
|
|
178
|
+
- **SLURM overrides**: forward scheduler settings with `--account`, `--partition`, `--nodes`, `--gpus-per-node`, `--time`, `--mem`, and `--cpus-per-task`.
|
|
179
|
+
- **Job controls**: add `--rebuild` to force an Apptainer image rebuild or `--debug` to keep the generated job script for inspection.
|
|
180
|
+
|
|
181
|
+
For the complete option reference:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
aiflux benchmark --help
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
[MIT License](LICENSE)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "llmflux"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI tool for running LLM batch processing jobs on HPC systems with Ollama and vLLM"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Rohan Marwaha", email = "rohan13@illinois.edu"}
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.11"
|
|
15
|
+
keywords = ["llm", "batch-processing", "slurm", "hpc", "ai", "machine-learning", "ollama", "vllm"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"requests>=2.31.0",
|
|
29
|
+
"pandas>=2.1.0",
|
|
30
|
+
"pyyaml>=6.0.1",
|
|
31
|
+
"python-dotenv>=1.0.1",
|
|
32
|
+
"pydantic>=2.6.0",
|
|
33
|
+
"datasets>=3.0.0"
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/Center-for-AI-Innovation/ai-flux"
|
|
38
|
+
Repository = "https://github.com/Center-for-AI-Innovation/ai-flux"
|
|
39
|
+
Issues = "https://github.com/Center-for-AI-Innovation/ai-flux/issues"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
aiflux = "aiflux.cli:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools]
|
|
45
|
+
package-dir = {"" = "src"}
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.packages.find]
|
|
48
|
+
where = ["src"]
|
|
49
|
+
|
|
50
|
+
[tool.setuptools.package-data]
|
|
51
|
+
"aiflux" = [
|
|
52
|
+
"templates/models/*/*.yaml",
|
|
53
|
+
"container/*.def",
|
|
54
|
+
"slurm/*.sh"
|
|
55
|
+
]
|
llmflux-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""AI-Flux: LLM Batch Processing Pipeline for HPC Systems."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
from .processors.batch import BatchProcessor
|
|
6
|
+
from .slurm.runner import SlurmRunner
|
|
7
|
+
from .core.config import Config, ModelConfig, SlurmConfig
|
|
8
|
+
from .io.output import JSONOutputHandler
|
|
9
|
+
from .io.base import InputHandler, OutputHandler
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
'BatchProcessor',
|
|
13
|
+
'SlurmRunner',
|
|
14
|
+
'Config',
|
|
15
|
+
'ModelConfig',
|
|
16
|
+
'SlurmConfig',
|
|
17
|
+
'InputHandler',
|
|
18
|
+
'OutputHandler',
|
|
19
|
+
'JSONOutputHandler'
|
|
20
|
+
]
|