Raising an unknown error flag. Installed exactly as described on front page.
- tensorflow 2.3 or 2.0
- python 3.7.5
- Windows
Arises from either:
references = ['This is a test.', 'This is surely a test']
candidates = ['This is also a text', 'This could be a test']
checkpoint = 'C:/bleurt/bleurt/checkpoints/bleurt-tiny-512'
scorer = score.BleurtScorer(checkpoint)
scorer.score(references, candidates, batch_size = 2)
or
references = tf.constant(["This is a test."])
candidates = tf.constant(["This is the test."])
checkpoint = 'C:/bleurt/bleurt/checkpoints/bleurt-tiny-512'
scorer = score.BleurtScorer(checkpoint)
scorer.score(references, candidates, batch_size = 2)
Error:
UnrecognizedFlagError Traceback (most recent call last)
in
13
14 scorer = score.BleurtScorer(checkpoint)
---> 15 scorer.score(references, candidates, batch_size = 2)
16 # bleurt_out = scorer(references, candidates)
17 # # bleurt_ops = score.create_bleurt_ops()
c:\programdata\anaconda3\envs\context2\lib\site-packages\bleurt\score.py in score(self, references, candidates, batch_size)
178 batch_cand = candidates[i:i + batch_size]
179 input_ids, input_mask, segment_ids = encoding.encode_batch(
--> 180 batch_ref, batch_cand, self.tokenizer, self.max_seq_length)
181 tf_input = {
182 "input_ids": input_ids,
c:\programdata\anaconda3\envs\context2\lib\site-packages\bleurt\encoding.py in encode_batch(references, candidates, tokenizer, max_seq_length)
150 encoded_examples = []
151 for ref, cand in zip(references, candidates):
--> 152 triplet = encode_example(ref, cand, tokenizer, max_seq_length)
153 example = np.stack(triplet)
154 encoded_examples.append(example)
c:\programdata\anaconda3\envs\context2\lib\site-packages\bleurt\encoding.py in encode_example(reference, candidate, tokenizer, max_seq_length)
56 # Tokenizes, truncates and concatenates the sentences, as in:
57 # bert/run_classifier.py
---> 58 tokens_ref = tokenizer.tokenize(reference)
59 tokens_cand = tokenizer.tokenize(candidate)
60
c:\programdata\anaconda3\envs\context2\lib\site-packages\bleurt\lib\tokenization.py in tokenize(self, text)
144 def tokenize(self, text):
145 split_tokens = []
--> 146 for token in self.basic_tokenizer.tokenize(text):
147 if preserve_token(token, self.vocab):
148 split_tokens.append(token)
c:\programdata\anaconda3\envs\context2\lib\site-packages\bleurt\lib\tokenization.py in tokenize(self, text)
189 split_tokens = []
190 for token in orig_tokens:
--> 191 if preserve_token(token, self.vocab):
192 split_tokens.append(token)
193 continue
c:\programdata\anaconda3\envs\context2\lib\site-packages\bleurt\lib\tokenization.py in preserve_token(token, vocab)
43 def preserve_token(token, vocab):
44 """Returns True if the token should forgo tokenization and be preserved."""
---> 45 if not FLAGS.preserve_unused_tokens:
46 return False
47 if token not in vocab:
c:\programdata\anaconda3\envs\context2\lib\site-packages\tensorflow\python\platform\flags.py in getattr(self, name)
83 # a flag.
84 if not wrapped.is_parsed():
---> 85 wrapped(_sys.argv)
86 return wrapped.getattr(name)
87
c:\programdata\anaconda3\envs\context2\lib\site-packages\absl\flags_flagvalues.py in call(self, argv, known_only)
631 suggestions = _helpers.get_flag_suggestions(name, list(self))
632 raise _exceptions.UnrecognizedFlagError(
--> 633 name, value, suggestions=suggestions)
634
635 self.mark_as_parsed()
UnrecognizedFlagError: Unknown command line flag 'f'