Improve model card: Add Transformers library tag, code link, and usage example (#1)
Browse files- Improve model card: Add Transformers library tag, code link, and usage example (e3a16990fced5d7e0ce0ba51c68d5f777178be42)
Co-authored-by: Niels Rogge <[email protected]>
README.md
CHANGED
|
@@ -1,17 +1,67 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
datasets:
|
| 4 |
- MegaScience/MegaScience
|
| 5 |
language:
|
| 6 |
- en
|
|
|
|
| 7 |
metrics:
|
| 8 |
- accuracy
|
| 9 |
-
base_model:
|
| 10 |
-
- Qwen/Qwen3-14B-Base
|
| 11 |
pipeline_tag: text-generation
|
|
|
|
| 12 |
---
|
|
|
|
| 13 |
# [MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning](https://arxiv.org/abs/2507.16812)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
## Qwen3-14B-MegaScience
|
| 16 |
|
| 17 |
### Training Recipe
|
|
@@ -41,7 +91,7 @@ pipeline_tag: text-generation
|
|
| 41 |
|
| 42 |
## Citation
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
```
|
| 47 |
@article{fan2025megascience,
|
|
@@ -51,4 +101,4 @@ Check out our [paper](https://arxiv.org/abs/2507.16812) for more details. If you
|
|
| 51 |
journal={arXiv preprint arXiv:2507.16812},
|
| 52 |
url={https://arxiv.org/abs/2507.16812}
|
| 53 |
}
|
| 54 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen3-14B-Base
|
| 4 |
datasets:
|
| 5 |
- MegaScience/MegaScience
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
+
license: apache-2.0
|
| 9 |
metrics:
|
| 10 |
- accuracy
|
|
|
|
|
|
|
| 11 |
pipeline_tag: text-generation
|
| 12 |
+
library_name: transformers
|
| 13 |
---
|
| 14 |
+
|
| 15 |
# [MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning](https://arxiv.org/abs/2507.16812)
|
| 16 |
|
| 17 |
+
This repository contains the **Qwen3-14B-MegaScience** model, a large language model fine-tuned on the MegaScience dataset for enhanced scientific reasoning.
|
| 18 |
+
|
| 19 |
+
**Project Link**: [https://huggingface.co/MegaScience](https://huggingface.co/MegaScience) (Hugging Face Organization for MegaScience project)
|
| 20 |
+
**Code Repository**: [https://github.com/GAIR-NLP/lm-open-science-evaluation](https://github.com/GAIR-NLP/lm-open-science-evaluation)
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
You can use this model with the `transformers` library for text generation:
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 28 |
+
import torch
|
| 29 |
+
|
| 30 |
+
model_id = "MegaScience/Qwen3-14B-MegaScience"
|
| 31 |
+
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 34 |
+
model_id,
|
| 35 |
+
torch_dtype=torch.bfloat16, # or torch.float16 if bfloat16 is not supported
|
| 36 |
+
device_map="auto"
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
messages = [
|
| 40 |
+
{"role": "system", "content": "You are a helpful and knowledgeable assistant."},
|
| 41 |
+
{"role": "user", "content": "Explain the concept of quantum entanglement in simple terms."}
|
| 42 |
+
]
|
| 43 |
+
|
| 44 |
+
text = tokenizer.apply_chat_template(
|
| 45 |
+
messages,
|
| 46 |
+
tokenize=False,
|
| 47 |
+
add_generation_prompt=True
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
model_inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 51 |
+
|
| 52 |
+
generated_ids = model.generate(
|
| 53 |
+
model_inputs.input_ids,
|
| 54 |
+
max_new_tokens=512,
|
| 55 |
+
do_sample=True,
|
| 56 |
+
temperature=0.7,
|
| 57 |
+
top_p=0.9,
|
| 58 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
response = tokenizer.decode(generated_ids[0][model_inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 62 |
+
print(response)
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
## Qwen3-14B-MegaScience
|
| 66 |
|
| 67 |
### Training Recipe
|
|
|
|
| 91 |
|
| 92 |
## Citation
|
| 93 |
|
| 94 |
+
If you use our dataset or find our work useful, please cite
|
| 95 |
|
| 96 |
```
|
| 97 |
@article{fan2025megascience,
|
|
|
|
| 101 |
journal={arXiv preprint arXiv:2507.16812},
|
| 102 |
url={https://arxiv.org/abs/2507.16812}
|
| 103 |
}
|
| 104 |
+
```
|