Text Generation
Transformers
Russian
English
gpt2
causal-lm
experimental
trained-from-scratch
spacemodel
undertrained
Instructions to use openmodelai/Galactic-2.5-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openmodelai/Galactic-2.5-Mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openmodelai/Galactic-2.5-Mini")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("openmodelai/Galactic-2.5-Mini", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openmodelai/Galactic-2.5-Mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openmodelai/Galactic-2.5-Mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openmodelai/Galactic-2.5-Mini", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openmodelai/Galactic-2.5-Mini
- SGLang
How to use openmodelai/Galactic-2.5-Mini 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 "openmodelai/Galactic-2.5-Mini" \ --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": "openmodelai/Galactic-2.5-Mini", "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 "openmodelai/Galactic-2.5-Mini" \ --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": "openmodelai/Galactic-2.5-Mini", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openmodelai/Galactic-2.5-Mini with Docker Model Runner:
docker model run hf.co/openmodelai/Galactic-2.5-Mini
Download infer.py from openmodelai/Galactic-2.5-Mini: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/openmodelai/Galactic-2.5-Mini/resolve/main/infer.py
- Command line
-
hf download hf://openmodelai/Galactic-2.5-Mini/infer.py
-
curl -L -o infer.py https://huggingface.co/openmodelai/Galactic-2.5-Mini/resolve/main/infer.py
1.4 kB
| """Uncurated text completion; this checkpoint is NOT an instruction/chat model.""" | |
| import argparse | |
| from pathlib import Path | |
| import torch | |
| from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed | |
| p = argparse.ArgumentParser() | |
| p.add_argument('--model', default=str(Path(__file__).resolve().parent/'model')) | |
| p.add_argument('--prompt', default='Однажды вечером') | |
| p.add_argument('--max-new-tokens', type=int, default=64) | |
| p.add_argument('--seed', type=int, default=42) | |
| a = p.parse_args() | |
| set_seed(a.seed) | |
| torch.set_num_threads(2) | |
| device = 'cuda' if torch.cuda.is_available() else 'cpu' | |
| tok = AutoTokenizer.from_pretrained(a.model, trust_remote_code=False) | |
| model = AutoModelForCausalLM.from_pretrained(a.model, trust_remote_code=False, | |
| torch_dtype=torch.float16 if device == 'cuda' else torch.float32).to(device).eval() | |
| if not 1 <= a.max_new_tokens < model.config.n_positions: | |
| raise ValueError('max-new-tokens must be between 1 and 511') | |
| inputs = tok(a.prompt, return_tensors='pt', truncation=True, | |
| max_length=model.config.n_positions-a.max_new_tokens).to(device) | |
| with torch.inference_mode(): | |
| output = model.generate(**inputs, max_new_tokens=a.max_new_tokens, | |
| do_sample=True, temperature=.8, top_p=.9, repetition_penalty=1.1, | |
| pad_token_id=tok.pad_token_id, eos_token_id=tok.eos_token_id) | |
| print(tok.decode(output[0], skip_special_tokens=True)) | |