hjxdl 0.3.28__py3-none-any.whl → 0.3.29__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.
- hdl/_version.py +2 -2
- hdl/utils/decorators/llm.py +29 -0
- {hjxdl-0.3.28.dist-info → hjxdl-0.3.29.dist-info}/METADATA +1 -1
- {hjxdl-0.3.28.dist-info → hjxdl-0.3.29.dist-info}/RECORD +7 -7
- {hjxdl-0.3.28.dist-info → hjxdl-0.3.29.dist-info}/LICENSE +0 -0
- {hjxdl-0.3.28.dist-info → hjxdl-0.3.29.dist-info}/WHEEL +0 -0
- {hjxdl-0.3.28.dist-info → hjxdl-0.3.29.dist-info}/top_level.txt +0 -0
hdl/_version.py
CHANGED
hdl/utils/decorators/llm.py
CHANGED
@@ -2,6 +2,23 @@ import time
|
|
2
2
|
from functools import wraps
|
3
3
|
|
4
4
|
def measure_stream_performance(func):
|
5
|
+
"""
|
6
|
+
Measures the performance of a streaming function by tracking the time taken to output characters and the rate of character and token generation.
|
7
|
+
|
8
|
+
Args:
|
9
|
+
func (callable): The streaming function to be measured. It should return a generator that yields dictionaries containing 'type' and 'content' keys.
|
10
|
+
|
11
|
+
Returns:
|
12
|
+
callable: A wrapper function that performs the performance measurement and prints statistics related to the streaming output.
|
13
|
+
|
14
|
+
Statistics Printed:
|
15
|
+
- Time to first character (in seconds)
|
16
|
+
- Total time taken for the execution (in seconds)
|
17
|
+
- Total number of characters output
|
18
|
+
- Total number of tokens processed
|
19
|
+
- Characters output per second
|
20
|
+
- Tokens processed per second
|
21
|
+
"""
|
5
22
|
@wraps(func)
|
6
23
|
def wrapper(*args, **kwargs):
|
7
24
|
# 开始计时
|
@@ -54,6 +71,18 @@ def run_llm_stream(
|
|
54
71
|
prompt,
|
55
72
|
**kwargs
|
56
73
|
):
|
74
|
+
"""
|
75
|
+
Run a language model stream with the given parameters.
|
76
|
+
|
77
|
+
Args:
|
78
|
+
llm (object): The language model object used to generate responses.
|
79
|
+
client_id (str): The unique identifier for the client making the request.
|
80
|
+
prompt (str): The input prompt to which the language model should respond.
|
81
|
+
**kwargs: Additional keyword arguments to customize the request.
|
82
|
+
|
83
|
+
Returns:
|
84
|
+
iterable: An iterable response stream from the language model.
|
85
|
+
"""
|
57
86
|
resp = llm.stream(
|
58
87
|
client_id=client_id,
|
59
88
|
prompt=prompt,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
hdl/__init__.py,sha256=GffnD0jLJdhkd-vo989v40N90sQbofkayRBwxc6TVhQ,72
|
2
|
-
hdl/_version.py,sha256=
|
2
|
+
hdl/_version.py,sha256=f1H6PIKEuqUoOqkVNqRQPR6h3oBTbMF-TCtBkXnI8lc,413
|
3
3
|
hdl/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hdl/args/loss_args.py,sha256=s7YzSdd7IjD24rZvvOrxLLFqMZQb9YylxKeyelSdrTk,70
|
5
5
|
hdl/controllers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -122,7 +122,7 @@ hdl/utils/database_tools/connect.py,sha256=xCacGucKxlQUXs6AsNddpeECvdqT1180V1ZWq
|
|
122
122
|
hdl/utils/database_tools/datetime.py,sha256=xqE2xNiOpADzX-R8_bM0bioJRF3Ay9Jp1CAG6dy6uVI,1202
|
123
123
|
hdl/utils/database_tools/web.py,sha256=awJ8lafL-2KRjf3V1uuij8JIvX9U5fI8fLZKOkOvqtk,5771
|
124
124
|
hdl/utils/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
125
|
-
hdl/utils/decorators/llm.py,sha256=
|
125
|
+
hdl/utils/decorators/llm.py,sha256=zjAKaGTE4UuMdNbmCMKDrEgWDQ8o6oPYYQgHVeAF78M,3110
|
126
126
|
hdl/utils/desc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
127
127
|
hdl/utils/desc/func_desc.py,sha256=sHmVZZmV7Zgii--gnHqMs6fTb7HVkqTOf8Pl_0F6qlI,3808
|
128
128
|
hdl/utils/desc/template.py,sha256=Kf_tbL-XkDCKNQ3UncbCuYEeUgXEa7kRVCf9TD2b8og,2526
|
@@ -143,8 +143,8 @@ hdl/utils/schedulers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
143
143
|
hdl/utils/schedulers/norm_lr.py,sha256=bDwCmdEK-WkgxQMFBiMuchv8Mm7C0-GZJ6usm-PQk14,4461
|
144
144
|
hdl/utils/weather/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
145
145
|
hdl/utils/weather/weather.py,sha256=k11o6wM15kF8b9NMlEfrg68ak-SfSYLN3nOOflFUv-I,4381
|
146
|
-
hjxdl-0.3.
|
147
|
-
hjxdl-0.3.
|
148
|
-
hjxdl-0.3.
|
149
|
-
hjxdl-0.3.
|
150
|
-
hjxdl-0.3.
|
146
|
+
hjxdl-0.3.29.dist-info/LICENSE,sha256=lkMiSbeZHBQLB9LJEkS9-L3Z-LBC4yGnKrzHSG8RkPM,2599
|
147
|
+
hjxdl-0.3.29.dist-info/METADATA,sha256=BTs6PvUzk9E0AzgN86UFTibWjbUfi0ysphPzzCy__u0,1336
|
148
|
+
hjxdl-0.3.29.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
149
|
+
hjxdl-0.3.29.dist-info/top_level.txt,sha256=-kxwTM5JPhylp06z3zAVO3w6_h7wtBfBo2zgM6YZoTk,4
|
150
|
+
hjxdl-0.3.29.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|