D R T o1 7 B

Krystalan

Introduction

DRT-o1 is introduced as an exploration into applying long thought reasoning to neural machine translation (MT). The project involves mining sentences with similes or metaphors and using a multi-agent framework for translation. It aims to explore new technical routes rather than compete directly with existing models like OpenAI's O1.

Architecture

The DRT-o1 family includes models like DRT-o1-7B, DRT-o1-8B, and DRT-o1-14B, which are trained using backbones such as Llama-3.1-8B-Instruct and Qwen2.5 series. These models leverage deep reasoning for improved translation quality.

Training

The training process involves synthesizing 22,264 samples using a multi-agent framework. The models were trained with a focus on exploring long thought reasoning applied to MT, rather than achieving performance benchmarks.

Guide: Running Locally

To run DRT-o1 models locally, follow these steps:

  1. Install Hugging Face Transformers:

    pip install transformers
    
  2. Load the Model and Tokenizer:

    from transformers import AutoModelForCausalLM, AutoTokenizer
    
    model_name = "Krystalan/DRT-o1-7B"
    model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
    tokenizer = AutoTokenizer.from_pretrained(model_name)
    
  3. Prepare Input and Generate Output:

    prompt = "Please translate the following text from English to Chinese:\n..."
    messages = [{"role": "system", "content": "You are a philosopher skilled in deep thinking..."}, {"role": "user", "content": prompt}]
    text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
    model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
    generated_ids = model.generate(**model_inputs, max_new_tokens=2048)
    response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
    print(response)
    
  4. Consider Using Cloud GPUs: For better performance, consider using cloud GPU services such as AWS, Google Cloud, or Azure.

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (cc-by-nc-sa-4.0).

More Related APIs in Text Generation