Downloads · 30 days
62
20% of all-time downloads
freedomking/OpenSpark-13B-Chat
OpenSpark-13B-Chat is a text generation model from freedomking. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Downloads · 30 days
62
20% of all-time downloads
All-time downloads
309
Public
Parameters
13.3B
26.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors26.6 GB · 100%
From the Hugging Face model README
中文 | English
⚠️ Note: This is a relatively early version of the iFlytek Spark model (released in 2024). We converted it to Hugging Face format primarily for research purposes — to help the community study early LLM architectures, compare with modern models, and understand how the field has evolved.
This is a community-converted Hugging Face compatible version of the iFlytek Spark 13B model. The original weights were converted from the official Megatron-DeepSpeed format to work seamlessly with the transformers ecosystem.
pip install torch transformers sentencepiece
You can load this model using the transformers library. Ensure you have trust_remote_code=True set to load the model and tokenizer logic.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_path = "freedomking/OpenSpark-13B-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
prompt = "<User> 你好,请自我介绍一下。<end><Bot>"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
apply_chat_template (Recommended)For multi-turn conversations, use the built-in chat template:
messages = [
{"role": "user", "content": "你好,请自我介绍一下。"}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
return_tensors="pt",
add_generation_prompt=True
).to(model.device)
outputs = model.generate(
inputs,
max_new_tokens=8192,
temperature=0.7,
top_k=1,
do_sample=True,
repetition_penalty=1.02,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
messages = [
{"role": "user", "content": "什么是人工智能?"},
{"role": "assistant", "content": "人工智能是一种模拟人类智能的技术..."},
{"role": "user", "content": "它有哪些应用场景?"}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
return_tensors="pt",
add_generation_prompt=True
).to(model.device)
outputs = model.generate(inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
| Parameter | Value |
|---|---|
| Architecture | Transformer Decoder (Spark) |
| Parameters | ~13B |
| Hidden Size | 5120 |
| Layers | 40 |
| Attention Heads | 40 |
| Vocab Size | 60,000 |
| Context Length | 32K |
| RoPE Base (Theta) | 1,000,000 |
| Activation | Fast GeLU |
| Parameter | Recommended Value |
|---|---|
max_new_tokens | 8192 |
temperature | 0.7 |
top_k | 1 |
do_sample | True |
repetition_penalty | 1.02 |
This project serves several purposes for the research community:
apply_chat_template for multi-turn dialogues (<User>...<end><Bot>... format).<ret>, <end>).This project is licensed under the Apache 2.0 License.