speedy-utils 1.1.31__py3-none-any.whl → 1.1.33__py3-none-any.whl
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.
- llm_utils/lm/llm.py +4 -0
- speedy_utils/__imports.py +21 -6
- {speedy_utils-1.1.31.dist-info → speedy_utils-1.1.33.dist-info}/METADATA +1 -1
- {speedy_utils-1.1.31.dist-info → speedy_utils-1.1.33.dist-info}/RECORD +6 -6
- {speedy_utils-1.1.31.dist-info → speedy_utils-1.1.33.dist-info}/WHEEL +0 -0
- {speedy_utils-1.1.31.dist-info → speedy_utils-1.1.33.dist-info}/entry_points.txt +0 -0
llm_utils/lm/llm.py
CHANGED
|
@@ -63,9 +63,13 @@ class LLM(
|
|
|
63
63
|
vllm_cmd: str | None = None,
|
|
64
64
|
vllm_timeout: int = 1200,
|
|
65
65
|
vllm_reuse: bool = True,
|
|
66
|
+
verbose=False,
|
|
66
67
|
**model_kwargs,
|
|
67
68
|
):
|
|
68
69
|
"""Initialize LLMTask."""
|
|
70
|
+
if verbose:
|
|
71
|
+
available_models = LLM.list_models(client=client)
|
|
72
|
+
logger.info(f'Available models: {available_models}')
|
|
69
73
|
self.instruction = instruction
|
|
70
74
|
self.input_model = input_model
|
|
71
75
|
self.output_model = output_model
|
speedy_utils/__imports.py
CHANGED
|
@@ -34,7 +34,6 @@ import re
|
|
|
34
34
|
import sys
|
|
35
35
|
import textwrap
|
|
36
36
|
import threading
|
|
37
|
-
import time
|
|
38
37
|
import traceback
|
|
39
38
|
import types
|
|
40
39
|
import uuid
|
|
@@ -77,6 +76,9 @@ from typing import (
|
|
|
77
76
|
)
|
|
78
77
|
|
|
79
78
|
import cachetools
|
|
79
|
+
|
|
80
|
+
# Direct imports (previously lazy-loaded)
|
|
81
|
+
import numpy as np
|
|
80
82
|
import psutil
|
|
81
83
|
from fastcore.parallel import parallel
|
|
82
84
|
from json_repair import loads as jloads
|
|
@@ -84,52 +86,61 @@ from loguru import logger
|
|
|
84
86
|
from tqdm import tqdm
|
|
85
87
|
|
|
86
88
|
|
|
87
|
-
# Direct imports (previously lazy-loaded)
|
|
88
|
-
import numpy as np
|
|
89
89
|
tabulate = __import__('tabulate').tabulate
|
|
90
90
|
import xxhash
|
|
91
91
|
|
|
92
|
+
|
|
92
93
|
# Optional imports - lazy loaded for performance
|
|
93
94
|
def _get_pandas():
|
|
94
95
|
"""Lazy import pandas."""
|
|
95
96
|
try:
|
|
96
97
|
import pandas as pd
|
|
98
|
+
|
|
97
99
|
return pd
|
|
98
100
|
except ImportError:
|
|
99
101
|
return None
|
|
100
102
|
|
|
103
|
+
|
|
101
104
|
def _get_ray():
|
|
102
105
|
"""Lazy import ray."""
|
|
103
106
|
try:
|
|
104
107
|
import ray
|
|
108
|
+
|
|
105
109
|
return ray
|
|
106
110
|
except ImportError:
|
|
107
111
|
return None
|
|
108
112
|
|
|
113
|
+
|
|
109
114
|
def _get_matplotlib():
|
|
110
115
|
"""Lazy import matplotlib."""
|
|
111
116
|
try:
|
|
112
117
|
import matplotlib
|
|
118
|
+
|
|
113
119
|
return matplotlib
|
|
114
120
|
except ImportError:
|
|
115
121
|
return None
|
|
116
122
|
|
|
123
|
+
|
|
117
124
|
def _get_matplotlib_pyplot():
|
|
118
125
|
"""Lazy import matplotlib.pyplot."""
|
|
119
126
|
try:
|
|
120
127
|
import matplotlib.pyplot as plt
|
|
128
|
+
|
|
121
129
|
return plt
|
|
122
130
|
except ImportError:
|
|
123
131
|
return None
|
|
124
132
|
|
|
133
|
+
|
|
125
134
|
def _get_ipython_core():
|
|
126
135
|
"""Lazy import IPython.core.getipython."""
|
|
127
136
|
try:
|
|
128
137
|
from IPython.core.getipython import get_ipython
|
|
129
|
-
|
|
138
|
+
|
|
139
|
+
return get_ipython()
|
|
130
140
|
except ImportError:
|
|
131
141
|
return None
|
|
132
142
|
|
|
143
|
+
|
|
133
144
|
# Cache for lazy imports
|
|
134
145
|
_pandas_cache = None
|
|
135
146
|
_ray_cache = None
|
|
@@ -137,9 +148,11 @@ _matplotlib_cache = None
|
|
|
137
148
|
_plt_cache = None
|
|
138
149
|
_get_ipython_cache = None
|
|
139
150
|
|
|
151
|
+
|
|
140
152
|
# Lazy import classes for performance-critical modules
|
|
141
153
|
class _LazyModule:
|
|
142
154
|
"""Lazy module loader that imports only when accessed."""
|
|
155
|
+
|
|
143
156
|
def __init__(self, import_func, cache_var_name):
|
|
144
157
|
self._import_func = import_func
|
|
145
158
|
self._cache_var_name = cache_var_name
|
|
@@ -168,9 +181,10 @@ class _LazyModule:
|
|
|
168
181
|
|
|
169
182
|
def __repr__(self):
|
|
170
183
|
if self._module is None:
|
|
171
|
-
return
|
|
184
|
+
return '<LazyModule: not loaded>'
|
|
172
185
|
return repr(self._module)
|
|
173
186
|
|
|
187
|
+
|
|
174
188
|
# Create lazy loaders for top slow imports (import only when accessed)
|
|
175
189
|
pd = _LazyModule(_get_pandas, '_pandas_cache')
|
|
176
190
|
ray = _LazyModule(_get_ray, '_ray_cache')
|
|
@@ -200,11 +214,12 @@ try:
|
|
|
200
214
|
except ImportError:
|
|
201
215
|
BaseModel = None
|
|
202
216
|
if TYPE_CHECKING:
|
|
217
|
+
import matplotlib.pyplot as plt
|
|
203
218
|
import numpy as np
|
|
204
219
|
import pandas as pd
|
|
205
220
|
import ray
|
|
206
221
|
import torch
|
|
207
|
-
|
|
222
|
+
|
|
208
223
|
# xxhash
|
|
209
224
|
import xxhash # type: ignore
|
|
210
225
|
from IPython.core.getipython import get_ipython # type: ignore
|
|
@@ -6,7 +6,7 @@ llm_utils/chat_format/transform.py,sha256=PJ2g9KT1GSbWuAs7giEbTpTAffpU9QsIXyRlbf
|
|
|
6
6
|
llm_utils/chat_format/utils.py,sha256=M2EctZ6NeHXqFYufh26Y3CpSphN0bdZm5xoNaEJj5vg,1251
|
|
7
7
|
llm_utils/lm/__init__.py,sha256=lFE2DZRpj6eRMo11kx7oRLyYOP2FuDmz08mAcq-cYew,730
|
|
8
8
|
llm_utils/lm/base_prompt_builder.py,sha256=_TzYMsWr-SsbA_JNXptUVN56lV5RfgWWTrFi-E8LMy4,12337
|
|
9
|
-
llm_utils/lm/llm.py,sha256=
|
|
9
|
+
llm_utils/lm/llm.py,sha256=C8Z8l6Ljs7uVX-zabLcDCdTf3fpGxfljaYRM0patHUQ,16469
|
|
10
10
|
llm_utils/lm/llm_signature.py,sha256=vV8uZgLLd6ZKqWbq0OPywWvXAfl7hrJQnbtBF-VnZRU,1244
|
|
11
11
|
llm_utils/lm/lm_base.py,sha256=Bk3q34KrcCK_bC4Ryxbc3KqkiPL39zuVZaBQ1i6wJqs,9437
|
|
12
12
|
llm_utils/lm/mixins.py,sha256=on83g-JO2SpZ0digOpU8mooqFBX6w7Bc-DeGzVoVCX8,14536
|
|
@@ -27,7 +27,7 @@ llm_utils/vector_cache/cli.py,sha256=MAvnmlZ7j7_0CvIcSyK4TvJlSRFWYkm4wE7zSq3KR8k
|
|
|
27
27
|
llm_utils/vector_cache/core.py,sha256=VXuYJy1AX22NHKvIXRriETip5RrmQcNp73-g-ZT774o,30950
|
|
28
28
|
llm_utils/vector_cache/types.py,sha256=CpMZanJSTeBVxQSqjBq6pBVWp7u2-JRcgY9t5jhykdQ,438
|
|
29
29
|
llm_utils/vector_cache/utils.py,sha256=OsiRFydv8i8HiJtPL9hh40aUv8I5pYfg2zvmtDi4DME,1446
|
|
30
|
-
speedy_utils/__imports.py,sha256=
|
|
30
|
+
speedy_utils/__imports.py,sha256=V0YzkDK4-QkK_IDXY1be6C6_STuNhXAKIp4_dM0coQs,7800
|
|
31
31
|
speedy_utils/__init__.py,sha256=VkKqS4eHXd8YeDu2TAQ3Osqy70RSufUL1sECDoYzqvM,2685
|
|
32
32
|
speedy_utils/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
33
33
|
speedy_utils/common/clock.py,sha256=raLtMGIgzrRej5kUt7hOUm2ZZw2THVPo-q8dMvdZOxw,7354
|
|
@@ -50,7 +50,7 @@ vision_utils/README.md,sha256=AIDZZj8jo_QNrEjFyHwd00iOO431s-js-M2dLtVTn3I,5740
|
|
|
50
50
|
vision_utils/__init__.py,sha256=XsLxy1Fn33Zxu6hTFl3NEWfxGjuQQ-0Wmoh6lU9NZ_o,257
|
|
51
51
|
vision_utils/io_utils.py,sha256=q41pffN632HbMmzcBzfg2Z7DvZZgoAQCdD9jHLqDgjc,26603
|
|
52
52
|
vision_utils/plot.py,sha256=v73onfH8KbGHigw5KStUPqbLyJqIEOvvJaqtaoGKrls,12032
|
|
53
|
-
speedy_utils-1.1.
|
|
54
|
-
speedy_utils-1.1.
|
|
55
|
-
speedy_utils-1.1.
|
|
56
|
-
speedy_utils-1.1.
|
|
53
|
+
speedy_utils-1.1.33.dist-info/METADATA,sha256=QaZU14x_OlpExaRMZp3RnhkxEdRfBlhf0mqhaPTr6x4,8048
|
|
54
|
+
speedy_utils-1.1.33.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
55
|
+
speedy_utils-1.1.33.dist-info/entry_points.txt,sha256=1rrFMfqvaMUE9hvwGiD6vnVh98kmgy0TARBj-v0Lfhs,244
|
|
56
|
+
speedy_utils-1.1.33.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|