Skip to content

Conversation

@gante
Copy link
Contributor

@gante gante commented Jan 4, 2023

@gante gante requested a review from ydshieh January 4, 2023 18:04
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jan 4, 2023

The documentation is not available anymore as the PR was closed or merged.

text = """Hello, my dog is cute and"""
tokens = tokenizer(text, return_tensors="pt")

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!

@gante gante requested a review from sgugger January 4, 2023 19:17
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes!

Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

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

King of generate! Thanks

@gante gante merged commit b910489 into huggingface:main Jan 4, 2023
silverriver pushed a commit to silverriver/transformers that referenced this pull request Jan 6, 2023
@gante gante deleted the 20727_fix branch May 18, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants