from transformers import pipeline # Load the StarCoder model and send it to the GPU model_name = "bigcode/starcoder" code_pipeline = pipeline("text-generation", model=model_name, device=0) # 0 for first GPU # Provide the prompt prompt = "def fibonacci(n):\n # Compute the Fibonacci sequence" # Generate the code result = code_pipeline(prompt, max_new_tokens=50) # Print the output print(result[0]['generated_text'])