Text Generation
Transformers
Safetensors
orion_t2
project-prism
orion
custom-code
causal-lm
custom_code
Instructions to use Refract-Labs/Orion-Flagship-Mini-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Refract-Labs/Orion-Flagship-Mini-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Refract-Labs/Orion-Flagship-Mini-Base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Refract-Labs/Orion-Flagship-Mini-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Refract-Labs/Orion-Flagship-Mini-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Refract-Labs/Orion-Flagship-Mini-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Refract-Labs/Orion-Flagship-Mini-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Refract-Labs/Orion-Flagship-Mini-Base
- SGLang
How to use Refract-Labs/Orion-Flagship-Mini-Base 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 "Refract-Labs/Orion-Flagship-Mini-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Refract-Labs/Orion-Flagship-Mini-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Refract-Labs/Orion-Flagship-Mini-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Refract-Labs/Orion-Flagship-Mini-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Refract-Labs/Orion-Flagship-Mini-Base with Docker Model Runner:
docker model run hf.co/Refract-Labs/Orion-Flagship-Mini-Base
Download app.py from Refract-Labs/Orion-Flagship-Mini-Base: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/Refract-Labs/Orion-Flagship-Mini-Base/resolve/main/app.py
- Command line
-
hf download hf://Refract-Labs/Orion-Flagship-Mini-Base/app.py
-
curl -L -o app.py https://huggingface.co/Refract-Labs/Orion-Flagship-Mini-Base/resolve/main/app.py
1.88 kB
| import os | |
| import torch | |
| import gradio as gr | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| REPO = os.environ.get("ORION_REPO_ID", "Project-Prism/Orion-Flagship") | |
| tokenizer = AutoTokenizer.from_pretrained(REPO, trust_remote_code=True) | |
| dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32 | |
| kwargs = { | |
| "trust_remote_code": True, | |
| "dtype": dtype, | |
| } | |
| if torch.cuda.is_available(): | |
| kwargs["device_map"] = "auto" | |
| model = AutoModelForCausalLM.from_pretrained(REPO, **kwargs) | |
| model.eval() | |
| def generate(prompt, max_new_tokens, temperature, top_p): | |
| inputs = tokenizer(prompt, return_tensors="pt") | |
| inputs = {k: v.to(model.device) for k, v in inputs.items()} | |
| with torch.inference_mode(): | |
| ids = model.generate( | |
| **inputs, | |
| max_new_tokens=int(max_new_tokens), | |
| do_sample=float(temperature) > 0, | |
| temperature=max(float(temperature), 1e-5), | |
| top_p=float(top_p), | |
| use_cache=False, | |
| ) | |
| return tokenizer.decode(ids[0], skip_special_tokens=True) | |
| with gr.Blocks(title="Orion Flagship — Project Prism") as demo: | |
| gr.Markdown( | |
| "# 🔺 Orion Flagship\n" | |
| "Experimental **Project Prism / Orion T2** pretraining checkpoint. " | |
| "This is not an instruction-tuned assistant." | |
| ) | |
| prompt = gr.Textbox( | |
| value="The most important reason the sky appears blue is", | |
| label="Prompt", | |
| lines=5, | |
| ) | |
| with gr.Row(): | |
| max_tokens = gr.Slider(1, 128, value=48, step=1, label="New tokens") | |
| temperature = gr.Slider(0, 1.5, value=0.8, step=0.05, label="Temperature") | |
| top_p = gr.Slider(0.1, 1.0, value=0.95, step=0.01, label="Top-p") | |
| go = gr.Button("Generate") | |
| output = gr.Textbox(label="Output", lines=10) | |
| go.click(generate, [prompt, max_tokens, temperature, top_p], output) | |
| demo.launch() | |