Skip to content

Commit

Permalink
fix yapf check
Browse files Browse the repository at this point in the history
  • Loading branch information
xu-song committed Jul 9, 2024
1 parent e999025 commit a222889
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions xtuner/engine/hooks/dataset_info_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def __init__(self, tokenizer, is_intern_repo_dataset=False):
self.is_intern_repo_dataset = is_intern_repo_dataset

def log(self, runner, dataset, mode='train'):
def _log(input_ids, log_prefix=""):

def _log(input_ids, log_prefix=''):
if self.is_intern_repo_dataset:
input_ids = [abs(x) for x in input_ids]
# Try to split list to be compatible with IMAGE token
Expand All @@ -40,8 +41,8 @@ def _log(input_ids, log_prefix=""):
runner.logger.info(f'Num {mode} samples {len(dataset)}')
runner.logger.info(f'{mode} example:')
if 'chosen_ids' in dataset[0]:
_log(dataset[0]['chosen_ids'], log_prefix="chosen: ")
_log(dataset[0]['rejected_ids'], log_prefix="rejected: ")
_log(dataset[0]['chosen_ids'], log_prefix='chosen: ')
_log(dataset[0]['rejected_ids'], log_prefix='rejected: ')
else:
_log(dataset[0]['input_ids'])

Expand Down

0 comments on commit a222889

Please sign in to comment.