Skip to content

Commit

Permalink
fix csv logger
Browse files Browse the repository at this point in the history
  • Loading branch information
uvafan committed Apr 24, 2020
1 parent fa059fb commit e5210e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/run_attack_args_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ def parse_logger_from_args(args):# Create logger
# CSV
if args.enable_csv:
outfile_name = 'attack-{}.csv'.format(out_time)
plain = args.enable_csv == 'plain'
color_method = None if args.enable_csv == 'plain' else 'file'
csv_path = os.path.join(args.out_dir, outfile_name)
attack_logger.add_output_csv(csv_path, plain)
attack_logger.add_output_csv(csv_path, color_method)
print('Logging to CSV at path {}.'.format(csv_path))

# Visdom
Expand Down
4 changes: 2 additions & 2 deletions textattack/loggers/attack_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def enable_visdom(self):
def add_output_file(self, filename):
self.loggers.append(FileLogger(filename=filename))

def add_output_csv(self, filename, plain):
self.loggers.append(CSVLogger(filename=filename, plain=plain))
def add_output_csv(self, filename, color_method):
self.loggers.append(CSVLogger(filename=filename, color_method=color_method))

def log_result(self, result):
self.results.append(result)
Expand Down

0 comments on commit e5210e9

Please sign in to comment.