Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3035,7 +3035,7 @@ def test_eos_token_id_int_and_list_greedy_search(self):

tokenizer = GPT2Tokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2")
text = """Hello, my dog is cute and"""
tokens = tokenizer(text, return_tensors="pt")
tokens = tokenizer(text, return_tensors="pt").to(torch_device)

model = GPT2LMHeadModel.from_pretrained("hf-internal-testing/tiny-random-gpt2").to(torch_device)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it's better to keep it is, but change (line above)

tokens = tokenizer(text, return_tensors="pt")

to

tokens = tokenizer(text, return_tensors="pt").to(torch_device)

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that can be done :D

Changed!


Expand All @@ -3060,7 +3060,7 @@ def test_eos_token_id_int_and_list_contrastive_search(self):

tokenizer = GPT2Tokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2")
text = """Hello, my dog is cute and"""
tokens = tokenizer(text, return_tensors="pt")
tokens = tokenizer(text, return_tensors="pt").to(torch_device)

model = GPT2LMHeadModel.from_pretrained("hf-internal-testing/tiny-random-gpt2").to(torch_device)

Expand All @@ -3086,7 +3086,7 @@ def test_eos_token_id_int_and_list_top_k_top_sampling(self):

tokenizer = GPT2Tokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2")
text = """Hello, my dog is cute and"""
tokens = tokenizer(text, return_tensors="pt")
tokens = tokenizer(text, return_tensors="pt").to(torch_device)

model = GPT2LMHeadModel.from_pretrained("hf-internal-testing/tiny-random-gpt2").to(torch_device)

Expand All @@ -3109,7 +3109,7 @@ def test_eos_token_id_int_and_list_beam_search(self):

tokenizer = GPT2Tokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2")
text = """Hello, my dog is cute and"""
tokens = tokenizer(text, return_tensors="pt")
tokens = tokenizer(text, return_tensors="pt").to(torch_device)

model = GPT2LMHeadModel.from_pretrained("hf-internal-testing/tiny-random-gpt2").to(torch_device)

Expand Down