from transformers import AutoModelForCausalLM, AutoTokenizerimport torch model_id = "sallani/ISO42001-Qwen2.5-0.5B-Edge" tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.bfloat16, device_map="auto",) messages = [ { "role": "system", "content": ( "You are an expert assistant in AI governance and management systems, " "specializing in ISO/IEC 42001:2023 (AI Management System), the EU AI Act, " "and GDPR applied to AI. Your answers are precise, clause-referenced, " "and tailored to compliance professionals (CISOs, DPOs, CAIOs, GRC consultants)." ) }, { "role": "user", "content": "What are the key controls in ISO 42001 Annex A for AI system operations?" }] text = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True)inputs = tokenizer(text, return_tensors="pt").to(model.device) with torch.no_grad(): outputs = model.generate( **inputs, max_new_tokens=512, temperature=0.1, top_p=0.9, repetition_penalty=1.1, do_sample=True, ) print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))