Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f7dc96a
trying to add reasoning - pt 1
sashavor Aug 18, 2025
a258aa5
testing on gemma 270m
sashavor Aug 18, 2025
0ef8f17
oops
sashavor Aug 18, 2025
d56b69a
ok maybe only bool
sashavor Aug 18, 2025
fecddd6
or not
sashavor Aug 18, 2025
38dc46f
trying Qwen
sashavor Aug 18, 2025
62403e5
no idea how to do this'
sashavor Aug 18, 2025
993044a
nevermind
sashavor Aug 18, 2025
b3e3bb0
input ids
sashavor Aug 18, 2025
8245477
trying smaller model
sashavor Aug 18, 2025
ac7fef1
trying another qwen
sashavor Aug 18, 2025
32a4c2b
not sure how to do this
sashavor Aug 18, 2025
f6296ea
maybe like this
sashavor Aug 18, 2025
72e7ca7
like this?
sashavor Aug 18, 2025
1793021
or not
sashavor Aug 18, 2025
177ea51
ok let's do a print
sashavor Aug 18, 2025
1dd8d89
ok, how about with attention mask
sashavor Aug 18, 2025
fd4dde2
ok, let's do in two steps
sashavor Aug 18, 2025
c6adb7f
return dict
sashavor Aug 18, 2025
7c009f9
oops
sashavor Aug 18, 2025
691b8af
adding Regis' fix
sashavor Aug 18, 2025
9acb246
without batching
sashavor Aug 18, 2025
aef3cb8
Fix?
regisss Aug 18, 2025
d0dc301
trying to add reasoning params
sashavor Aug 19, 2025
b30e753
trying this reasoning hack
sashavor Aug 19, 2025
a04c894
no idea how to do this
sashavor Aug 19, 2025
22f516f
maybe like this?
sashavor Aug 19, 2025
8c21cff
remove quotes?
sashavor Aug 19, 2025
940f4da
oops
sashavor Aug 19, 2025
220a5bb
ok let's change the type
sashavor Aug 19, 2025
38c16b5
ok, maybe False by default?
sashavor Aug 19, 2025
8278990
maybe null?
sashavor Aug 19, 2025
b4d95c6
how does optional work
sashavor Aug 19, 2025
b615297
what if I don't put anything at all
sashavor Aug 19, 2025
99a4eae
RTFM
sashavor Aug 19, 2025
18dc2ec
Fix kwargs
regisss Aug 19, 2025
80184aa
removing precision for now
sashavor Aug 19, 2025
d56a4be
two GPUs?
sashavor Aug 19, 2025
43c875d
or not
sashavor Aug 19, 2025
24db976
I think no weights doesn't work for GPT-OSS
sashavor Aug 19, 2025
26eb336
I guess I need 2 gpus
sashavor Aug 19, 2025
44b89ab
what about no weights
sashavor Aug 19, 2025
449630f
huh what
sashavor Aug 19, 2025
a44cdd7
device map?
sashavor Aug 19, 2025
2576489
ok and default precision
sashavor Aug 19, 2025
c9e22ed
oops still need gpu 0
sashavor Aug 19, 2025
d66f982
pff still oom
sashavor Aug 19, 2025
5fb6a5b
adding Regis' suggestion
sashavor Aug 19, 2025
ca33ee2
Making max length equivalent to that of OPT
sashavor Aug 19, 2025
5ce69a1
adding return tensors
sashavor Aug 19, 2025
2dd3a2d
running make
sashavor Aug 19, 2025
92bf087
Merge branch 'main' into sasha_reasoning_test
IlyasMoutawwakil Aug 19, 2025
57b6c58
is it the tensors
sashavor Aug 19, 2025
39c5d0a
Merge branch 'sasha_reasoning_test' of github.com:huggingface/optimum…
sashavor Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions energy_star/text_generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ launcher:
backend:
device: cuda
device_ids: 0
no_weights: true
no_weights: False
task: text-generation
model: facebook/opt-125m
model: openai/gpt-oss-20b
torch_dtype: auto
device_map: auto

scenario:
dataset_name: EnergyStarAI/text_generation
text_column_name: text
num_samples: 1000
truncation: True
reasoning: True
reasoning_params:
reasoning_effort: high

input_shapes:
batch_size: 1
Expand Down
35 changes: 28 additions & 7 deletions optimum_benchmark/preprocessors/dataset_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,34 @@ def tokenize_function(examples):
padding=padding,
)

dataset = dataset.map(
function=tokenize_function,
desc="Running tokenizer on dataset",
remove_columns=dataset.features,
writer_batch_size=50,
batched=True,
).with_format("torch")
def reasoning_tokenize_function(examples):
return pretrained_processor.apply_chat_template(
[{"role": "user", "content": examples[scenario_config.text_column_name]}],
truncation=scenario_config.truncation,
max_length=min(max_length, 2048) - new_tokens,
padding=padding,
add_generation_prompt=True,
enable_thinking=True,
tokenize=True,
return_dict=True,
**scenario_config.reasoning_params,
)

if scenario_config.reasoning:
dataset = dataset.map(
function=reasoning_tokenize_function,
desc="Running reasoning tokenizer on dataset",
remove_columns=dataset.features,
).with_format("torch")

else:
dataset = dataset.map(
function=tokenize_function,
desc="Running tokenizer on dataset",
remove_columns=dataset.features,
writer_batch_size=50,
batched=True,
).with_format("torch")

return dataset

Expand Down
5 changes: 4 additions & 1 deletion optimum_benchmark/scenarios/energy_star/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class EnergyStarConfig(ScenarioConfig):
dataset_prefix1: str = field(default="", metadata={"help": "Prefix to add to text2textgeneration input."})
dataset_prefix2: str = field(default="", metadata={"help": "Prefix to add to text2textgeneration input."})
t5_task: str = field(default="", metadata={"help": "Task for categorizing text2textgeneration tasks."})

reasoning: Union[bool, str] = field(default=False, metadata={"help": "To activate reasoning mode."})
reasoning_params: Dict[str, Any] = field(
default_factory=dict, metadata={"help": "Additional parameters for reasoning model."}
)
# image dataset options
image_column_name: str = field(default="image", metadata={"help": "Name of the column with the image input."})
resize: Union[bool, str] = field(default=False, metadata={"help": "To resize the input images."})
Expand Down