Text Generation
Transformers
PyTorch
Safetensors
English
lightning
conversational
generative
custom_code
Instructions to use Aobangaming/lightning-30m-ft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Aobangaming/lightning-30m-ft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Aobangaming/lightning-30m-ft", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Aobangaming/lightning-30m-ft", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Aobangaming/lightning-30m-ft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Aobangaming/lightning-30m-ft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aobangaming/lightning-30m-ft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Aobangaming/lightning-30m-ft
- SGLang
How to use Aobangaming/lightning-30m-ft 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 "Aobangaming/lightning-30m-ft" \ --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": "Aobangaming/lightning-30m-ft", "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 "Aobangaming/lightning-30m-ft" \ --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": "Aobangaming/lightning-30m-ft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Aobangaming/lightning-30m-ft with Docker Model Runner:
docker model run hf.co/Aobangaming/lightning-30m-ft
Update README.md
Browse files
README.md
CHANGED
|
@@ -73,45 +73,10 @@ and add necessary guardrails and precautions to prevent misuse.
|
|
| 73 |
|
| 74 |
Use the code below to get started with the model.
|
| 75 |
```python
|
| 76 |
-
import sys
|
| 77 |
-
import types
|
| 78 |
import torch
|
| 79 |
-
|
| 80 |
-
from transformers import PretrainedConfig, AutoModelForCausalLM
|
| 81 |
from tokenizers import Tokenizer
|
| 82 |
|
| 83 |
-
|
| 84 |
-
class LightningConfig(PretrainedConfig):
|
| 85 |
-
model_type = "lightning"
|
| 86 |
-
|
| 87 |
-
def __init__(
|
| 88 |
-
self,
|
| 89 |
-
vocab_size=50000,
|
| 90 |
-
d_model=256,
|
| 91 |
-
nhead=4,
|
| 92 |
-
num_layers=4,
|
| 93 |
-
dropout=0.1,
|
| 94 |
-
max_seq_len=160,
|
| 95 |
-
**kwargs
|
| 96 |
-
):
|
| 97 |
-
super().__init__(
|
| 98 |
-
tie_word_embeddings=False,
|
| 99 |
-
**kwargs
|
| 100 |
-
)
|
| 101 |
-
|
| 102 |
-
self.vocab_size = vocab_size
|
| 103 |
-
self.d_model = d_model
|
| 104 |
-
self.nhead = nhead
|
| 105 |
-
self.num_layers = num_layers
|
| 106 |
-
self.dropout = dropout
|
| 107 |
-
self.max_seq_len = max_seq_len
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
config_module = types.ModuleType("configuration_lightning")
|
| 111 |
-
config_module.LightningConfig = LightningConfig
|
| 112 |
-
sys.modules["configuration_lightning"] = config_module
|
| 113 |
-
|
| 114 |
-
|
| 115 |
model_id = "Aobangaming/lightning-30m-ft"
|
| 116 |
|
| 117 |
model = AutoModelForCausalLM.from_pretrained(
|
|
@@ -135,6 +100,7 @@ outputs = model.generate(
|
|
| 135 |
)
|
| 136 |
|
| 137 |
print(tokenizer.decode(outputs[0].tolist()))
|
|
|
|
| 138 |
```
|
| 139 |
|
| 140 |
## Training Details
|
|
|
|
| 73 |
|
| 74 |
Use the code below to get started with the model.
|
| 75 |
```python
|
|
|
|
|
|
|
| 76 |
import torch
|
| 77 |
+
from transformers import AutoModelForCausalLM
|
|
|
|
| 78 |
from tokenizers import Tokenizer
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
model_id = "Aobangaming/lightning-30m-ft"
|
| 81 |
|
| 82 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
| 100 |
)
|
| 101 |
|
| 102 |
print(tokenizer.decode(outputs[0].tolist()))
|
| 103 |
+
|
| 104 |
```
|
| 105 |
|
| 106 |
## Training Details
|