speedy-utils 1.0.4__tar.gz → 1.0.9__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.
Files changed (43) hide show
  1. speedy_utils-1.0.9/PKG-INFO +287 -0
  2. speedy_utils-1.0.9/README.md +249 -0
  3. speedy_utils-1.0.9/pyproject.toml +65 -0
  4. speedy_utils-1.0.9/src/llm_utils/__init__.py +31 -0
  5. speedy_utils-1.0.9/src/llm_utils/chat_format/__init__.py +34 -0
  6. speedy_utils-1.0.9/src/llm_utils/chat_format/display.py +274 -0
  7. speedy_utils-1.0.9/src/llm_utils/chat_format/transform.py +149 -0
  8. speedy_utils-1.0.9/src/llm_utils/chat_format/utils.py +43 -0
  9. speedy_utils-1.0.9/src/llm_utils/group_messages.py +120 -0
  10. speedy_utils-1.0.9/src/llm_utils/lm/__init__.py +8 -0
  11. speedy_utils-1.0.9/src/llm_utils/lm/lm.py +304 -0
  12. speedy_utils-1.0.9/src/llm_utils/lm/utils.py +130 -0
  13. speedy_utils-1.0.9/src/llm_utils/scripts/vllm_load_balancer.py +435 -0
  14. speedy_utils-1.0.9/src/llm_utils/scripts/vllm_serve.py +416 -0
  15. speedy_utils-1.0.9/src/speedy_utils/__init__.py +85 -0
  16. speedy_utils-1.0.9/src/speedy_utils/all.py +159 -0
  17. {speedy_utils-1.0.4/speedy → speedy_utils-1.0.9/src/speedy_utils}/common/__init__.py +0 -0
  18. speedy_utils-1.0.9/src/speedy_utils/common/clock.py +215 -0
  19. speedy_utils-1.0.9/src/speedy_utils/common/function_decorator.py +66 -0
  20. speedy_utils-1.0.9/src/speedy_utils/common/logger.py +207 -0
  21. speedy_utils-1.0.9/src/speedy_utils/common/report_manager.py +112 -0
  22. speedy_utils-1.0.9/src/speedy_utils/common/utils_cache.py +264 -0
  23. {speedy_utils-1.0.4/speedy → speedy_utils-1.0.9/src/speedy_utils}/common/utils_io.py +66 -19
  24. {speedy_utils-1.0.4/speedy → speedy_utils-1.0.9/src/speedy_utils}/common/utils_misc.py +25 -11
  25. speedy_utils-1.0.9/src/speedy_utils/common/utils_print.py +216 -0
  26. speedy_utils-1.0.9/src/speedy_utils/multi_worker/__init__.py +0 -0
  27. speedy_utils-1.0.9/src/speedy_utils/multi_worker/process.py +198 -0
  28. speedy_utils-1.0.9/src/speedy_utils/multi_worker/thread.py +327 -0
  29. speedy_utils-1.0.9/src/speedy_utils/scripts/mpython.py +108 -0
  30. speedy_utils-1.0.4/PKG-INFO +0 -21
  31. speedy_utils-1.0.4/pyproject.toml +0 -3
  32. speedy_utils-1.0.4/setup.cfg +0 -4
  33. speedy_utils-1.0.4/setup.py +0 -28
  34. speedy_utils-1.0.4/speedy/__init__.py +0 -53
  35. speedy_utils-1.0.4/speedy/common/clock.py +0 -68
  36. speedy_utils-1.0.4/speedy/common/utils_cache.py +0 -170
  37. speedy_utils-1.0.4/speedy/common/utils_print.py +0 -138
  38. speedy_utils-1.0.4/speedy/multi_worker.py +0 -121
  39. speedy_utils-1.0.4/speedy_utils.egg-info/PKG-INFO +0 -21
  40. speedy_utils-1.0.4/speedy_utils.egg-info/SOURCES.txt +0 -15
  41. speedy_utils-1.0.4/speedy_utils.egg-info/dependency_links.txt +0 -1
  42. speedy_utils-1.0.4/speedy_utils.egg-info/requires.txt +0 -14
  43. speedy_utils-1.0.4/speedy_utils.egg-info/top_level.txt +0 -1
