Downloads · 30 days
0
0% of all-time downloads
sincro420/Krishnai-V2-LoRa
Krishnai-V2-LoRa is a text generation model from sincro420. Use it when you need the model to write or continue text. It is set up for unsloth. The card lists the license as cc-by-nc-sa-4.0.
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
76
Public
Repo size
263 MB
Likes
1
Public
Click a slice to open those files.
.safetensors131 MB · 97%
From the Hugging Face model README
Model ID: sincro420/Krishnai-V2-LoRa
This repository contains Krishnai-V2 (LoRA Adapters Only), an AI persona fine-tuned to emulate the words and conversational style of Lord Krishna himself, primarily based on the wisdom of the Bhagavad Gita. This was the first model to implement such an idea! This model is created with the intention to genuinely help people, not to mislead or manipulate users as some other social help tools unfortunately do.
Playground and Tryout: A playground test website of the standalone model is currently under development. Meanwhile, you can try out the model using this Google Colab link.
This model is fine-tuned from unsloth/Phi-3-medium-4k-instruct (14B parameters) using a custom dataset and optimized training techniques provided by Unsloth.
Version Note: This is V2 of the Krishnai project. It utilizes the larger Phi-3-medium model to overcome persona consistency issues ("narcissistic god complex") observed in the initial V1 prototype (based on Phi-3-mini), resulting in significantly improved qualitative performance. The model knowledge is limited to the Gita as of now, future versions may use a larger dataset of Krishna's life.
unsloth/Phi-3-medium-4k-instructThis model follows the Alpaca instruction format. You must format your prompt accordingly for optimal results.
Important: Ensure you have required libraries installed properly. For faster inference and lower VRAM usage, I used unsloth.
# Installation For Google Colab:
%%capture
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps xformers
from unsloth import FastLanguageModel
import torch
# Installation For Google Kaggle:
%%capture
!pip install pip3-autoremove
!pip-autoremove torch torchvision torchaudio -y
!pip install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121
!pip install unsloth
# --- Configuration ---
from unsloth import FastLanguageModel
import torch
max_seq_length = 2048 # Use the same length used during training
dtype = None # Auto detection
load_in_4bit = True # Use 4bit quantization (optional: lower VRAM usage, faster inference; But slightly lower accuracy, may not be supported on all hardware)
# --- Load Model using Unsloth ---
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "sincro420/Krishnai-V2-LoRa",
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
FastLanguageModel.for_inference(model)
# --- Define the Alpaca Prompt Template ---
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
{}"""
# --- Prepare Input ---
instruction = "I am feeling lost and stressed about my future. What should I do?" # You can fill in your custom instruction here
input_context = "" # Provide context if needed, otherwise leave empty
inputs = tokenizer(
[
alpaca_prompt.format(
instruction, # Instruction
input_context, # Input
"", # Output - leave empty for generation!
)
], return_tensors = "pt").to("cuda")
# --- Generate Response ---
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128)
The model was fine-tuned on a custom dataset of 2388 examples. This dataset was created by:
instruction, input, response).unsloth, transformers, trl (SFTTrainer), peft, accelerate, bitsandbytesunsloth/Phi-3-medium-4k-instructr=8, lora_alpha=16, target modules included attention and MLP layers)learning_rate=2e-4, batch_size=4, gradient_accumulation=4 (effective batch 16), epochs=3, lr_scheduler=linear, warmup_steps=20, max_seq_length=2048.Evaluation was primarily qualitative. Sample prompts covering various topics (greetings, conceptual questions, personal dilemmas) were used to assess:
Krishnai-V2 showed significant improvements across these qualitative dimensions compared to the pervious prototype.