Views
No views yet
| Parameter | Value |
|---|---|
| Total Parameters | 13B |
| Context Length | 32K |
| Window Length | 32K |
| Number of Layers | 40 |
| Attention Hidden Dim | 5120 |
| Attention Heads | 40 |
| Vocabulary Size | 130K |
| Attention Mechanism | GQA |
| Activation Function | GeLU |
| Task | Metric | Spark Chemistry-X1-13B | DeepSeek-R1 | Gemini 2.5 pro | GPT-4.1 | O3-mini |
|---|---|---|---|---|---|---|
| Advanced Knowledge Q&A | Acc | 84.00 | 77.00 | 64.00 | 76.00 | 80.00 |
| Name Conversion | Acc | 71.00 | 6.00 | 15.00 | 4.00 | 6.00 |
| Property Prediction | Acc | 85.33 | 41.73 | 51.19 | 51.66 | 67.58 |
1cd /path/to/Spark-Chemistry-X1-13B
2# We recommend using Python 3.10
3pip install -r requirements.txt
4pip install .1from modelscope import AutoModelForCausalLM, AutoTokenizer
2import torch
3# Load model and tokenizer
4model_name = "iflytek/Spark-Chemistry-X1-13B"
5tokenizer = AutoTokenizer.from_pretrained(model_name,trust_remote_code=True)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name,
8 torch_dtype=torch.float32,
9 device_map="auto",
10 trust_remote_code=True
11)
12# Reactive
13chat_history = [
14 {
15 "role" : "user",
16 "content" : "请回答下列问题:高分子材料是否具有柔顺性主要决定于()的运动能力。\nA、主链链节\nB、侧基\nC、侧基内的官能团或原子?"
17 }]
18
19inputs = tokenizer.apply_chat_template(
20 chat_history,
21 tokenize=True,
22 return_tensors="pt",
23 add_generation_prompt=True
24).to(model.device)
25
26outputs = model.generate(
27 inputs,
28 max_new_tokens=8192,
29 top_k=1,
30 do_sample=True,
31 repetition_penalty=1.02,
32 temperature=0.7,
33 eos_token_id=5,
34 pad_token_id=0,
35)
36
37response = tokenizer.decode(
38 outputs[0][inputs.shape[1] :],
39 skip_special_tokens=True
40)
41print(response)1from modelscope import AutoModelForCausalLM, AutoTokenizer
2import torch
3# Load model and tokenizer
4model_name = "iflytek/Spark-Chemistry-X1-13B"
5tokenizer = AutoTokenizer.from_pretrained(model_name,trust_remote_code=True)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name,
8 torch_dtype=torch.float32,
9 device_map="auto",
10 trust_remote_code=True
11)
12# Deliberative
13chat_history = [
14 {
15 "role" : "system",
16 "content" : "请你先深入剖析给出问题的关键要点与内在逻辑,生成思考过程,再根据思考过程回答给出问题。思考过程以<unused6>开头,在结尾处用<unused7>标注结束,<unused7>后为基于思考过程的回答内容"
17 }
18 ,
19 {
20 "role" : "user",
21 "content" : "请回答下列问题:高分子材料是否具有柔顺性主要决定于()的运动能力。\nA、主链链节\nB、侧基\nC、侧基内的官能团或原子?"
22 }]
23
24
25inputs = tokenizer.apply_chat_template(
26 chat_history,
27 tokenize=True,
28 return_tensors="pt",
29 add_generation_prompt=True
30).to(model.device)
31
32outputs = model.generate(
33 inputs,
34 max_new_tokens=8192,
35 top_k=1,
36 do_sample=True,
37 repetition_penalty=1.02,
38 temperature=0.7,
39 eos_token_id=5,
40 pad_token_id=0,
41)
42
43response = tokenizer.decode(
44 outputs[0][inputs.shape[1] :],
45 skip_special_tokens=True
46)
47print(response)1from modelscope import AutoModelForCausalLM
2import torch
3
4model_name = " /path_to/Spark-Chemistry-X1-13B"
5
6# Load FP32 weights
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype=torch.float32, # explicitly FP32
10 device_map="auto",
11 trust_remote_code=True
12)
13
14# Convert to BF16
15model = model.to(torch.bfloat16)
16
17# Save BF16 weights for later fast loading
18save_path = "./Spark-Chemistry-X1-13B-bf16"
19model.save_pretrained(save_path, safe_serialization=True)