Skip to content

add token ips #1161

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
add some log
  • Loading branch information
pkhk-1 committed Mar 26, 2025
commit 42935f3fca6eee04380674da2d1e18d5cb356057
19 changes: 1 addition & 18 deletions paddlemix/trainer/benchmark_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def on_log(self, args, state, control, logs=None, **kwargs):
"""
record the infomation of a logging step.
"""
if self.benchmark_mode:
if self.benchmark_mode and "loss" in logs:
logs.update(self.state.get_result())
logs[self.ACC_SAMPLES] = state.trial_params[self.ACC_SAMPLES]
logs[self.ACC_TOKENS] = state.trial_params[self.ACC_TOKENS]
Expand All @@ -373,20 +373,3 @@ def on_log(self, args, state, control, logs=None, **kwargs):
max_mem_allocated_msg,
)
)

def _log(self, logs):
"""
record the information accurately and neatly.
"""
logs_str = []
logs_str = []
for k, v in logs.items():
if isinstance(v, float):
if abs(v) < 1e-3:
v = f"{v:e}"
elif abs(v) > 100:
v = f"{v:.04f}"
else:
v = f"{v:.06f}"
logs_str.append(f"{k}: {v}")
logger.info(", ".join(logs_str))
2 changes: 1 addition & 1 deletion paddlemix/trainer/llava_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def __init__(self, **kwargs):
# self.benchmark_callback = BenchmarkCallback(self, self.args.save_steps, skip_step=self.args.benchmark_skip_steps, self.args.benchmark)
self.benchmark_callback = BenchmarkCallback(
self,
self.args.max_steps if self.args.max_steps>1 else 1000,
self.args.max_steps if self.args.max_steps>1 else 10000,
1,
self.args.benchmark)
self.add_callback(self.benchmark_callback)
Expand Down