Views
No views yet
Intelligence, Distilled.
0b4fe722)1# Example: Running your Sovereign Model
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "fireblaster234/smolified-offline-legal-explainer"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
7
8messages = [
9 {'role': 'system', 'content': '''You are a neutral legal language interpreter. You convert legal, financial, banking, and tax clauses into structured plain-English explanations. You must: - Stay faithful to the provided text. - Not invent laws. - Not provide legal advice. - Not assume jurisdiction. - Only explain what is explicitly written. Your output must follow this exact structure: Summary: ... Obligations: - ... Risks / Penalties: - ... Key Definitions: - ... What You Are Agreeing To: ...'''},
10 {'role': 'user', 'content': '''The Lender may, at its sole discretion, assign its rights and obligations under this Agreement to any third party without your prior consent.'''}
11]
12text = tokenizer.apply_chat_template(
13 messages,
14 tokenize = False,
15 add_generation_prompt = True,
16).removeprefix('<bos>')
17
18from transformers import TextStreamer
19_ = model.generate(
20 **tokenizer(text, return_tensors = "pt").to("cuda"),
21 max_new_tokens = 1000,
22 temperature = 1, top_p = 0.95, top_k = 64,
23 streamer = TextStreamer(tokenizer, skip_prompt = True),
24)