BRM-v1-llama8b / README.md
runzou's picture
Update README.md
81e021d verified
---
pipeline_tag: text-generation
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/664afff2bd8e024bd42399fd/iSPfMRwuW-gnfntYjoEOW.png)
# BuddhismModel
BuddhismModel is a pioneering Large Language Model that seamlessly integrates technology with spiritual wisdom. As the first AI framework of its kind, it breathes new life into centuries-old Buddhist teachings with remarkable precision and authenticity.
Specifically designed for contemporary practitioners, this model delivers personalized spiritual guidance and ethical insights while nurturing mindfulness and empathy throughout each interaction. Through regular dharma discussions, it facilitates both individual spiritual development and communal well-being, creating a unique space where ancient wisdom meets modern technology.
## Model Description
The model is trained on Buddhist scriptures.
The full training set (dataset.json) contains 160,000 instructions generated from 77,000 Buddhist sayings.
- **Model type:** Llama-3-based Buddhist role-play model
- **Language(s):** English
- **Fine-tuned from model:** Meta-Llama-3-8B-Instruct
## Model Parameters
Initial parameters for our model using Base Meta-Llama-3-8B-Instruct are available for download in this repository.
It was trained on December 4, 2024, using A800.
[Rest of the code sections remain correct as they follow proper Python syntax]
## How to Get Started with the Model
```python
import transformers
import torch
from huggingface_hub import login
login(token="your_huggingface_access_token")
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "olmairesearch/olm-v1.0-8b"
tokenizer = AutoTokenizer.from_pretrained(model_name, token=True)
model = AutoModelForCausalLM.from_pretrained(
model_name, torch_dtype="auto", device_map="auto",token=True
)
def call_Buddhism(model, tokenizer, history, input_):
context = ""
for role, message in history:
context += f"{role}: {message}\n"
context += f"user: {input_}\nassistant:"
inputs = tokenizer(context, return_tensors="pt", truncation=True)
inputs = inputs.to("cuda" if torch.cuda.is_available() else "cpu")
outputs = model.generate(
**inputs,
max_new_tokens=256,
eos_token_id=tokenizer.eos_token_id,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
response = generated_text[len(context):].strip()
return response
history = [
("user", "What is the purpose of life?"),
("assistant", "The purpose of life is to seek inner peace and happiness.")
]
```
```
input_ = "How can I achieve inner peace?"
response = call_Buddhism(model, tokenizer, history, user_input)
print("Buddha:", response)
```
## Examples
```
input_: "How can I find happiness that lasts?"
output: "Happiness is not found in external things, but in the cultivation of your own mind. by letting go of attachments and desires, you can find a sense of peace and freedom."
input_: "What can I do for this?"
output: "You can start by letting go of attachments and desires. focus on the present moment and cultivate mindfulness."
input_: "how to cultivate mindfulness"
output: "mindfulness is the key to understanding the present moment. practice meditation and observe your thoughts and emotions without judgment."
input_: "meditation?"
output: "yes, meditation is a powerful tool to quiet the mind and connect with your true nature. but it's not just about sitting still, it's about cultivating mindfulness and compassion in every moment."
input_: "What should I think about when I sit quietly?"
output: "When you sit quietly, focus on your breath and let go of all thoughts and distractions. this will help you cultivate mindfulness and inner peace."
input_: "how many times should i spend on it?"
output: "It is not about the quantity of time, but the quality of attention. take a few moments each day to reflect on your thoughts and actions, and you will find that inner peace is always within reach."
```