Downloads · 30 days
17
34% of all-time downloads
Amogh1221/PocketGPT_27M
PocketGPT_27M is a machine learning model from Amogh1221. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
pocketGPT-27M is a fully custom GPT-style language model, trained entirely from scratch using:
Downloads · 30 days
17
34% of all-time downloads
All-time downloads
50
Public
Parameters
27.1M
210 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors108 MB · 98%
From the Hugging Face model README
pocketGPT-27M is a fully custom GPT-style language model, trained entirely from scratch using:
This project demonstrates how a compact GPT model can be designed, trained, and deployed end-to-end without relying on any pretrained weights.
| Component | Value |
|---|---|
| Layers | 10 |
| Hidden size | 384 |
| Attention heads | 6 |
| FFN size | 1536 |
| Vocab size | 24,000 |
| Context length | 384 |
| Parameters | ~27–35M |
Not intended for production or safety-critical use.
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
import torch
import os
os.environ["HUGGINGFACE_HUB_TOKEN"] = "Your Tokens"
model = GPT2LMHeadModel.from_pretrained("Amogh1221/PocketGPT_27M")
tokenizer = GPT2TokenizerFast.from_pretrained("Amogh1221/PocketGPT_27M")
def ask(prompt):
formatted = f"<|bos|>Instruction: {prompt}\nResponse:"
inputs = tokenizer.encode(formatted, return_tensors="pt")
inputs = inputs.to(model.device)
with torch.no_grad():
outputs = model.generate(
inputs,
max_length=384,
do_sample=True,
top_p=0.9,
temperature=0.8,
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
ask("what is an Artificial Neural Network?")