Fix TypeError: Object of type int64 is not JSON serializable (#24340)
* Fix TypeError: Object of type int64 is not JSON serializable * Convert numpy.float64 and numpy.int64 to float and int for json serialization * Black reformatted examples/pytorch/token-classification/run_ner_no_trainer.py * * make style
This commit is contained in:
@@ -647,7 +647,7 @@ class GenerationIntegrationTestsMixin:
|
||||
generated_tokens = model.generate(**tokens, eos_token_id=eos_token_id, **generation_kwargs)
|
||||
unpadded_correct_condition = expectation == len(generated_tokens[0])
|
||||
padded_correct_condition = expectation < len(generated_tokens[0]) and all(
|
||||
[token == model.config.pad_token_id for token in generated_tokens[0][expectation:]]
|
||||
token == model.config.pad_token_id for token in generated_tokens[0][expectation:]
|
||||
)
|
||||
self.assertTrue(unpadded_correct_condition or padded_correct_condition)
|
||||
|
||||
@@ -655,7 +655,7 @@ class GenerationIntegrationTestsMixin:
|
||||
generated_tokens = model.generate(**tokens, eos_token_id=eos_token_id, **generation_kwargs)
|
||||
unpadded_correct_condition = expectation == len(generated_tokens[0])
|
||||
padded_correct_condition = expectation < len(generated_tokens[0]) and all(
|
||||
[token == model.config.pad_token_id for token in generated_tokens[0][expectation:]]
|
||||
token == model.config.pad_token_id for token in generated_tokens[0][expectation:]
|
||||
)
|
||||
self.assertTrue(unpadded_correct_condition or padded_correct_condition)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user