@@ -0,0 +1,287 @@
1
+ Metadata-Version: 2.3
2
+ Name: speedy-utils
3
+ Version: 1.0.9
4
+ Summary: Fast and easy-to-use package for data science
5
+ Author: AnhVTH
6
+ Author-email: anhvth.226@gmail.com
7
+ Requires-Python: >=3.9
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: bump2version
15
+ Requires-Dist: cachetools
16
+ Requires-Dist: debugpy
17
+ Requires-Dist: fastcore
18
+ Requires-Dist: fastprogress
19
+ Requires-Dist: freezegun (>=1.5.1,<2.0.0)
20
+ Requires-Dist: ipdb
21
+ Requires-Dist: ipywidgets
22
+ Requires-Dist: json-repair (>=0.40.0,<0.41.0)
23
+ Requires-Dist: jupyterlab
24
+ Requires-Dist: loguru
25
+ Requires-Dist: matplotlib
26
+ Requires-Dist: numpy
27
+ Requires-Dist: packaging (>=23.2,<25)
28
+ Requires-Dist: pandas
29
+ Requires-Dist: pydantic
30
+ Requires-Dist: requests
31
+ Requires-Dist: scikit-learn
32
+ Requires-Dist: tabulate
33
+ Requires-Dist: tqdm
34
+ Requires-Dist: xxhash
35
+ Project-URL: Homepage, https://github.com/anhvth/speedy
36
+ Description-Content-Type: text/markdown
37
+
38
+ # Speedy Utils
39
+
40
+ ![PyPI](https://img.shields.io/pypi/v/speedy-utils)
41
+ ![Python Versions](https://img.shields.io/pypi/pyversions/speedy-utils)
42
+ ![License](https://img.shields.io/pypi/l/speedy-utils)
43
+
44
+ **Speedy Utils** is a Python utility library designed to streamline common programming tasks such as caching, parallel processing, file I/O, and data manipulation. It provides a collection of decorators, functions, and classes to enhance productivity and performance in your Python projects.
45
+
46
+ ## Table of Contents
47
+
48
+ - [Features](#features)
49
+ - [Installation](#installation)
50
+ - [Usage](#usage)
51
+ - [Caching](#caching)
52
+ - [Parallel Processing](#parallel-processing)
53
+ - [File I/O](#file-io)
54
+ - [Data Manipulation](#data-manipulation)
55
+ - [Utility Functions](#utility-functions)
56
+ - [Testing](#testing)
57
+
58
+ ## Features
59
+
60
+ - **Caching Mechanisms**: Disk-based and in-memory caching to optimize function calls.
61
+ - **Parallel Processing**: Multi-threading, multi-processing, and asynchronous multi-threading utilities.
62
+ - **File I/O**: Simplified JSON, JSONL, and pickle file handling with support for various file extensions.
63
+ - **Data Manipulation**: Utilities for flattening lists and dictionaries, converting data types, and more.
64
+ - **Timing Utilities**: Tools to measure and log execution time of functions and processes.
65
+ - **Pretty Printing**: Enhanced printing functions for structured data, including HTML tables for Jupyter notebooks.
66
+
67
+ ## Installation
68
+
69
+ You can install **Speedy Utils** via [PyPI](https://pypi.org/project/speedy-utils/) using `pip`:
70
+
71
+ ```bash
72
+ uv pip install speedy-utils
73
+
74
+ ```
75
+
76
+ Alternatively, install directly from the repository:
77
+
78
+ ```bash
79
+ uv pip install git+https://github.com/anhvth/speedy
80
+ cd speedy-utils
81
+ pip install .
82
+ ```
83
+
84
+ ## Updating from previous versions
85
+
86
+ To update from previous versions or switch to v1.x, first uninstall any old
87
+ packages, then install the latest version:
88
+
89
+ ```bash
90
+ pip uninstall speedy_llm_utils speedy_utils
91
+ pip install -e ./ # for local development
92
+ # or
93
+ pip install speedy_utils -U # for PyPI upgrade
94
+ ```
95
+
96
+ ## Usage
97
+
98
+ Below are examples demonstrating how to utilize various features of **Speedy Utils**.
99
+
100
+ ### Caching
101
+
102
+ #### Memoize Decorator
103
+
104
+ Cache the results of function calls to disk to avoid redundant computations.
105
+
106
+ ```python
107
+ from speedy_utils import memoize
108
+
109
+ @memoize
110
+ def expensive_function(x):
111
+ # Simulate an expensive computation
112
+ import time
113
+ time.sleep(2)
114
+ return x * x
115
+
116
+ result = expensive_function(4) # Takes ~2 seconds
117
+ result = expensive_function(4) # Retrieved from cache instantly
118
+ ```
119
+
120
+ #### In-Memory Memoization
121
+
122
+ Cache function results in memory for faster access within the same runtime.
123
+
124
+ ```python
125
+ from speedy_utils import imemoize
126
+
127
+ @imemoize
128
+ def compute_sum(a, b):
129
+ return a + b
130
+
131
+ result = compute_sum(5, 7) # Computed and cached
132
+ result = compute_sum(5, 7) # Retrieved from in-memory cache
133
+ ```
134
+
135
+ ### Parallel Processing
136
+
137
+ #### Multi-threading
138
+
139
+ Execute functions concurrently using multiple threads. This approach is straightforward and automatically handles both notebook and Python script executions. In a notebook environment, it delegates the running thread to a separate process. If interrupted, it immediately stops this process, avoiding thread dependency issues where threads continue running until all tasks are completed.
140
+
141
+ ```python
142
+ from speedy_utils import multi_thread
143
+
144
+ def process_item(item):
145
+ # Your processing logic
146
+ return item * 2
147
+
148
+ items = [1, 2, 3, 4, 5]
149
+ results = multi_thread(process_item, items, workers=3)
150
+ print(results) # [2, 4, 6, 8, 10]
151
+ ```
152
+
153
+ ### File I/O
154
+
155
+ #### Dumping Data
156
+
157
+ Save data in JSON, JSONL, or pickle formats.
158
+
159
+ ```python
160
+ from speedy_utils import dump_json_or_pickle, dump_jsonl
161
+
162
+ data = {"name": "Alice", "age": 30}
163
+
164
+ # Save as JSON
165
+ dump_json_or_pickle(data, "data.json")
166
+
167
+ # Save as JSONL
168
+ dump_jsonl([data, {"name": "Bob", "age": 25}], "data.jsonl")
169
+
170
+ # Save as Pickle
171
+ dump_json_or_pickle(data, "data.pkl")
172
+ ```
173
+
174
+ #### Loading Data
175
+
176
+ Load data based on file extensions.
177
+
178
+ ```python
179
+ from speedy_utils import load_json_or_pickle, load_by_ext
180
+
181
+ # Load JSON
182
+ data = load_json_or_pickle("data.json")
183
+
184
+ # Load JSONL
185
+ data_list = load_json_or_pickle("data.jsonl")
186
+
187
+ # Load Pickle
188
+ data = load_json_or_pickle("data.pkl")
189
+
190
+ # Load based on extension with parallel processing
191
+ loaded_data = load_by_ext(["data.json", "data.pkl"])
192
+ ```
193
+
194
+ ### Data Manipulation
195
+
196
+ #### Flattening Lists and Dictionaries
197
+
198
+ ```python
199
+ from speedy_utils import flatten_list, flatten_dict
200
+
201
+ nested_list = [[1, 2], [3, 4], [5]]
202
+ flat_list = flatten_list(nested_list)
203
+ print(flat_list) # [1, 2, 3, 4, 5]
204
+
205
+ nested_dict = {"a": {"b": 1, "c": 2}, "d": 3}
206
+ flat_dict = flatten_dict(nested_dict)
207
+ print(flat_dict) # {'a.b': 1, 'a.c': 2, 'd': 3}
208
+ ```
209
+
210
+ #### Converting to Built-in Python Types
211
+
212
+ ```python
213
+ from speedy_utils import convert_to_builtin_python
214
+ from pydantic import BaseModel
215
+
216
+ class User(BaseModel):
217
+ name: str
218
+ age: int
219
+
220
+ user = User(name="Charlie", age=28)
221
+ builtin_user = convert_to_builtin_python(user)
222
+ print(builtin_user) # {'name': 'Charlie', 'age': 28}
223
+ ```
224
+
225
+ ### Utility Functions
226
+
227
+ #### Pretty Printing
228
+
229
+ ```python
230
+ from speedy_utils import fprint, print_table
231
+
232
+ data = {"name": "Dana", "age": 22, "city": "New York"}
233
+
234
+ # Pretty print as table
235
+ fprint(data)
236
+
237
+ # Print as table using tabulate
238
+ print_table(data)
239
+ ```
240
+
241
+ #### Timing Utilities
242
+
243
+ ```python
244
+ from speedy_utils import timef, Clock
245
+
246
+ @timef
247
+ def slow_function():
248
+ import time
249
+ time.sleep(3)
250
+ return "Done"
251
+
252
+ result = slow_function() # Prints execution time
253
+
254
+ # Using Clock
255
+ clock = Clock()
256
+ # ... your code ...
257
+ clock.log()
258
+ ```
259
+
260
+ ## Testing
261
+
262
+ The project includes a comprehensive test suite using `unittest`. To run the tests, execute the following command in the project root directory:
263
+
264
+ ```bash
265
+ python test.py
266
+ ```
267
+
268
+ Ensure all dependencies are installed before running tests:
269
+
270
+ ```bash
271
+ pip install -r requirements.txt
272
+ ```
273
+
274
+ Run the script to parse and display the arguments:
275
+
276
+ ```bash
277
+ python speedy_utils/common/dataclass_parser.py
278
+ ```
279
+
280
+ Example output:
281
+
282
+ | Field | Value |
283
+ |--------------------|---------------------------------------|
284
+ | from_peft | ./outputs/llm_hn_qw32b/hn_results_r3/ |
285
+
286
+ Please ensure your code adheres to the project's coding standards and includes appropriate tests.
287
+
@@ -0,0 +1,249 @@
1
+ # Speedy Utils
2
+
3
+ ![PyPI](https://img.shields.io/pypi/v/speedy-utils)
4
+ ![Python Versions](https://img.shields.io/pypi/pyversions/speedy-utils)
5
+ ![License](https://img.shields.io/pypi/l/speedy-utils)
6
+
7
+ **Speedy Utils** is a Python utility library designed to streamline common programming tasks such as caching, parallel processing, file I/O, and data manipulation. It provides a collection of decorators, functions, and classes to enhance productivity and performance in your Python projects.
8
+
9
+ ## Table of Contents
10
+
11
+ - [Features](#features)
12
+ - [Installation](#installation)
13
+ - [Usage](#usage)
14
+ - [Caching](#caching)
15
+ - [Parallel Processing](#parallel-processing)
16
+ - [File I/O](#file-io)
17
+ - [Data Manipulation](#data-manipulation)
18
+ - [Utility Functions](#utility-functions)
19
+ - [Testing](#testing)
20
+
21
+ ## Features
22
+
23
+ - **Caching Mechanisms**: Disk-based and in-memory caching to optimize function calls.
24
+ - **Parallel Processing**: Multi-threading, multi-processing, and asynchronous multi-threading utilities.
25
+ - **File I/O**: Simplified JSON, JSONL, and pickle file handling with support for various file extensions.
26
+ - **Data Manipulation**: Utilities for flattening lists and dictionaries, converting data types, and more.
27
+ - **Timing Utilities**: Tools to measure and log execution time of functions and processes.
28
+ - **Pretty Printing**: Enhanced printing functions for structured data, including HTML tables for Jupyter notebooks.
29
+
30
+ ## Installation
31
+
32
+ You can install **Speedy Utils** via [PyPI](https://pypi.org/project/speedy-utils/) using `pip`:
33
+
34
+ ```bash
35
+ uv pip install speedy-utils
36
+
37
+ ```
38
+
39
+ Alternatively, install directly from the repository:
40
+
41
+ ```bash
42
+ uv pip install git+https://github.com/anhvth/speedy
43
+ cd speedy-utils
44
+ pip install .
45
+ ```
46
+
47
+ ## Updating from previous versions
48
+
49
+ To update from previous versions or switch to v1.x, first uninstall any old
50
+ packages, then install the latest version:
51
+
52
+ ```bash
53
+ pip uninstall speedy_llm_utils speedy_utils
54
+ pip install -e ./ # for local development
55
+ # or
56
+ pip install speedy_utils -U # for PyPI upgrade
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ Below are examples demonstrating how to utilize various features of **Speedy Utils**.
62
+
63
+ ### Caching
64
+
65
+ #### Memoize Decorator
66
+
67
+ Cache the results of function calls to disk to avoid redundant computations.
68
+
69
+ ```python
70
+ from speedy_utils import memoize
71
+
72
+ @memoize
73
+ def expensive_function(x):
74
+ # Simulate an expensive computation
75
+ import time
76
+ time.sleep(2)
77
+ return x * x
78
+
79
+ result = expensive_function(4) # Takes ~2 seconds
80
+ result = expensive_function(4) # Retrieved from cache instantly
81
+ ```
82
+
83
+ #### In-Memory Memoization
84
+
85
+ Cache function results in memory for faster access within the same runtime.
86
+
87
+ ```python
88
+ from speedy_utils import imemoize
89
+
90
+ @imemoize
91
+ def compute_sum(a, b):
92
+ return a + b
93
+
94
+ result = compute_sum(5, 7) # Computed and cached
95
+ result = compute_sum(5, 7) # Retrieved from in-memory cache
96
+ ```
97
+
98
+ ### Parallel Processing
99
+
100
+ #### Multi-threading
101
+
102
+ Execute functions concurrently using multiple threads. This approach is straightforward and automatically handles both notebook and Python script executions. In a notebook environment, it delegates the running thread to a separate process. If interrupted, it immediately stops this process, avoiding thread dependency issues where threads continue running until all tasks are completed.
103
+
104
+ ```python
105
+ from speedy_utils import multi_thread
106
+
107
+ def process_item(item):
108
+ # Your processing logic
109
+ return item * 2
110
+
111
+ items = [1, 2, 3, 4, 5]
112
+ results = multi_thread(process_item, items, workers=3)
113
+ print(results) # [2, 4, 6, 8, 10]
114
+ ```
115
+
116
+ ### File I/O
117
+
118
+ #### Dumping Data
119
+
120
+ Save data in JSON, JSONL, or pickle formats.
121
+
122
+ ```python
123
+ from speedy_utils import dump_json_or_pickle, dump_jsonl
124
+
125
+ data = {"name": "Alice", "age": 30}
126
+
127
+ # Save as JSON
128
+ dump_json_or_pickle(data, "data.json")
129
+
130
+ # Save as JSONL
131
+ dump_jsonl([data, {"name": "Bob", "age": 25}], "data.jsonl")
132
+
133
+ # Save as Pickle
134
+ dump_json_or_pickle(data, "data.pkl")
135
+ ```
136
+
137
+ #### Loading Data
138
+
139
+ Load data based on file extensions.
140
+
141
+ ```python
142
+ from speedy_utils import load_json_or_pickle, load_by_ext
143
+
144
+ # Load JSON
145
+ data = load_json_or_pickle("data.json")
146
+
147
+ # Load JSONL
148
+ data_list = load_json_or_pickle("data.jsonl")
149
+
150
+ # Load Pickle
151
+ data = load_json_or_pickle("data.pkl")
152
+
153
+ # Load based on extension with parallel processing
154
+ loaded_data = load_by_ext(["data.json", "data.pkl"])
155
+ ```
156
+
157
+ ### Data Manipulation
158
+
159
+ #### Flattening Lists and Dictionaries
160
+
161
+ ```python
162
+ from speedy_utils import flatten_list, flatten_dict
163
+
164
+ nested_list = [[1, 2], [3, 4], [5]]
165
+ flat_list = flatten_list(nested_list)
166
+ print(flat_list) # [1, 2, 3, 4, 5]
167
+
168
+ nested_dict = {"a": {"b": 1, "c": 2}, "d": 3}
169
+ flat_dict = flatten_dict(nested_dict)
170
+ print(flat_dict) # {'a.b': 1, 'a.c': 2, 'd': 3}
171
+ ```
172
+
173
+ #### Converting to Built-in Python Types
174
+
175
+ ```python
176
+ from speedy_utils import convert_to_builtin_python
177
+ from pydantic import BaseModel
178
+
179
+ class User(BaseModel):
180
+ name: str
181
+ age: int
182
+
183
+ user = User(name="Charlie", age=28)
184
+ builtin_user = convert_to_builtin_python(user)
185
+ print(builtin_user) # {'name': 'Charlie', 'age': 28}
186
+ ```
187
+
188
+ ### Utility Functions
189
+
190
+ #### Pretty Printing
191
+
192
+ ```python
193
+ from speedy_utils import fprint, print_table
194
+
195
+ data = {"name": "Dana", "age": 22, "city": "New York"}
196
+
197
+ # Pretty print as table
198
+ fprint(data)
199
+
200
+ # Print as table using tabulate
201
+ print_table(data)
202
+ ```
203
+
204
+ #### Timing Utilities
205
+
206
+ ```python
207
+ from speedy_utils import timef, Clock
208
+
209
+ @timef
210
+ def slow_function():
211
+ import time
212
+ time.sleep(3)
213
+ return "Done"
214
+
215
+ result = slow_function() # Prints execution time
216
+
217
+ # Using Clock
218
+ clock = Clock()
219
+ # ... your code ...
220
+ clock.log()
221
+ ```
222
+
223
+ ## Testing
224
+
225
+ The project includes a comprehensive test suite using `unittest`. To run the tests, execute the following command in the project root directory:
226
+
227
+ ```bash
228
+ python test.py
229
+ ```
230
+
231
+ Ensure all dependencies are installed before running tests:
232
+
233
+ ```bash
234
+ pip install -r requirements.txt
235
+ ```
236
+
237
+ Run the script to parse and display the arguments:
238
+
239
+ ```bash
240
+ python speedy_utils/common/dataclass_parser.py
241
+ ```
242
+
243
+ Example output:
244
+
245
+ | Field | Value |
246
+ |--------------------|---------------------------------------|
247
+ | from_peft | ./outputs/llm_hn_qw32b/hn_results_r3/ |
248
+
249
+ Please ensure your code adheres to the project's coding standards and includes appropriate tests.
@@ -0,0 +1,65 @@
1
+ [tool.poetry]
2
+ name = "speedy-utils"
3
+ version = "1.0.9"
4
+ description = "Fast and easy-to-use package for data science"
5
+ authors = ["AnhVTH <anhvth.226@gmail.com>"]
6
+ readme = "README.md"
7
+ homepage = "https://github.com/anhvth/speedy"
8
+ packages = [
9
+ { include = "speedy_utils", from = "src" },
10
+ { include = "llm_utils", from = "src" },
11
+ ]
12
+
13
+ [build-system]
14
+ requires = ["poetry-core>=1.0.9"]
15
+ build-backend = "poetry.core.masonry.api"
16
+
17
+ [tool.black]
18
+ line-length = 88
19
+ target-version = ["py310"]
20
+ include = '\.pyi?$'
21
+
22
+ [tool.isort]
23
+ profile = "black"
24
+ line_length = 88
25
+ multi_line_output = 3
26
+
27
+ [tool.mypy]
28
+ python_version = "3.10"
29
+ warn_return_any = true
30
+ warn_unused_configs = true
31
+ disallow_untyped_defs = true
32
+ disallow_incomplete_defs = true
33
+ check_untyped_defs = true
34
+ disallow_untyped_decorators = true
35
+ no_implicit_optional = true
36
+ strict_optional = true
37
+
38
+ [tool.poetry.dependencies]
39
+ python = ">=3.9"
40
+ numpy = "*"
41
+ requests = "*"
42
+ xxhash = "*"
43
+ loguru = "*"
44
+ fastcore = "*"
45
+ debugpy = "*"
46
+ ipywidgets = "*"
47
+ jupyterlab = "*"
48
+ ipdb = "*"
49
+ scikit-learn = "*"
50
+ matplotlib = "*"
51
+ pandas = "*"
52
+ tabulate = "*"
53
+ pydantic = "*"
54
+ tqdm = "*"
55
+ cachetools = "*"
56
+ bump2version = "*"
57
+ json-repair = ">=0.40.0,<0.41.0"
58
+ fastprogress = "*"
59
+ freezegun = "^1.5.1"
60
+ packaging = ">=23.2,<25"
61
+
62
+ [tool.poetry.scripts]
63
+ mpython = "speedy_utils.scripts.mpython:main"
64
+ svllm = "llm_utils.scripts.vllm_serve:main"
65
+ svllm-lb = "llm_utils.scripts.vllm_load_balancer:run_load_balancer"
@@ -0,0 +1,31 @@
1
+ from .chat_format import (
2
+ transform_messages,
3
+ transform_messages_to_chatml,
4
+ show_chat,
5
+ get_conversation_one_turn,
6
+ show_string_diff,
7
+ display_conversations,
8
+ build_chatml_input,
9
+ format_msgs,
10
+ display_chat_messages_as_html,
11
+ )
12
+ from .lm import LM
13
+ from .group_messages import (
14
+ split_indices_by_length,
15
+ group_messages_by_len,
16
+ )
17
+
18
+ __all__ = [
19
+ "transform_messages",
20
+ "transform_messages_to_chatml",
21
+ "show_chat",
22
+ "get_conversation_one_turn",
23
+ "show_string_diff",
24
+ "display_conversations",
25
+ "build_chatml_input",
26
+ "format_msgs",
27
+ "split_indices_by_length",
28
+ "group_messages_by_len",
29
+ "LM",
30
+ "display_chat_messages_as_html",
31
+ ]
@@ -0,0 +1,34 @@
1
+ from .transform import (
2
+ identify_format,
3
+ _transform_sharegpt_to_chatml,
4
+ transform_messages,
5
+ transform_messages_to_chatml,
6
+ )
7
+ from .display import (
8
+ show_chat,
9
+ get_conversation_one_turn,
10
+ highlight_diff_chars,
11
+ show_string_diff,
12
+ display_conversations,
13
+ display_chat_messages_as_html,
14
+ )
15
+ from .utils import (
16
+ build_chatml_input,
17
+ format_msgs,
18
+ )
19
+
20
+
21
+ __all__ = [
22
+ "identify_format",
23
+ "_transform_sharegpt_to_chatml",
24
+ "transform_messages",
25
+ "transform_messages_to_chatml",
26
+ "show_chat",
27
+ "get_conversation_one_turn",
28
+ "highlight_diff_chars",
29
+ "build_chatml_input",
30
+ "format_msgs",
31
+ "show_string_diff",
32
+ "display_conversations",
33
+ "display_chat_messages_as_html",
34
+ ]