Text Generation
Transformers
Safetensors
English
code
helion-osc
mathematics
reasoning
algorithm
causal-lm
conversational
bitsandbytes
Run this model with HF Jobs
Run DeepXR/Helion-OSC on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/DeepXR/Helion-OSC. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/DeepXR/Helion-OSC on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/DeepXR/Helion-OSC. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/DeepXR/Helion-OSC. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use DeepXR/Helion-OSC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DeepXR/Helion-OSC with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DeepXR/Helion-OSC") 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("DeepXR/Helion-OSC", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DeepXR/Helion-OSC with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DeepXR/Helion-OSC" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DeepXR/Helion-OSC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/DeepXR/Helion-OSC
- SGLang
How to use DeepXR/Helion-OSC 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 "DeepXR/Helion-OSC" \ --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": "DeepXR/Helion-OSC", "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 "DeepXR/Helion-OSC" \ --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": "DeepXR/Helion-OSC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use DeepXR/Helion-OSC with Docker Model Runner:
docker model run hf.co/DeepXR/Helion-OSC
Create inference.py
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143"""Helion-OSC Inference ScriptDeepXR/Helion-OSC - Mathematical Coding Language Model"""
import torchfrom transformers import AutoTokenizer, AutoModelForCausalLMfrom typing import Optional, Dict, Any
class HelionOSCInference: """Inference wrapper for Helion-OSC model""" def __init__( self, model_name: str = "DeepXR/Helion-OSC", device: Optional[str] = None, load_in_8bit: bool = False ): """ Initialize the Helion-OSC model Args: model_name: HuggingFace model identifier device: Device to load model on (cuda/cpu) load_in_8bit: Whether to load model in 8-bit precision """ self.device = device or ("cuda" if torch.cuda.is_available() else "cpu") print(f"Loading Helion-OSC on {self.device}...") self.tokenizer = AutoTokenizer.from_pretrained(model_name) model_kwargs = {"device_map": "auto"} if self.device == "cuda" else {} if load_in_8bit: model_kwargs["load_in_8bit"] = True self.model = AutoModelForCausalLM.from_pretrained( model_name, torch_dtype=torch.bfloat16 if self.device == "cuda" else torch.float32, **model_kwargs ) if self.device == "cpu": self.model = self.model.to(self.device) self.model.eval() print("Model loaded successfully!") def generate( self, prompt: str, max_length: int = 512, temperature: float = 0.7, top_p: float = 0.95, top_k: int = 50, num_return_sequences: int = 1, do_sample: bool = True, **kwargs ) -> str: """ Generate code or text based on prompt Args: prompt: Input prompt max_length: Maximum length of generated text temperature: Sampling temperature top_p: Nucleus sampling parameter top_k: Top-k sampling parameter num_return_sequences: Number of sequences to generate do_sample: Whether to use sampling Returns: Generated text """ inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device) with torch.no_grad(): outputs = self.model.generate( **inputs, max_length=max_length, temperature=temperature, top_p=top_p, top_k=top_k, num_return_sequences=num_return_sequences, do_sample=do_sample, pad_token_id=self.tokenizer.eos_token_id, **kwargs ) generated_text = self.tokenizer.decode(outputs[0], skip_special_tokens=True) return generated_text def code_generation(self, prompt: str, max_length: int = 1024) -> str: """Optimized for code generation tasks""" return self.generate( prompt, max_length=max_length, temperature=0.7, top_p=0.95, do_sample=True ) def mathematical_reasoning(self, prompt: str, max_length: int = 512) -> str: """Optimized for mathematical reasoning tasks""" return self.generate( prompt, max_length=max_length, temperature=0.3, top_p=0.9, do_sample=False )
def main(): """Example usage""" # Initialize model helion = HelionOSCInference() # Example 1: Code generation code_prompt = "Write a Python function to calculate the factorial of a number using recursion:" print("\n=== Code Generation ===") print(f"Prompt: {code_prompt}") result = helion.code_generation(code_prompt) print(f"Output:\n{result}\n") # Example 2: Mathematical reasoning math_prompt = "Prove that the sum of first n natural numbers is n(n+1)/2:" print("\n=== Mathematical Reasoning ===") print(f"Prompt: {math_prompt}") result = helion.mathematical_reasoning(math_prompt) print(f"Output:\n{result}\n") # Example 3: Algorithm design algo_prompt = "Design an efficient algorithm to find the longest palindromic substring:" print("\n=== Algorithm Design ===") print(f"Prompt: {algo_prompt}") result = helion.generate(algo_prompt, max_length=1024) print(f"Output:\n{result}\n")
if __name__ == "__main__": main()inference.pyAdded+143