Instructions to use prithivMLmods/Megatron-Opus-14B-2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Megatron-Opus-14B-2.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prithivMLmods/Megatron-Opus-14B-2.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Megatron-Opus-14B-2.1") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/Megatron-Opus-14B-2.1") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/Megatron-Opus-14B-2.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/Megatron-Opus-14B-2.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Megatron-Opus-14B-2.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prithivMLmods/Megatron-Opus-14B-2.1
- SGLang
How to use prithivMLmods/Megatron-Opus-14B-2.1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "prithivMLmods/Megatron-Opus-14B-2.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Megatron-Opus-14B-2.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "prithivMLmods/Megatron-Opus-14B-2.1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Megatron-Opus-14B-2.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prithivMLmods/Megatron-Opus-14B-2.1 with Docker Model Runner:
docker model run hf.co/prithivMLmods/Megatron-Opus-14B-2.1
Megatron-Opus-14B-2.1 [ Exp ]
[Megatron-Opus-14B-2.1 ] Exp finetuned from Microsoft's Phi-4 is a state-of-the-art open model developed with a focus on responsible problem solving and advanced reasoning capabilities. Built upon a diverse blend of synthetic datasets, carefully filtered public domain websites, and high-quality academic books and Q&A datasets, Megatron-Opus-14B-2.1 ensures that small, capable models are trained with datasets of exceptional depth and precision.
Megatron-Opus-14B-2.1 adopts a robust safety post-training approach using open-source and in-house synthetic datasets. This involves a combination of SFT (Supervised Fine-Tuning) and iterative DPO (Direct Preference Optimization) techniques, ensuring helpful and harmless outputs across various safety categories.
Dataset Info
Megatron-Opus-14B-2.1 is fine-tuned on a carefully curated synthetic dataset generated using an advanced pipeline optimized for Chain of Thought (CoT) reasoning and Responsible Problem Breakdown (RPB) methodologies. This ensures that the model excels at:
- Logical reasoning
- Step-by-step problem-solving
- Breaking down complex tasks into manageable parts
The dataset also emphasizes responsible decision-making and fairness in generating solutions.
Run with Transformers
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Megatron-Opus-14B-2.1")
model = AutoModelForCausalLM.from_pretrained(
"prithivMLmods/Megatron-Opus-14B-2.1",
device_map="auto",
torch_dtype=torch.bfloat16,
)
input_text = "Explain the concept of black holes."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=64)
print(tokenizer.decode(outputs[0]))
For chat-style interactions, use tokenizer.apply_chat_template:
messages = [
{"role": "user", "content": "Explain the concept of black holes."},
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))
Intended Use
Megatron-Opus-14B-2.1 is tailored for a wide range of applications, especially those involving advanced reasoning, multilingual capabilities, and responsible problem-solving. Its primary use cases include:
Responsible Problem Solving
- Breaking down complex problems into logical, actionable steps.
- Offering ethical, well-rounded solutions in academic and professional contexts.
Advanced Reasoning Tasks
- Excelling in mathematics, logic, and scientific reasoning.
- Providing detailed explanations and systematic answers.
Content Generation
- Assisting in generating high-quality content for various domains, including creative writing and technical documentation.
- Supporting marketers, writers, and educators with detailed and well-structured outputs.
Educational Support
- Acting as a virtual tutor for students by generating practice questions, answers, and detailed explanations.
- Helping educators design learning material that promotes critical thinking and step-by-step problem-solving.
Customer Support & Dialogue Systems
- Enabling chatbots and virtual assistants to provide accurate, helpful, and responsible responses.
- Enhancing customer service with reasoning-driven automation.
Limitations
Despite its strengths, Megatron-Opus-14B-2.1 has some limitations that users should be aware of:
Bias and Fairness
- While great effort has been made to minimize biases, users should critically assess the model’s output in sensitive scenarios to avoid unintended bias.
Contextual Interpretation
- The model may occasionally misinterpret highly nuanced prompts or ambiguous contexts, leading to suboptimal responses.
Knowledge Cutoff
- Megatron-Opus-14B-2.1’s knowledge is static and based on the data available at the time of training. It does not include real-time updates or information on recent developments.
Safety and Harmlessness
- Despite post-training safety alignment, inappropriate or harmful outputs may still occur. Continuous monitoring and human oversight are advised when using the model in critical contexts.
Computational Requirements
- Deploying Megatron-Opus-14B-2.1 efficiently may require substantial computational resources, particularly for large-scale deployments or real-time applications.
- Downloads last month
- 10
