Instructions to use Pavloria/mini-language-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Pavloria/mini-language-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Pavloria/mini-language-model")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Pavloria/mini-language-model") model = AutoModel.from_pretrained("Pavloria/mini-language-model") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Pavloria/mini-language-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Pavloria/mini-language-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pavloria/mini-language-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Pavloria/mini-language-model
- SGLang
How to use Pavloria/mini-language-model with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Pavloria/mini-language-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pavloria/mini-language-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Pavloria/mini-language-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pavloria/mini-language-model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Pavloria/mini-language-model with Docker Model Runner:
docker model run hf.co/Pavloria/mini-language-model
Mini Language Model
π§ Model Description
This is a toy decoder-only language model based on a TransformerDecoder architecture. It was trained from scratch on the Tiny Shakespeare dataset using PyTorch.
The goal was to explore autoregressive language modeling using minimal resources and libraries like torch.nn and transformers.
ποΈ Training Details
- Architecture: TransformerDecoder
- Tokenizer: GPT2Tokenizer from Hugging Face
- Vocabulary Size: 50257 (from GPT-2)
- Sequence Length: 64 tokens
- Batch Size: 8
- Epochs: 5
- Learning Rate: 1e-3
- Number of Parameters: ~900k
- Hardware: Trained on CPU (Google Colab)
π Evaluation
The model was evaluated on a 10% validation split. It shows consistent training and validation loss decrease, though it is not expected to produce coherent long text due to the small training size.
π Intended Use
This model is intended for educational purposes only. It is not suitable for production use.
π« Limitations
- Only trained on a tiny dataset
- Small architecture, limited capacity
- Limited ability to generalize or generate meaningful long text
π¬ Example Usage (Python)
python from transformers import GPT2Tokenizer from model import MiniDecoderModel # Assuming you restore the class
tokenizer = GPT2Tokenizer.from_pretrained("Pavloria/mini-language-model") model = MiniDecoderModel(...) # Load your config model.load_state_dict(torch.load("pytorch_model.bin"))
- Downloads last month
- 14