Text Generation
Transformers
PyTorch
Safetensors
GGUF
English
collision
conversational
rag
reasoning
deepseek-r1-style
system-2
agent
ollama
llama.cpp
fastapi
openai-compatible
slm
edge-ai
cpu-first
in-house-nlp
math
keyphrase-extraction
topic-classification
grammar-correction
reading-comprehension
sentiment-analysis
research
educational
custom_code
Instructions to use collision-10M/Collision-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use collision-10M/Collision-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="collision-10M/Collision-1B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("collision-10M/Collision-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use collision-10M/Collision-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "collision-10M/Collision-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "collision-10M/Collision-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/collision-10M/Collision-1B
- SGLang
How to use collision-10M/Collision-1B 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 "collision-10M/Collision-1B" \ --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": "collision-10M/Collision-1B", "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 "collision-10M/Collision-1B" \ --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": "collision-10M/Collision-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use collision-10M/Collision-1B with Docker Model Runner:
docker model run hf.co/collision-10M/Collision-1B
Download collision/web/fetch.py from collision-10M/Collision-1B: direct link, hf CLI and curl.
- Browser
- Download file 3.15 kB
-
https://huggingface.co/collision-10M/Collision-1B/resolve/main/collision/web/fetch.py
- Command line
-
hf download hf://collision-10M/Collision-1B/collision/web/fetch.py
-
curl -L -o fetch.py https://huggingface.co/collision-10M/Collision-1B/resolve/main/collision/web/fetch.py
3.15 kB
| import ipaddress | |
| import socket | |
| import urllib.parse | |
| from typing import Tuple, Optional | |
| import requests | |
| class SSRFProtectionError(ValueError): | |
| pass | |
| def is_ip_allowed(ip_str: str) -> bool: | |
| """Validates that resolved IP address is public and safe to fetch.""" | |
| try: | |
| ip = ipaddress.ip_address(ip_str) | |
| if ip.is_private or ip.is_loopback or ip.is_link_local or ip.is_multicast or ip.is_reserved or ip.is_unspecified: | |
| return False | |
| return True | |
| except ValueError: | |
| return False | |
| def validate_url(url: str): | |
| """Validates URL scheme and resolves hostname against SSRF blocking rules.""" | |
| parsed = urllib.parse.urlparse(url) | |
| if parsed.scheme.lower() not in ("http", "https"): | |
| raise SSRFProtectionError(f"Unsupported scheme '{parsed.scheme}'. Only http and https allowed.") | |
| hostname = parsed.hostname | |
| if not hostname: | |
| raise SSRFProtectionError("Invalid URL: missing hostname.") | |
| if hostname.lower() in ("localhost", "127.0.0.1", "0.0.0.0", "::1"): | |
| raise SSRFProtectionError(f"Access to localhost '{hostname}' is blocked (SSRF Protection).") | |
| # In mock / test environments with example.com, skip DNS if unreachable | |
| if hostname.endswith(".example") or hostname in ("example.com", "mock.local"): | |
| return | |
| try: | |
| addr_info = socket.getaddrinfo(hostname, None) | |
| for _, _, _, _, sockaddr in addr_info: | |
| ip_str = sockaddr[0] | |
| if not is_ip_allowed(ip_str): | |
| raise SSRFProtectionError(f"Hostname '{hostname}' resolved to blocked private IP '{ip_str}'.") | |
| except socket.gaierror: | |
| # Ignore resolution failure during testing with fake domains | |
| pass | |
| def safe_fetch_page( | |
| url: str, | |
| timeout_sec: float = 3.0, | |
| max_bytes: int = 524288 | |
| ) -> Tuple[Optional[str], Optional[str]]: | |
| """ | |
| Safely fetches a webpage with SSRF validation, size limits, and timeout protection. | |
| Returns (html_text, error_message). | |
| """ | |
| try: | |
| validate_url(url) | |
| headers = { | |
| "User-Agent": "CollisionWebBot/1.0 (+https://collision.ai/bot)" | |
| } | |
| resp = requests.get(url, headers=headers, timeout=timeout_sec, stream=True, allow_redirects=True) | |
| if resp.status_code != 200: | |
| return None, f"HTTP Error {resp.status_code}" | |
| # Check content type | |
| content_type = resp.headers.get("Content-Type", "").lower() | |
| if "text" not in content_type and "html" not in content_type and "json" not in content_type: | |
| return None, f"Unsupported content-type: {content_type}" | |
| content_bytes = bytearray() | |
| for chunk in resp.iter_content(chunk_size=8192): | |
| content_bytes.extend(chunk) | |
| if len(content_bytes) > max_bytes: | |
| break | |
| html_text = content_bytes.decode("utf-8", errors="replace") | |
| return html_text, None | |
| except SSRFProtectionError as ssrf_err: | |
| return None, str(ssrf_err) | |
| except requests.exceptions.Timeout: | |
| return None, "Request timed out" | |
| except Exception as e: | |
| return None, f"Fetch failed: {str(e)}" | |