Skip to content

Commit

Permalink
better repr
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Aug 21, 2023
1 parent 74c0ab7 commit fd47b0d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions datasets_old_2022_10/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ class DatasetConfig:
globals().update(dataset.get_config_opts())
"""

def __repr__(self):
parts = []
if self.get_main_name():
parts.append(f"main_name={self.get_main_name()}")
ds = self.get_main_dataset()
else:
ds = self.get_train_dataset()
parts.insert(0, f"class={ds['class']}")
return f"<{self.__class__.__name__} {' '.join(parts)}>"

def get_extern_data(self) -> Dict[str, Dict[str]]:
"""
Get extern data
Expand Down Expand Up @@ -84,6 +94,9 @@ class VocabConfig:
See :func:`VocabConfigStatic.from_global_config` for a reasonable default.
"""

def __repr__(self):
return f"<{self.__class__.__name__} num_classes={self.get_num_classes()} eos_idx={self.get_eos_idx()}>"

def get_num_classes(self) -> int:
"""
Get num classes
Expand Down

0 comments on commit fd47b0d

Please sign in to comment.