Skip to content

Commit

Permalink
Make parsers printable
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhangcs committed May 24, 2023
1 parent ab9ba00 commit 6f0f60b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions supar/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ def __init__(self, args, model, transform):
self.model = model
self.transform = transform

def __repr__(self):
s = f'{self.__class__.__name__}(\n'
s += '\n'.join([' '+i for i in str(self.model).split('\n')]) + '\n'
s += '\n'.join([' '+i for i in str(self.transform).split('\n')]) + '\n)'
return s

@property
def device(self):
return 'cuda' if torch.cuda.is_available() else 'cpu'
Expand Down

0 comments on commit 6f0f60b

Please sign in to comment.