Skip to content

Perplexity llm #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

adityasingh-0803
Copy link

code initializes the GPT-2 model and tokenizer, sets up the device for processing (GPU if available), encodes an input prompt ("Hi."), generates a text response using the model, and then decodes the output back to human-readable text for display.

We wrote a Python script to calculate the perplexity of a sentence using the GPT-2 model from the Hugging Face Transformers library. The script imports necessary libraries, loads the model and tokenizer, and defines a function that tokenizes input text, computes the model's loss, and derives perplexity from that loss. We tested the function with an example sentence, outputting a perplexity value that indicates how predictable the model finds the text. This process helps evaluate the model's understanding of language based on its training.
code initializes the GPT-2 model and tokenizer, sets up the device for processing (GPU if available), encodes an input prompt ("Hi."), generates a text response using the model, and then decodes the output back to human-readable text for display.
@adityasingh-0803
Copy link
Author

@tarun-aiplanet please check now

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.

1 participant