← Back to Top 10
01.AI

Yi-1.5

The bilingual master, delivering exceptional performance in both English and Chinese.

Generic Info

  • Publisher: 01.AI
  • Release Date: May 2024
  • Parameters: 6B, 9B, 34B
  • Context Window: 200k tokens (some variants)
  • License: Apache 2.0
  • Key Capabilities: Bilingual (En/Zh), Coding, Math, Long Context

Yi-1.5 is a robust upgrade to the original Yi series. It maintains the strong bilingual capabilities while significantly boosting coding and math performance, making it a versatile choice for global applications.

Hello World Guide

Run Yi-1.5 with transformers.

Python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = "01-ai/Yi-1.5-34B-Chat"

tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
model = AutoModelForCausalLM.from_pretrained(
    model_path, 
    device_map="auto", 
    torch_dtype="auto"
)

messages = [
    {"role": "user", "content": "Translate 'Hello World' to Chinese and explain the characters."}
]

input_ids = tokenizer.apply_chat_template(
    conversation=messages, 
    tokenize=True, 
    add_generation_prompt=True, 
    return_tensors='pt'
)

output_ids = model.generate(input_ids.to('cuda'), max_new_tokens=200)
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)

print(response)

Industry Usage

Cross-Border E-commerce

Essential for platforms operating in both Western and Chinese markets for translation and customer support.

Document Analysis

Its 200k context window allows for deep analysis of lengthy financial and legal documents.

Coding Assistants

Strong performance in code generation makes it a viable backend for developer tools.