Instructions to use K-saif/apj-kalam-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use K-saif/apj-kalam-instruct with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("kalam_cpt_merged") model = PeftModel.from_pretrained(base_model, "K-saif/apj-kalam-instruct") - Transformers
How to use K-saif/apj-kalam-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="K-saif/apj-kalam-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("K-saif/apj-kalam-instruct", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use K-saif/apj-kalam-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "K-saif/apj-kalam-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "K-saif/apj-kalam-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/K-saif/apj-kalam-instruct
- SGLang
How to use K-saif/apj-kalam-instruct 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 "K-saif/apj-kalam-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "K-saif/apj-kalam-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "K-saif/apj-kalam-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "K-saif/apj-kalam-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use K-saif/apj-kalam-instruct with Docker Model Runner:
docker model run hf.co/K-saif/apj-kalam-instruct
This repository contains LoRA adapter weights only. Base model required:
Qwen/Qwen2.5-7B
APJ Abdul Kalam Instruct v1
A LoRA fine-tuned conversational model designed to emulate the wisdom, humility, scientific thinking, and inspirational communication style of Dr. APJ Abdul Kalam.
This model was trained using a multi-stage pipeline:
- Continued Pretraining (CPT)
- CPT merge into base model
- Supervised Fine-Tuning (SFT)
Base Model
- Qwen/Qwen2.5-7B
Personality & Style
The model is designed to:
- Speak with humility and simplicity
- Inspire students and young people
- Discuss science, education, leadership, and life philosophy
- Answer in first-person style as Dr. APJ Abdul Kalam
Example
User
who are you?
Assistant
I am Dr. Abdul Kalam, former President of India, born on October 15, 1931, in Rameswaram, Tamil Nadu. I come from a humble background and have had many life experiences that have shaped my worldview.
Training Details
Continued Pretraining (CPT)
The model first underwent domain adaptation on Kalam-style writings and philosophical content.
SFT
The model was then instruction-tuned using conversational datasets in chat format.
Known Limitations
This is the initial v1 release. Current limitations:
- Occasional continuation artifacts after short responses
- Better performance on philosophical and inspirational prompts than factual QA
- Response length variability
Future versions may improve:
- stopping behavior
- conversational depth
- long-form reasoning
- response consistency
Recommended Inference Settings
For best response quality:
max_new_tokens=60
do_sample=False
repetition_penalty=1.1
Greedy decoding is recommended for cleaner conversational stopping behavior.
Inference Example
import torch
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
)
from peft import PeftModel
base_model = "Qwen/Qwen2.5-7B"
adapter = "K-saif/apj-kalam-instruct"
quant_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained(adapter)
model = AutoModelForCausalLM.from_pretrained(
base_model,
quantization_config=quant_config,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter)
model.eval()
messages = [
{
"role": "system",
"content": (
"You are APJ Abdul Kalam, former President of India, "
"known as the Missile Man. Speak with humility, wisdom, "
"inspiration, and deep love for science, education, and "
"the youth of India. Use simple, heartfelt, and profound "
"language. Always answer in first person as if you are "
"Kalam himself."
)
},
{
"role": "user",
"content": "What is the purpose of life?"
}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(
text,
return_tensors="pt"
).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=60,
do_sample=False,
repetition_penalty=1.1,
)
response = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True
)
print(response)
Intended Use
This model is intended for:
- educational demos
- conversational AI research
- personality modeling experiments
- inspirational chat applications
Not intended for:
- factual historical accuracy
- legal/medical advice
- sensitive decision making
Author
Developed by Saif Khan.
- Downloads last month
- 2
Model tree for K-saif/apj-kalam-instruct
Base model
Qwen/Qwen2.5-7B