import torchfrom transformers import AutoModelForCausalLM, AutoTokenizer model_id = "sarimahsan101/Spire-9B-RL"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 GPU compute shader engineer specializing in " "Vulkan GLSL and WebGPU WGSL. Write standalone, race-free, valid compute " "shaders that strictly follow the requested bindings and workgroup layout. " "Output the shader inside a single fenced code block (```glsl or ```wgsl)." ), }, { "role": "user", "content": ( "Write a Vulkan GLSL (#version 450) compute shader with local_size_x = 64 " "that computes row-wise LayerNorm over a float buffer X (binding 0, shape [R, C]) " "with gamma (binding 1, shape [C]), beta (binding 2, shape [C]), " "output Y (binding 3, shape [R, C]), and uniform Params { uint R; uint C; float eps; } (binding 4)." ), },] prompt = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, enable_thinking=False,)inputs = tokenizer(prompt, return_tensors="pt").to(model.device)outputs = model.generate(**inputs, max_new_tokens=1536, do_sample=False)print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))