Text Generation
Transformers
Safetensors
qwen3
llama-factory
full
Generated from Trainer
conversational
text-generation-inference
Instructions to use ayh015/myLightningOPD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ayh015/myLightningOPD with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ayh015/myLightningOPD") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ayh015/myLightningOPD") model = AutoModelForCausalLM.from_pretrained("ayh015/myLightningOPD", device_map="auto") 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 ayh015/myLightningOPD with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ayh015/myLightningOPD" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ayh015/myLightningOPD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ayh015/myLightningOPD
- SGLang
How to use ayh015/myLightningOPD 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 "ayh015/myLightningOPD" \ --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": "ayh015/myLightningOPD", "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 "ayh015/myLightningOPD" \ --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": "ayh015/myLightningOPD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ayh015/myLightningOPD with Docker Model Runner:
docker model run hf.co/ayh015/myLightningOPD
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |
| # SPDX-License-Identifier: Apache-2.0 | |
| """CI utilities for Megatron backend testing.""" | |
| import logging | |
| from collections.abc import Sequence | |
| from megatron.core.distributed import DistributedDataParallel as DDP | |
| logger = logging.getLogger(__name__) | |
| def check_mtp_only_grad(model: Sequence[DDP], step_id: int) -> None: | |
| """Check that only MTP parameters have non-zero gradients. | |
| This is used for CI testing to verify that when all outputs are truncated, | |
| only the MTP layers receive gradients (since only mtp_loss contributes). | |
| Args: | |
| model: Sequence of DDP-wrapped model chunks. | |
| step_id: Current step index for logging. | |
| Raises: | |
| AssertionError: If any non-MTP parameter has a non-zero gradient. | |
| """ | |
| non_mtp_nonzero_grads = [] | |
| mtp_nonzero_grads = [] | |
| for model_chunk in model: | |
| for name, param in model_chunk.named_parameters(): | |
| # Get the main_grad from the distributed optimizer if available | |
| grad = getattr(param, "main_grad", None) | |
| if grad is None: | |
| grad = param.grad | |
| if grad is None: | |
| continue | |
| grad_norm = grad.abs().max().item() | |
| is_mtp = ".mtp." in name | |
| if is_mtp: | |
| if grad_norm > 0: | |
| mtp_nonzero_grads.append((name, grad_norm)) | |
| else: | |
| if grad_norm > 0: | |
| non_mtp_nonzero_grads.append((name, grad_norm)) | |
| # Log the results | |
| logger.info( | |
| f"[CI MTP Grad Check] Step {step_id}: " | |
| f"MTP params with non-zero grad: {len(mtp_nonzero_grads)}, " | |
| f"non-MTP params with non-zero grad: {len(non_mtp_nonzero_grads)}" | |
| ) | |
| if non_mtp_nonzero_grads: | |
| # Log the first few non-MTP params with non-zero gradients for debugging | |
| for name, grad_norm in non_mtp_nonzero_grads[:5]: | |
| logger.error(f"[CI MTP Grad Check] Non-MTP param with non-zero grad: {name}, max_grad={grad_norm}") | |
| assert len(non_mtp_nonzero_grads) == 0, ( | |
| f"Expected all non-MTP parameters to have zero gradients, " | |
| f"but found {len(non_mtp_nonzero_grads)} with non-zero gradients. " | |
| f"First few: {non_mtp_nonzero_grads[:5]}" | |
| ) | |
| # Also verify that MTP params do have gradients (otherwise the test is not valid) | |
| assert len(mtp_nonzero_grads) > 0, ( | |
| "Expected MTP parameters to have non-zero gradients, but all were zero. " | |
| "This may indicate the MTP loss is not being computed." | |
| ) | |
| def check_mtp_loss(mtp_loss: float, max_mtp_loss: float = 1.0) -> None: | |
| """Check that MTP loss is within expected bounds. | |
| Args: | |
| mtp_loss: The computed MTP loss value. | |
| max_mtp_loss: Maximum allowed MTP loss (default: 1.0). | |
| Raises: | |
| AssertionError: If MTP loss exceeds the maximum allowed value. | |
| """ | |
| assert mtp_loss < max_mtp_loss, ( | |
| f"MTP loss {mtp_loss} exceeds maximum allowed value {max_mtp_loss}. " | |
| "This may indicate an issue with MTP training." | |
| ) | |