Skip to content

Commit 5506325

Browse files
authored
Merge d7a76a8 into 7f2fbeb
2 parents 7f2fbeb + d7a76a8 commit 5506325

File tree

15 files changed

+221
-103
lines changed

15 files changed

+221
-103
lines changed

pylock.toml

Lines changed: 81 additions & 82 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ dependencies = [
5656
"protobuf",
5757
"pydantic>=2.11.7",
5858
"pydantic-settings>=2.0.0",
59-
"pyhumps>=3.8.0",
6059
"pyyaml>=6.0.0",
6160
"rich",
6261
"transformers",

src/guidellm/benchmark/output.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import json
33
import math
44
from collections import OrderedDict
5+
from copy import deepcopy
56
from datetime import datetime
67
from pathlib import Path
78
from typing import Any, Literal, Optional, Union
89

9-
import humps # type: ignore[import-not-found]
1010
import yaml
1111
from pydantic import Field
1212
from rich.console import Console
@@ -30,6 +30,8 @@
3030
from guidellm.presentation.injector import create_report
3131
from guidellm.scheduler import strategy_display_str
3232
from guidellm.utils import Colors, split_text_list_by_length
33+
from guidellm.utils.dict import recursive_key_update
34+
from guidellm.utils.text import camelize_str
3335

3436
__all__ = [
3537
"GenerativeBenchmarksConsole",
@@ -239,11 +241,11 @@ def save_html(self, path: Union[str, Path]) -> Path:
239241

240242
data_builder = UIDataBuilder(self.benchmarks)
241243
data = data_builder.to_dict()
242-
camel_data = humps.camelize(data)
244+
camel_data = recursive_key_update(deepcopy(data), camelize_str)
243245
ui_api_data = {}
244246
for k, v in camel_data.items():
245-
key = f"window.{humps.decamelize(k)} = {{}};"
246-
value = f"window.{humps.decamelize(k)} = {json.dumps(v, indent=2)};\n"
247+
key = f"window.{k} = {{}};"
248+
value = f"window.{k} = {json.dumps(v, indent=2)};\n"
247249
ui_api_data[key] = value
248250
return create_report(ui_api_data, path)
249251

src/guidellm/utils/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .colors import Colors
22
from .default_group import DefaultGroupHandler
3+
from .dict import recursive_key_update
34
from .hf_datasets import (
45
SUPPORTED_TYPES,
56
save_dataset_to_file,
@@ -10,6 +11,7 @@
1011
from .random import IntegerRangeSampler
1112
from .text import (
1213
EndlessTextCreator,
14+
camelize_str,
1315
clean_text,
1416
filter_text,
1517
is_puncutation,
@@ -24,11 +26,13 @@
2426
"DefaultGroupHandler",
2527
"EndlessTextCreator",
2628
"IntegerRangeSampler",
29+
"camelize_str",
2730
"check_load_processor",
2831
"clean_text",
2932
"filter_text",
3033
"is_puncutation",
3134
"load_text",
35+
"recursive_key_update",
3236
"save_dataset_to_file",
3337
"split_text",
3438
"split_text_list_by_length",

src/guidellm/utils/dict.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def recursive_key_update(d, key_update_func):
2+
if not isinstance(d, dict) and not isinstance(d, list):
3+
return d
4+
5+
if isinstance(d, list):
6+
for item in d:
7+
recursive_key_update(item, key_update_func)
8+
return d
9+
10+
updated_key_pairs = []
11+
for key, _ in d.items():
12+
updated_key = key_update_func(key)
13+
if key != updated_key:
14+
updated_key_pairs.append((key, updated_key))
15+
16+
for key_pair in updated_key_pairs:
17+
old_key, updated_key = key_pair
18+
d[updated_key] = d[old_key]
19+
del d[old_key]
20+
21+
for _, value in d.items():
22+
recursive_key_update(value, key_update_func)
23+
return d

src/guidellm/utils/text.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
__all__ = [
1616
"EndlessTextCreator",
17+
"camelize_str",
1718
"clean_text",
1819
"filter_text",
1920
"is_puncutation",
@@ -189,6 +190,12 @@ def is_puncutation(text: str) -> bool:
189190
return len(text) == 1 and not text.isalnum() and not text.isspace()
190191

191192

193+
def camelize_str(snake_case_string: str) -> str:
194+
return (words := snake_case_string.split("_"))[0].lower() + "".join(
195+
word.capitalize() for word in words[1:]
196+
)
197+
198+
192199
class EndlessTextCreator:
193200
def __init__(
194201
self,

src/ui/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function RootLayout({
3434
<script
3535
dangerouslySetInnerHTML={{
3636
__html:
37-
'window.run_info = {}; window.workload_details = {}; window.benchmarks = {};',
37+
'window.runInfo = {}; window.workloadDetails = {}; window.benchmarks = {};',
3838
}}
3939
/>
4040
);

src/ui/lib/store/runInfoWindowData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const runInfoScript = `window.run_info = {
1+
export const runInfoScript = `window.runInfo = {
22
"model": {
33
"name": "neuralmagic/Qwen2.5-7B-quantized.w8a8",
44
"size": 0

src/ui/lib/store/slices/runInfo/runInfo.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { RunInfo } from './runInfo.interfaces';
55
const USE_MOCK_API = process.env.NEXT_PUBLIC_USE_MOCK_API === 'true';
66

77
const fetchRunInfo = () => {
8-
return { data: window.run_info as RunInfo };
8+
return { data: window.runInfo as RunInfo };
99
};
1010

1111
export const runInfoApi = createApi({

src/ui/lib/store/slices/workloadDetails/workloadDetails.api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { WorkloadDetails } from './workloadDetails.interfaces';
55
const USE_MOCK_API = process.env.NEXT_PUBLIC_USE_MOCK_API === 'true';
66

77
const fetchWorkloadDetails = () => {
8-
return { data: window.workload_details as WorkloadDetails };
8+
return { data: window.workloadDetails as WorkloadDetails };
99
};
1010

1111
export const workloadDetailsApi = createApi({

0 commit comments

Comments
 (0)