Downloads · 30 days
17
31% of all-time downloads
AventIQ-AI/gpt2-lmheadmodel-next-line-prediction-model
gpt2-lmheadmodel-next-line-prediction-model is a machine learning model from AventIQ-AI. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
from transformers import AutoTokenizer, AutoModelForCausalLM import torch
Downloads · 30 days
17
31% of all-time downloads
All-time downloads
55
Public
Parameters
124M
498 MB on disk
Likes
4
Public
Click a slice to open those files.
.safetensors498 MB · 100%
From the Hugging Face model README
from transformers import AutoTokenizer, AutoModelForCausalLM import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
model_name = "AventIQ-AI/gpt2-lmheadmodel-next-line-prediction-model" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
import html
sample_text = "Artificial intelligence is transforming"
inputs = tokenizer(sample_text, return_tensors="pt").to(device)
with torch.no_grad(): output_tokens = model.generate( **inputs, max_length=50, num_beams=5, repetition_penalty=1.5, temperature=0.7, top_k=50, top_p=0.9, do_sample=True, no_repeat_ngram_size=2, num_return_sequences=1, early_stopping=True, length_penalty=1.0, pad_token_id=tokenizer.eos_token_id, eos_token_id=tokenizer.eos_token_id, return_dict_in_generate=True, output_scores=True )
generated_response = tokenizer.decode(output_tokens.sequences[0], skip_special_tokens=True) cleaned_response = html.unescape(generated_response).replace("#39;", "'").replace("quot;", '"')
print("\nGenerated Response:\n", cleaned_response)
This repository hosts a fine-tuned GPT-2 model optimized for next-line prediction tasks. The model has been fine-tuned on the OpenWebText dataset and quantized in FP16 format to enhance efficiency without compromising performance.
stas/openwebtext-10k)Perplexity Score: 14.355693817138672
pip install transformers torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
model_name = "AventIQ-AI/gpt2-lmheadmodel-next-line-prediction-model"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
.
├── model/ # Contains the quantized model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── model.safetensors/ # Quantized Model
├── README.md # Model documentation
Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.