Instructions to use peikoff/objectivist-phi4-mini-CP-SFT-merge with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use peikoff/objectivist-phi4-mini-CP-SFT-merge with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="peikoff/objectivist-phi4-mini-CP-SFT-merge", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("peikoff/objectivist-phi4-mini-CP-SFT-merge", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("peikoff/objectivist-phi4-mini-CP-SFT-merge", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use peikoff/objectivist-phi4-mini-CP-SFT-merge with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "peikoff/objectivist-phi4-mini-CP-SFT-merge" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "peikoff/objectivist-phi4-mini-CP-SFT-merge", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/peikoff/objectivist-phi4-mini-CP-SFT-merge
- SGLang
How to use peikoff/objectivist-phi4-mini-CP-SFT-merge 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 "peikoff/objectivist-phi4-mini-CP-SFT-merge" \ --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": "peikoff/objectivist-phi4-mini-CP-SFT-merge", "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 "peikoff/objectivist-phi4-mini-CP-SFT-merge" \ --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": "peikoff/objectivist-phi4-mini-CP-SFT-merge", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use peikoff/objectivist-phi4-mini-CP-SFT-merge with Docker Model Runner:
docker model run hf.co/peikoff/objectivist-phi4-mini-CP-SFT-merge
objectivist-phi4-mini-CP-SFT-merge
A Phi-4-mini model fine-tuned on Objectivist texts, in two stages (continued pretraining, then supervised fine-tuning) using LoRA adapters that were merged into the base weights. Made to be shared with the Objectivist community for fun.
Quantized GGUF versions: peikoff/objectivist-phi4-CP-SFT-merge-GGUF
Model details
| Field | Value |
|---|---|
| Base model | microsoft/Phi-4-mini-instruct [TODO: confirm this is the exact model you started from; your upload script flagged it as an assumption] |
| Architecture | Phi3ForCausalLM (from config.json) |
| Layers / hidden size | 32 / 3072 |
| Vocabulary | 200,064 tokens |
| Weights | fp16 safetensors, 4 shards |
| Context length in config | 131,072 (max_position_embeddings); fine-tuning sequence length: [TODO] |
| Language | English |
Training
Two-stage fine-tune using adapters, merged into the base weights:
- Continued pretraining (CP): next-token training on raw Objectivist texts.
- Supervised fine-tuning (SFT): question/answer pairs.
Training data (closed source; not included in this repo):
- about 650 full-text Objectivist articles from ARI, the Prometheus Foundation, and OSI
- Ayn Rand's nonfiction books
- 200 trivia questions from WhoNeeds.it
- biographical data of Objectivists from the WhoNeeds.it D1 database
Intended use
Question answering and discussion about Objectivism, shared with the Objectivist community for fun. Not for authoritative scholarship or any high-stakes use.
Evaluation
Subjectively evaluated with prompts. No benchmark or held-out evaluation has been run.
Limitations
- Small model; it can produce fluent but incorrect statements, including invented quotes, citations, and biographical details. Verify against primary sources.
- Trained on a single-tradition corpus and reflects that tradition's framing.
- Quantized versions are weaker than this fp16 merge (see the GGUF card).
How to use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
repo = "peikoff/objectivist-phi4-mini-CP-SFT-merge"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "What is an axiom in Objectivism?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True,
return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=256, do_sample=True, temperature=0.7)
print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
Note: the config.json in this repo contains an auto_map entry pointing to custom code files (configuration_phi3.py, modeling_phi3.py) that are not in this repo. If loading fails on that, try the installed transformers Phi-3 classes or remove the auto_map block. I have not tested loading.
License
All rights reserved.
- Downloads last month
- 27