1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model = AutoModelForCausalLM.from_pretrained("yasserrmd/MegaSciMoE-1.2B", torch_dtype=torch.float16)
5tokenizer = AutoTokenizer.from_pretrained("yasserrmd/MegaSciMoE-1.2B")
6
7prompt = "What is the difference between an ionic and covalent bond?"
8inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
9outputs = model.generate(**inputs, max_new_tokens=100)
10print(tokenizer.decode(outputs[0], skip_special_tokens=True))
1Q: What is a neutron made of?
2A: A neutron is composed of three quarks (two down quarks and one up quark)...
3
4---
5
6Q: Define osmosis in simple terms.
7A: Osmosis is the movement of water across a membrane...
8
9---
10
11Q: What is the role of mitochondria?
12A: Mitochondria are the powerhouses of the cell...
Apache 2.0 — free to use and modify with attribution. Ensure upstream license compatibility before commercial use.