Skip to content

Commit

Permalink
[WIP] Unit test with fixed random seed (deepjavalibrary#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
KexinFeng authored and KexinFeng committed Aug 16, 2023
1 parent f741bdd commit 0986a16
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions engines/python/setup/djl_python/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,14 @@ def test_sampling_scheduler(self):

results = scheduler.collect_results()

# assert tokenizer.decode(results[1][:30]) == "When your legs don't work like they used to before And I can't " \
# "sweep you off your feet, you're right, I'm done for the"
assert tokenizer.decode(results[2][:30]) == "There's a time that I remember, when I did not know what to do " \
"with my life. I was in a very bad mood. I was"
# assert tokenizer.decode(results[0][:30]) == "Memories follow me left and right. I can't help but feel that " \
# "I've been given a chance to do something different. I've been told"

for i, ret in results.items():
print('\n{}:'.format(i), tokenizer.decode(ret))
assert tokenizer.decode(results[0][:30]) == "Memories follow me left and right. I can't remember the last " \
"time I had to do this, and I'm glad that I did.\n"
assert tokenizer.decode(
results[1][:30]
) == """When your legs don't work like they used to before And I can't sweep you off your face" one female announced... " Everyone seems"""
assert tokenizer.decode(
results[2][:30]
) == "There's a time that I remember, when I did not know what to do with my life. I was in a very bad mood. I was"

def test_contrastive_scheduler(self):
model_id = "gpt2"
Expand Down

0 comments on commit 0986a16

Please sign in to comment.