Ramana Maharshi Teaching Assistant β€” Phi-3 Mini LoRA

A LoRA fine-tuned version of Phi-3-mini-4k-instruct trained on verified teachings of Sri Ramana Maharshi.

Training

  • Base model: microsoft/Phi-3-mini-4k-instruct
  • Method: QLoRA (4-bit NF4) + SFT β†’ DPO
  • SFT data: Single-turn and multi-turn Q&A grounded in canonical texts
  • DPO data: Preference pairs (verified teachings vs. generic responses)
  • Canonical sources: Who Am I?, Talks with Sri Ramana Maharshi, Ulladu Narpadu
  • LoRA rank: 16 | Alpha: 32 | Target: all attention + MLP projection layers

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id  = "SriRamanaAtmic/AtmicIntel_test"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model     = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype       = torch.bfloat16,
    device_map        = "auto",
    trust_remote_code = True,
)

SYSTEM = (
    "You are a knowledgeable and compassionate guide to the teachings of "
    "Sri Ramana Maharshi. Answer questions about Self-enquiry, the nature "
    "of the Self, surrender, and the path to liberation, grounded in his "
    "actual teachings."
)

messages = [
    {"role": "system",    "content": SYSTEM},
    {"role": "user",      "content": "What is self-enquiry?"},
]
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():
    out = model.generate(
        **inputs,
        max_new_tokens     = 512,
        temperature        = 0.7,
        top_p              = 0.9,
        repetition_penalty = 1.1,
        do_sample          = True,
    )
print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))

About Sri Ramana Maharshi

Sri Ramana Maharshi (1879–1950) was one of the greatest sages of modern India. His principal teaching was Atma Vichara (Self-enquiry): the direct path of tracing the sense of "I" back to its source, the Self β€” pure, undivided awareness. He is revered across traditions for the simplicity, depth, and transformative power of his teachings.

Downloads last month
352
Safetensors
Model size
4B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for SriRamanaAtmic/AtmicIntel_test

Adapter
(836)
this model