Gpt2-Wikitext-9180

Gpt2-Wikitext-9180, fine-tuned from GPT-2, is a Transformer-based language model trained on a large English corpus (WikiText) using self-supervised learning. This means it was trained on raw, unlabeled text data, using an automated process to create inputs and labels by predicting the next word in a sentence. No manual annotation was involved, allowing the model to leverage a vast amount of publicly available data.

Demo Inference

pip install transformers
import torch
from transformers import GPT2LMHeadModel, GPT2Tokenizer

# Loading pre-trained GPT-2 model and tokenizer
model_name = "prithivMLmods/Gpt2-Wikitext-9180"
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
model = GPT2LMHeadModel.from_pretrained(model_name)

# Set the model to evaluation mode
model.eval()
def generate_text(prompt, max_length=100, temperature=0.8, top_k=50):
    input_ids = tokenizer.encode(prompt, return_tensors="pt")
    output = model.generate(
        input_ids,
        max_length=max_length,
        temperature=temperature,
        top_k=top_k,
        pad_token_id=tokenizer.eos_token_id,
        do_sample=True
    )
    generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
    return generated_text
# Example prompt
prompt = "Once upon a time"
generated_text = generate_text(prompt, max_length=68)

# Print the generated text
print(generated_text)

Intended Use Case

  • Text Generation: Auto-completion, story generation, or dialogue simulation.
  • Language Modeling: Understanding language structure and context for downstream NLP tasks.
  • Educational and Research Use: Exploring fine-tuning techniques, language understanding, or benchmarking language models.
  • Prototyping: Quick deployment of language-based features in applications and interfaces.

Limitations

  • Factual Inaccuracy: May generate plausible-sounding but incorrect or outdated information.
  • Bias and Toxicity: Can reflect biases present in training data (e.g., stereotypes, offensive language).
  • Context Length: Limited context window inherited from GPT-2 architecture.
  • Not Real-Time Aware: Lacks access to current events or updates beyond its training data.
  • Lack of Understanding: Generates text based on patterns, not genuine comprehension or reasoning.
Downloads last month
15
Safetensors
Model size
124M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for prithivMLmods/Gpt2-Wikitext-9180

Finetuned
(1841)
this model
Quantizations
2 models

Dataset used to train prithivMLmods/Gpt2-Wikitext-9180