Views
No views yet



1{
2 "messages": [
3 {
4 "role": "system",
5 "content": "You are a helpful assistant specialized in Turkish legal matters."
6 },
7 {
8 "role": "user",
9 "content": "Question or task description"
10 },
11 {
12 "role": "assistant",
13 "content": "Response or answer"
14 }
15 ]
16}newmindai/EuroHPC-Legal (intellectual subset)1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3
4# Load base model and tokenizer
5base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
6tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
7
8# Load LoRA adapter
9model = PeftModel.from_pretrained(base_model, "newmindai/Llama-3.1-8B-Instruct-intellectual-chat-template")
10
11# Use chat template for formatting
12messages = [
13 {"role": "system", "content": "You are a helpful assistant specialized in Turkish legal matters."},
14 {"role": "user", "content": "Explain the benefits of regular exercise"}
15]
16
17# Apply chat template
18tokenizer.chat_template = tokenizer.default_chat_template
19prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
20
21# Example usage
22inputs = tokenizer(prompt, return_tensors="pt")
23outputs = model.generate(**inputs, max_new_tokens=256)
24response = tokenizer.decode(outputs[0], skip_special_tokens=True)1@article{newmind2025,
2 title={Tailoring AI for Turkish Law: Domain-Specific Fine-Tuning of Small Language Models for Legal Expertise},
3 author={New Mind AI Team},
4 journal={Procedia Computer Science},
5 year={2025},
6 volume={239},
7 doi={10.1016/j.procs.2025.08.239},
8 note={Available online 23 September 2025, Version of Record 23 September 2025}
9}