Text Generation
Transformers
PyTorch
English
gpt
language-model
transformer
open-source
squad
wikipedia
Eval Results (legacy)
Instructions to use lemms/openllm-small-extended-6k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lemms/openllm-small-extended-6k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lemms/openllm-small-extended-6k")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("lemms/openllm-small-extended-6k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lemms/openllm-small-extended-6k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lemms/openllm-small-extended-6k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lemms/openllm-small-extended-6k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lemms/openllm-small-extended-6k
- SGLang
How to use lemms/openllm-small-extended-6k 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 "lemms/openllm-small-extended-6k" \ --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": "lemms/openllm-small-extended-6k", "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 "lemms/openllm-small-extended-6k" \ --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": "lemms/openllm-small-extended-6k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lemms/openllm-small-extended-6k with Docker Model Runner:
docker model run hf.co/lemms/openllm-small-extended-6k
metadata
language:
- en
license:
- gpl-3.0
- other
tags:
- text-generation
- language-model
- gpt
- transformer
- open-source
- squad
- wikipedia
datasets:
- squad
metrics:
- perplexity
- text-generation-quality
library_name: transformers
pipeline_tag: text-generation
model-index:
- name: OpenLLM Small Extended 6k
results:
- task:
type: text-generation
dataset:
type: squad
name: SQUAD Wikipedia Passages
metrics:
- type: perplexity
value: 816.04
- type: training_loss
value: 5.4302
OpenLLM Small Extended 6k
This is the OpenLLM Small Extended model trained for 6,000 steps on Wikipedia passages from the SQUAD dataset.
Model Details
- Model Type: GPT-style Transformer
- Architecture: Small (35.8M parameters)
- Training Steps: 6,000
- Training Data: ~41k Wikipedia passages from SQUAD dataset
- Tokenizer: SentencePiece BPE (32k vocabulary)
- License: GPL-3.0 (Open Source) / Commercial License available
Model Performance
- Final Training Loss: 5.4302
- Model Parameters: 35,823,616
- Context Length: 512 tokens
- Training Hardware: CPU/GPU compatible
Usage
Using Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load model and tokenizer
model_name = "lemms/openllm-small-extended-6k"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Generate text
prompt = "The history of artificial intelligence"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
inputs.input_ids,
max_new_tokens=50,
temperature=0.7,
top_k=40,
do_sample=True
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
Using the Custom Loader
# Use the provided load_hf_model.py script
from load_hf_model import load_model_and_tokenizer
model, tokenizer = load_model_and_tokenizer()
# ... rest of usage
Training Details
This model was trained using the OpenLLM training pipeline:
- Data Preparation: SQUAD dataset processing (~41k passages)
- Tokenizer Training: SentencePiece BPE with 32k vocabulary
- Model Training: GPT-style transformer for 6,000 steps
- Evaluation: Perplexity and text generation quality assessment
Model Architecture
- Layers: 12 transformer layers
- Attention Heads: 12
- Hidden Size: 768
- Intermediate Size: 3072
- Activation: GELU
- Layer Norm: Pre-norm
Limitations
- Training Data: Limited to Wikipedia passages
- Context Length: 512 tokens maximum
- Model Size: Small model with 35.8M parameters
- Performance: Basic text generation capabilities
License
This model is dual-licensed:
- Open Source: GPL-3.0 for research and community use
- Commercial: Commercial license available for enterprise use
For commercial licensing, contact: louischua@gmail.com
Citation
If you use this model in your research, please cite:
@misc{openllm2024,
title={OpenLLM: Open Source Large Language Model},
author={Louis Chua Bean Chong},
year={2024},
url={https://github.com/louischua/openllm}
}
Links
- Repository: https://github.com/louischua/openllm
- Documentation: https://github.com/louischua/openllm/docs
- Training Pipeline: https://github.com/louischua/openllm/docs/training_pipeline.md