Text Generation
PEFT
Safetensors
mango
qwen3
mathematics
science
reasoning
agent
multi-step-reasoning
lora
Instructions to use ComradeRt/Mango-T30-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use ComradeRt/Mango-T30-1.7B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-1.7B") model = PeftModel.from_pretrained(base_model, "ComradeRt/Mango-T30-1.7B") - Notebooks
- Google Colab
- Kaggle
Download inference_example.py from ComradeRt/Mango-T30-1.7B: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/ComradeRt/Mango-T30-1.7B/resolve/main/inference_example.py
- Command line
-
hf download hf://ComradeRt/Mango-T30-1.7B/inference_example.py
-
curl -L -o inference_example.py https://huggingface.co/ComradeRt/Mango-T30-1.7B/resolve/main/inference_example.py
1.49 kB
| """Minimal inference with the Mango T30 1.7B LoRA adapter. | |
| Loads the pinned Qwen3-1.7B base model and applies the Mango adapter with | |
| PEFT. This reproduces the language-model component only; it does not | |
| reproduce the Mango T30 orchestration runtime that was officially evaluated. | |
| """ | |
| import os | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| BASE_MODEL = "Qwen/Qwen3-1.7B" | |
| BASE_REVISION = "70d244cc86ccca08cf5af4e1e306ecf908b1ad5e" | |
| # Set MANGO_ADAPTER to a local directory to load a local copy of this repo. | |
| ADAPTER_MODEL = os.environ.get("MANGO_ADAPTER", "ComradeRt/Mango-T30-1.7B") | |
| def main() -> None: | |
| tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, revision=BASE_REVISION) | |
| base = AutoModelForCausalLM.from_pretrained( | |
| BASE_MODEL, | |
| revision=BASE_REVISION, | |
| device_map="auto", | |
| dtype="auto", | |
| ) | |
| model = PeftModel.from_pretrained(base, ADAPTER_MODEL) | |
| model.eval() | |
| messages = [ | |
| {"role": "user", | |
| "content": "Solve x^2 - 5x + 6 = 0 and verify the roots."}, | |
| ] | |
| text = tokenizer.apply_chat_template( | |
| messages, tokenize=False, add_generation_prompt=True) | |
| inputs = tokenizer(text, return_tensors="pt").to(model.device) | |
| output = model.generate(**inputs, max_new_tokens=512, do_sample=False) | |
| new_tokens = output[0][inputs["input_ids"].shape[-1]:] | |
| print(tokenizer.decode(new_tokens, skip_special_tokens=True)) | |
| if __name__ == "__main__": | |
| main() | |