from unsloth import FastLanguageModelfrom transformers import TextStreamer # Load model with Unsloth (automatically handles 2M context!)model, tokenizer = FastLanguageModel.from_pretrained( model_name="putheng/qwen2-5-coder-1-5b-instruct-progressive-2000k", max_seq_length=2000000, dtype=None, # Auto-detect load_in_4bit=True,) # Enable native fast generationFastLanguageModel.for_inference(model) # Example: Analyze a large codebase (uses the model's chat template)messages = [ {"role": "system", "content": "You are a helpful coding assistant that understands large code repositories."}, {"role": "user", "content": "Repository Context: [Your repository content up to 2000K tokens] Question: Analyze the overall architecture and provide improvement suggestions."},]prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=2000000)streamer = TextStreamer(tokenizer) outputs = model.generate( **inputs, streamer=streamer, max_new_tokens=1024, temperature=0.7, do_sample=True)