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 | |
| import importlib | |
| import subprocess | |
| import ray | |
| from slime.utils.http_utils import is_port_available | |
| def load_function(path): | |
| """ | |
| Load a function from a module. | |
| :param path: The path to the function, e.g. "module.submodule.function". | |
| :return: The function object. | |
| """ | |
| module_path, _, attr = path.rpartition(".") | |
| module = importlib.import_module(module_path) | |
| return getattr(module, attr) | |
| class SingletonMeta(type): | |
| """ | |
| A metaclass for creating singleton classes. | |
| """ | |
| _instances = {} | |
| def __call__(cls, *args, **kwargs): | |
| if cls not in cls._instances: | |
| instance = super().__call__(*args, **kwargs) | |
| cls._instances[cls] = instance | |
| return cls._instances[cls] | |
| def exec_command(cmd: str, capture_output: bool = False) -> str | None: | |
| print(f"EXEC: {cmd}", flush=True) | |
| try: | |
| result = subprocess.run( | |
| ["bash", "-c", cmd], | |
| shell=False, | |
| check=True, | |
| capture_output=capture_output, | |
| **(dict(text=True) if capture_output else {}), | |
| ) | |
| except subprocess.CalledProcessError as e: | |
| if capture_output: | |
| print(f"{e.stdout=} {e.stderr=}") | |
| raise | |
| if capture_output: | |
| print(f"Captured stdout={result.stdout} stderr={result.stderr}") | |
| return result.stdout | |
| def get_current_node_ip(): | |
| address = ray._private.services.get_node_ip_address() | |
| # strip ipv6 address | |
| address = address.strip("[]") | |
| return address | |
| def get_free_port(start_port=10000, consecutive=1): | |
| # find the port where port, port + 1, port + 2, ... port + consecutive - 1 are all available | |
| port = start_port | |
| while not all(is_port_available(port + i) for i in range(consecutive)): | |
| port += 1 | |
| return port | |
| def should_run_periodic_action( | |
| rollout_id: int, | |
| interval: int | None, | |
| num_rollout_per_epoch: int | None = None, | |
| num_rollout: int | None = None, | |
| ) -> bool: | |
| """ | |
| Return True when a periodic action (eval/save/checkpoint) should run. | |
| Args: | |
| rollout_id: The current rollout index (0-based). | |
| interval: Desired cadence; disables checks when None. | |
| num_rollout_per_epoch: Optional epoch boundary to treat as a trigger. | |
| """ | |
| if interval is None: | |
| return False | |
| if num_rollout is not None and rollout_id == num_rollout - 1: | |
| return True | |
| step = rollout_id + 1 | |
| return (step % interval == 0) or (num_rollout_per_epoch is not None and step % num_rollout_per_epoch == 0) | |