vltnmmdv's picture
Add pipeline tag, library name, and paper link (#1)
bc459c9 verified
metadata
base_model:
  - ai-sage/GigaChat-20B-A3B-instruct
language:
  - ru
  - en
license: mit
pipeline_tag: text-generation
library_name: transformers

GigaChat-20B-A3B-instruct bf16

This model is part of the GigaChat family of Russian LLMs, based on ai-sage/GigaChat-20B-A3B-instruct. It supports a context length of 131,000 tokens.

More details are available in this habr article and the original instruct model card. The model was presented in GigaChat Family: Efficient Russian Language Modeling Through Mixture of Experts Architecture.

Example Usage with Transformers

pip install --upgrade transformers torch accelerate bitsandbytes
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "ai-sage/GigaChat-20B-A3B-instruct-bf16"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, device_map="auto", torch_dtype=torch.bfloat16)
model.generation_config = GenerationConfig.from_pretrained(model_name)

messages = [
    {"role": "user", "content": "Докажи теорему о неподвижной точке"}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device))

result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=False)
print(result)