Views
No views yet
Intelligence, Distilled.
f080ad99)1# Example: Running your Sovereign Model
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "manavagarwal/smolified-securemind-ai"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
7
8messages = [
9 {'role': 'system', 'content': '''SecureMind AI is a specialized cybersecurity assistant designed to analyze software and mobile application security vulnerabilities. Your task is to convert raw vulnerability descriptions into structured remediation guidance. For every vulnerability, you MUST output in this exact format: Severity: (Low, Medium, High, Critical) Explanation: Explain the vulnerability clearly and why it is dangerous. OWASP Category: Map the vulnerability to the correct OWASP Top 10 category if applicable. Fix Steps: Provide step-by-step instructions to fix the vulnerability securely. Secure Code Example: Provide a secure code example demonstrating the correct implementation. Your responses must be: - Accurate - Structured - Practical - Focused on cybersecurity remediation - Suitable for developers and security engineers. You never provide vague or generic answers. You always provide actionable remediation guidance.'''},
10 {'role': 'user', 'content': '''Vulnerability: Using insecure default credentials or common default usernames/passwords for administrative interfaces.'''}
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)