Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeuronORPOTrainer #719

Merged
merged 12 commits into from
Nov 4, 2024
25 changes: 10 additions & 15 deletions benchmark/text-generation-inference/performance/generate_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os

import pandas as pd

from guidellm.core import GuidanceReport, TextGenerationBenchmark


Expand All @@ -16,11 +15,7 @@ def _benchmark_rate_id(benchmark: TextGenerationBenchmark) -> str:
:return: A string representing the benchmark rate ID.
:rtype: str
"""
rate_id = (
f"{benchmark.mode}@{benchmark.rate:.2f} req/sec"
if benchmark.rate
else f"{benchmark.mode}"
)
rate_id = f"{benchmark.mode}@{benchmark.rate:.2f} req/sec" if benchmark.rate else f"{benchmark.mode}"
return rate_id


Expand All @@ -38,20 +33,20 @@ def main():
for path in paths:
filename = os.path.basename(path)
# Extract model_id
model_id, date = filename.replace(suffix, '').split('#')
model_id, date = filename.replace(suffix, "").split("#")
with open(path) as f:
report = GuidanceReport.from_json(f.read())
for benchmark in report.benchmarks:
for b in benchmark.benchmarks_sorted:
d = {
"model_id": model_id,
"Date": date,
"Input type": _benchmark_rate_id(b),
"Requests per Second": b.completed_request_rate,
"Request Latency (s)": b.request_latency,
"Time-to-first-token (ms)": b.time_to_first_token,
"Inter Token Latency (ms)": b.inter_token_latency,
"Output Token Throughput (t/s)": b.output_token_throughput,
"model_id": model_id,
"Date": date,
"Input type": _benchmark_rate_id(b),
"Requests per Second": b.completed_request_rate,
"Request Latency (s)": b.request_latency,
"Time-to-first-token (ms)": b.time_to_first_token,
"Inter Token Latency (ms)": b.inter_token_latency,
"Output Token Throughput (t/s)": b.output_token_throughput,
}
results.append(pd.DataFrame.from_dict(d, orient="index").transpose())

Expand Down
8 changes: 4 additions & 4 deletions optimum/neuron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

_import_structure = {
"hf_argparser": ["NeuronHfArgumentParser"],
"trainers": ["NeuronTrainer", "Seq2SeqNeuronTrainer", "NeuronSFTTrainer"],
"trainers": ["NeuronTrainer", "Seq2SeqNeuronTrainer", "NeuronSFTTrainer", "NeuronORPOTrainer"],
"training_args": ["NeuronTrainingArguments", "Seq2SeqNeuronTrainingArguments"],
"modeling_traced": ["NeuronTracedModel"],
"modeling": [
Expand Down Expand Up @@ -69,7 +69,7 @@
"ModelParallelismPlugin",
],
"pipelines": ["pipeline"],
"utils": ["NeuronSFTConfig", "get_peft_model"],
"utils": ["NeuronSFTConfig", "NeuronORPOConfig", "get_peft_model"],
}

if TYPE_CHECKING:
Expand Down Expand Up @@ -109,9 +109,9 @@
from .modeling_seq2seq import NeuronModelForSeq2SeqLM
from .modeling_traced import NeuronTracedModel
from .pipelines import pipeline
from .trainers import NeuronSFTTrainer, NeuronTrainer, Seq2SeqNeuronTrainer
from .trainers import NeuronORPOTrainer, NeuronSFTTrainer, NeuronTrainer, Seq2SeqNeuronTrainer
from .training_args import NeuronTrainingArguments, Seq2SeqNeuronTrainingArguments
from .utils import NeuronSFTConfig, get_peft_model
from .utils import NeuronORPOConfig, NeuronSFTConfig, get_peft_model

else:
import sys
Expand Down
Loading
Loading