hf_mirrors/Faro-Qwen-4B
Model Introduction
Files & versions
Analysis

The Faro chat model focuses on practicality and long-context modeling. It handles various downstream tasks with higher quality, delivering stable and reliable results even when inputs contain lengthy documents or complex instructions. Faro seamlessly works in both English and Chinese.

Faro-Qwen-4B

Faro-Qwen-4B is an improved Qwen/Qwen1.5-4B-Chat with extensive instruction tuning on Fusang-V1. Compared to Qwen1.5-4B-Chat, Faro-Qwen-4B has gained greater capability in various downstream tasks and long-context modeling thanks to the large-scale synthetic data in Fusang-V1.

Faro-Qwen-4B uses dynamic NTK and continual training to extend its max context length to 100K.

Use with openMind

Faro-Qwen-4B uses chatml template. I recommend using openMind for long inputs.

from openmind import AutoTokenizer, AutoModelForCausalLM
from openmind_hub import snapshot_download
import torch
import torch_npu
import argparse

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Jinan_AICC/Faro-Qwen-4B",
        default=None,
    )
    args = parser.parse_args()
    return args

args = parse_args()
model_path = args.model_name_or_path
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_path)
messages = [
    {"role": "system", "content": "You are a helpful assistant. Always answer with a short response."},
    {"role": "user", "content": "Tell me what is Pythagorean theorem like you are a pirate."}
]
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
generated_ids = model.generate(input_ids, max_new_tokens=512, temperature=0.5)
response = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
print(response)

For more info please refer to Jinan_AICC/Faro-Yi-9B