Instructions to use clivern/cosmos with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use clivern/cosmos with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="clivern/cosmos")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("clivern/cosmos") model = AutoModelForCausalLM.from_pretrained("clivern/cosmos", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use clivern/cosmos with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "clivern/cosmos" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "clivern/cosmos", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/clivern/cosmos
- SGLang
How to use clivern/cosmos 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 "clivern/cosmos" \ --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": "clivern/cosmos", "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 "clivern/cosmos" \ --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": "clivern/cosmos", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use clivern/cosmos with Docker Model Runner:
docker model run hf.co/clivern/cosmos
cosmos
A small GPT-2 style language model trained from scratch on astronomy and cosmology, from public-domain books about the heavens.
Intended use
Research and education. It is a small model trained on a limited corpus, so expect repetitive or factually wrong output. It is not suitable for factual question answering.
Training
- Architecture: GPT-2 style decoder, 4 layers, 4 heads, 256 hidden size, context 256
- Tokenizer: byte-level BPE, vocabulary 8000
- Objective: next-token prediction
- Final validation loss: 6.171
- Configuration:
train_config.jsonin this repository
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("clivern/cosmos")
model = AutoModelForCausalLM.from_pretrained("clivern/cosmos")
inputs = tok("astronomy and cosmology", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=60, do_sample=True, top_p=0.95)
print(tok.decode(out[0], skip_special_tokens=True))
- Downloads last month
- 27