Downloads · 30 days
0
0% of all-time downloads
ntedeschi/reconcile_the_irreconcilable
reconcile_the_irreconcilable is a machine learning model from ntedeschi. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model tries to reconcile the views of Hegel and Ayn Rand on a given philosophical topic.
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
3
Public
Repo size
3.7 GB
Likes
0
Public
Click a slice to open those files.
.bin19.7 MB · 100%
From the Hugging Face model README
This model tries to reconcile the views of Hegel and Ayn Rand on a given philosophical topic.
The purpose of the model is to give the views of Hegel and Ayn Rand on a given philosophical topic. Then it is supposed to write a paragraph reconciling their (most likely contrary) views. The model was multitasked fine-tuned on bloomz-3b. Data for the fine-tuning was generated using chatGPT GPT-4.
I am not sure how to get the model to work on this site. So, annoyingly, you need to cut and paste the following code into a notebook.
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
peft_model_id = "ntedeschi/reconcile_the_irreconcilable"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=False, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)
from IPython.display import display, Markdown
def make_inference(topic):
batch = tokenizer(
f"### INSTRUCTION\nBelow is a philosophy topic. Please write Hegel's view on the topic, Ayn Rand's view \
on the topic and a reconciliation of their views. \
\n\n### Topic:\n{topic}\n \
\n\n### Hegel:\n \
\n\n### Ayn Rand:\n \
\n\n### Reconciliation:\n",
return_tensors='pt'
)
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=512)
display(Markdown((tokenizer.decode(output_tokens[0], skip_special_tokens=True))))
philosophy_topic = "Mind body dualism"
make_inference(philosophy_topic)