Text Generation
Transformers
Safetensors
English
lfm3
llm
language-model
open-source
instruction-following
conversational
custom_code
Instructions to use cosmicstack/cosmic-lightning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cosmicstack/cosmic-lightning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cosmicstack/cosmic-lightning", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("cosmicstack/cosmic-lightning", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cosmicstack/cosmic-lightning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cosmicstack/cosmic-lightning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cosmicstack/cosmic-lightning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cosmicstack/cosmic-lightning
- SGLang
How to use cosmicstack/cosmic-lightning 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 "cosmicstack/cosmic-lightning" \ --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": "cosmicstack/cosmic-lightning", "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 "cosmicstack/cosmic-lightning" \ --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": "cosmicstack/cosmic-lightning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cosmicstack/cosmic-lightning with Docker Model Runner:
docker model run hf.co/cosmicstack/cosmic-lightning
|
Download README.md from cosmicstack/cosmic-lightning: direct link, hf CLI and curl.
- Browser
- Download file 7.07 kB
-
https://huggingface.co/cosmicstack/cosmic-lightning/resolve/main/README.md
- Command line
-
hf download hf://cosmicstack/cosmic-lightning/README.md
-
curl -L -o README.md https://huggingface.co/cosmicstack/cosmic-lightning/resolve/main/README.md
7.07 kB
| language: en | |
| license: apache-2.0 | |
| library_name: transformers | |
| tags: | |
| - llm | |
| - language-model | |
| - open-source | |
| - instruction-following | |
| widget: | |
| - text: "What is machine learning?" | |
| example_title: "Explanation" | |
| - text: "Write a Python function to reverse a string." | |
| example_title: "Code Generation" | |
| - text: "Summarize: The rapid advancement of AI has transformed industries worldwide, enabling automation, improved decision-making, and new forms of human-computer interaction." | |
| example_title: "Summarization" | |
| # Cosmic Lightning | |
| **A blazingly fast, open-source language model optimized for efficiency and versatility.** | |
| Cosmic Lightning is a compact yet capable language model designed for efficient inference across a wide range of tasks—from code generation and summarization to reasoning and creative writing. Built with a focus on speed and adaptability, it delivers strong performance without demanding extensive computational resources. | |
| ## Model Details | |
| - **Model Type:** Transformer-based Language Model | |
| - **Architecture:** Optimized causal language model | |
| - **Parameters:** Compact architecture optimized for edge and cloud inference | |
| - **Training Data:** Diverse multilingual and code datasets | |
| - **Language(s):** English, with support for multilingual context | |
| - **License:** Apache 2.0 | |
| - **Developed by:** Cosmic Stack | |
| - **Repository:** [Hugging Face Hub](https://huggingface.co/cosmicstack/cosmic-lightning) | |
| ## Intended Use | |
| ### Direct Use | |
| Cosmic Lightning is designed for: | |
| - **Text Generation:** Generate coherent, contextually relevant text for various domains | |
| - **Code Generation:** Write code snippets, functions, and scripts | |
| - **Summarization:** Condense documents, articles, and long-form content | |
| - **Question Answering:** Answer factual and analytical questions | |
| - **Instruction Following:** Execute tasks from natural language prompts | |
| ### Example Usage | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| # Load the model and tokenizer | |
| model_name = "cosmicstack/cosmic-lightning" | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_name, | |
| torch_dtype=torch.float16, | |
| device_map="auto", | |
| ) | |
| # Generate text | |
| prompt = "Explain quantum computing in simple terms:" | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| with torch.no_grad(): | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=256, | |
| temperature=0.7, | |
| top_p=0.9, | |
| do_sample=True, | |
| ) | |
| response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ### Downstream Use | |
| You can fine-tune Cosmic Lightning for domain-specific tasks: | |
| ```python | |
| from transformers import Trainer, TrainingArguments | |
| # Requires a prepared tokenized training dataset named train_dataset. | |
| training_args = TrainingArguments( | |
| output_dir="./cosmic-lightning-finetuned", | |
| num_train_epochs=3, | |
| per_device_train_batch_size=4, | |
| learning_rate=2e-5, | |
| save_strategy="epoch", | |
| ) | |
| trainer = Trainer( | |
| model=model, | |
| args=training_args, | |
| train_dataset=train_dataset, | |
| ) | |
| trainer.train() | |
| ``` | |
| ## Performance | |
| Cosmic Lightning achieves strong results on standard benchmarks: | |
| - Efficient inference: Optimized for both latency and throughput | |
| - Versatile reasoning: Handles diverse task types with consistent quality | |
| - Resource-efficient: Runs on consumer-grade GPUs and CPUs | |
| ## Bias, Risks, and Limitations | |
| ### Known Limitations | |
| - **Knowledge Cutoff:** Training data has a knowledge cutoff; may not reflect recent events or developments | |
| - **Factual Accuracy:** While generally reliable, the model can generate plausible-sounding but incorrect information (hallucinations) | |
| - **Context Length:** Performance may degrade on very long documents near the token limit | |
| - **Domain Specificity:** Best performance on general tasks; domain-specific knowledge may be limited | |
| ### Recommendations | |
| - **Fact-Checking:** Verify factual claims, especially for high-stakes applications | |
| - **Prompt Engineering:** Use clear, specific prompts for better results | |
| - **Temperature Tuning:** Adjust temperature based on task—lower for factuality, higher for creativity | |
| - **Evaluation:** Always evaluate outputs for your specific use case | |
| ### Out-of-Scope Uses | |
| - **Autonomous High-Stakes Decisions:** Do not rely solely on this model for critical decisions (medical, legal, financial) | |
| - **Generating Harmful Content:** Not intended for generating hate speech, violence, or illegal content | |
| - **Impersonation:** Should not be used to impersonate real individuals or organizations | |
| ## Training Details | |
| ### Training Data | |
| Cosmic Lightning was trained on a diverse corpus including: | |
| - High-quality web text and documentation | |
| - Code repositories and technical documentation | |
| - Multilingual text resources | |
| The model underwent careful curation to ensure quality and diversity while maintaining safety standards. | |
| ### Training Procedure | |
| - **Optimization:** Standard language modeling with next-token prediction | |
| - **Distributed Training:** Optimized for efficient large-scale training | |
| - **Evaluation:** Continuous evaluation on standard benchmarks during training | |
| ## Hardware Requirements | |
| ### Minimum Requirements | |
| - **GPU Memory:** 8GB VRAM (FP16) for inference; 16GB+ for fine-tuning | |
| - **RAM:** 4GB system RAM | |
| - **Storage:** ~5-10GB for model weights and dependencies | |
| ### Recommended Setup | |
| - **GPU:** NVIDIA GPU with CUDA support (H100, A100, RTX 4090 for optimal performance) | |
| - **Framework:** PyTorch 2.0+ | |
| - **Transformers:** Version 4.30+ | |
| ## How to Get Started | |
| ### Installation | |
| ```bash | |
| pip install transformers torch accelerate | |
| ``` | |
| ### Quick Start | |
| ```python | |
| from transformers import pipeline | |
| # Use the high-level pipeline API | |
| generator = pipeline("text-generation", model="cosmicstack/cosmic-lightning") | |
| result = generator( | |
| "Once upon a time", | |
| max_new_tokens=100, | |
| num_return_sequences=1, | |
| ) | |
| print(result[0]["generated_text"]) | |
| ``` | |
| ### Using with Ollama (Local Inference) | |
| ```bash | |
| ollama pull cosmicstack/cosmic-lightning | |
| ollama run cosmicstack/cosmic-lightning "Explain photosynthesis" | |
| ``` | |
| ## Citation | |
| If you use Cosmic Lightning in your work, please cite: | |
| ```bibtex | |
| @misc{cosmic-lightning-2026, | |
| title={Cosmic Lightning: A Compact Language Model for Efficient Inference}, | |
| author={Cosmic Stack}, | |
| year={2026}, | |
| publisher={Hugging Face} | |
| } | |
| ``` | |
| ## Environmental Impact | |
| Training this model required significant computational resources. For details on environmental impact and carbon emissions, see our [environmental impact report](https://cosmicstack.ai/sustainability). | |
| ## More Information | |
| - **GitHub:** [Cosmic Stack GitHub](https://github.com/cosmicstack-labs) | |
| - **Documentation:** [Full Documentation](https://cosmicstack.ai) | |
| ## Model Card Contact | |
| For questions, feedback, or improvements to this model card: | |
| - **Email:** hello@cosmicstack.ai | |
| - **Issues:** [GitHub Issues](https://github.com/cosmicstack-labs) | |
| --- | |
| **Version:** 1.0 | |
| **Last Updated:** October 2026 | |
| **License:** Apache 2.0 | |
| ```` | |