Skip to content

Commit

Permalink
fix(transformer): change getattr to hasattr
Browse files Browse the repository at this point in the history
  • Loading branch information
xiong-ma committed May 10, 2020
1 parent 2370dd6 commit e5756b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jina/executors/encoders/nlp/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def post_init(self):
self.tmp_model_path = self.model_abspath if os.path.exists(self.model_abspath) else self.model_name
self._tokenizer = self.get_tokenizer()

self._has_cls_token = True if getattr(self._tokenizer, 'cls_token', None) is not None else False
self._has_cls_token = hasattr(self._tokenizer, 'cls_token')

self.cls_pos = 'tail' if self.model_name == 'xlnet-base-cased' else 'head'

Expand Down

0 comments on commit e5756b3

Please sign in to comment.