This model is fine-tuned on a textual dataset for analog circuit knowledge learning. The training dataset is constructed from high-quality textbooks using a knowledge distillation approach to extract structured question-answer pairs.
The model achieves 85.04% accuracy on the AMSBench-TQA benchmark, showing a 15.67% improvement over the initial Qwen2.5-32B-Instruct model.
While this model demonstrates good performance on the AMSBench-TQA benchmark, it is specialized for this domain. Its applicability and performance in other, unrelated domains may be limited. Users should be aware that, like all language models, it may occasionally generate incorrect or nonsensical information, especially for highly novel or unrepresented concepts within its training data.
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
3
4model_id = "analogllm/analog_model"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11 trust_remote_code=True
12)
13
14# Example chat interaction (Qwen2.5 Instruct format)
15messages = [
16 {"role": "user", "content": "What is the primary function of a common-emitter amplifier in analog circuits?"}
17]
18
19# Apply the chat template and prepare inputs
20text = tokenizer.apply_chat_template(
21 messages,
22 tokenize=False,
23 add_generation_prompt=True
24)
25inputs = tokenizer(text, return_tensors='pt').to(model.device)
26
27# Configure generation parameters
28generation_config = GenerationConfig(
29 max_new_tokens=512,
30 do_sample=True,
31 temperature=0.7,
32 top_p=0.8,
33 repetition_penalty=1.05,
34 eos_token_id=[tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<|im_end|>")] # Ensure it stops correctly
35)
36
37# Generate response
38outputs = model.generate(
39 inputs=inputs.input_ids,
40 attention_mask=inputs.attention_mask,
41 generation_config=generation_config
42)
43
44# Decode and print the response
45response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
46print(response)
1{
2 "epoch": 1.0,
3 "num_input_tokens_seen": 113180672,
4 "total_flos": 759612479373312.0,
5 "train_loss": 1.1406613362056237,
6 "train_runtime": 17617.7573,
7 "train_samples_per_second": 0.784,
8 "train_steps_per_second": 0.012
9}