TGViewer
Github LLMs Github LLMs @llm_learning · 756 subscribers
Post #14 3.62K
🌟 Zamba2-Instruct

В семействе 2 модели:

🟢Zamba2-1.2B-instruct;
🟠Zamba2-2.7B-instruct.



# Clone repo
git clone https://github.com/Zyphra/transformers_zamba2.git
cd transformers_zamba2

# Install the repository & accelerate:
pip install -e .
pip install accelerate

# Inference:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("Zyphra/Zamba2-2.7B-instruct")
model = AutoModelForCausalLM.from_pretrained("Zyphra/Zamba2-2.7B-instruct", device_map="cuda", torch_dtype=torch.bfloat16)

user_turn_1 = "user_prompt1."
assistant_turn_1 = "assistant_prompt."
user_turn_2 = "user_prompt2."
sample = [{'role': 'user', 'content': user_turn_1}, {'role': 'assistant', 'content': assistant_turn_1}, {'role': 'user', 'content': user_turn_2}]
chat_sample = tokenizer.apply_chat_template(sample, tokenize=False)

input_ids = tokenizer(chat_sample, return_tensors='pt', add_special_tokens=False).to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=150, return_dict_in_generate=False, output_scores=False, use_cache=True, num_beams=1, do_sample=False)
print((tokenizer.decode(outputs[0])))





🖥GitHub

https://t.me/deep_learning_proj
  • 👍 2
More from @llm_learning
  1. Sep 11, 2026document post
  2. Sep 11, 2026Large-language models (LLMs) are rapidly becoming part of human culture, reshaping how inf…
  3. Jun 29, 2026CUDA Agent: Large-Scale Agentic RL for High-Performance CUDA Kernel Generation https://arx…
  4. Oct 2, 2025When AIs Judge AIs: The Rise of Agent-as-a-Judge Evaluation for LLMs 📚 Read @LLM_learning
  5. Aug 5, 2025With so many LLM papers being published, it's hard to keep up and compare results. This st…
  6. Jun 16, 2025Deep-Live-Cam Real time face swap and one-click video deepfake with only a single image Cr…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →