Views
No views yet
Qwen2.5-3B-MegaScience model, one of the models trained as part of the MegaScience project.transformers library:1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "MegaScience/Qwen2.5-3B-MegaScience"
4tokenizer = AutoTokenizer.from_pretrained(model_name)
5model = AutoModelForCausalLM.from_pretrained(model_name)
6
7# Example text generation
8prompt = "The capital of France is"
9messages = [
10 {"role": "user", "content": prompt}
11]
12text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
13model_inputs = tokenizer([text], return_tensors="pt")
14
15generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=20)
16print(tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0])


@article{fan2025megascience,
title={MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning},
author={Fan, Run-Ze and Wang, Zengzhi and Liu, Pengfei},
year={2025},
journal={arXiv preprint arXiv:2507.16812},
url={https://arxiv.org/abs/2507.16812}
}