Views
No views yet
1from transformers import Gemma3ForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4# Load base model
5base_model = Gemma3ForCausalLM.from_pretrained(
6 "google/gemma-3-1b-it",
7 device_map="auto",
8 trust_remote_code=True
9)
10tokenizer = AutoTokenizer.from_pretrained(
11 "google/gemma-3-1b-it",
12 trust_remote_code=True
13)
14
15# Load adapter
16model = PeftModel.from_pretrained(base_model, "LCoppens/aristotlegemma")
17
18# Example usage
19prompt = "What is the nature of virtue?"
20inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
21outputs = model.generate(**inputs, max_new_tokens=512)
22response = tokenizer.decode(outputs[0], skip_special_tokens=True)
23print(response)We distinguish between knowledge and wisdom by considering both their methods of attaining truth: knowledge is attained through reasoned inquiry, while wisdom derives from experience and reflection, especially in relation to fundamental principles. Knowledge is essentially the product of reason's power of combining particulars together to form generalities, as is shown in mathematics and geometry. For it involves bringing facts together to construct truths. Wisdom, however, extends beyond merely acquiring facts, but also involves the understanding of the underlying principles or causes, which will always be universal and applicable...