Instructions to use JNX25/studyverse-smollm2-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JNX25/studyverse-smollm2-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JNX25/studyverse-smollm2-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("JNX25/studyverse-smollm2-instruct") model = AutoModelForCausalLM.from_pretrained("JNX25/studyverse-smollm2-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JNX25/studyverse-smollm2-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JNX25/studyverse-smollm2-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JNX25/studyverse-smollm2-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/JNX25/studyverse-smollm2-instruct
- SGLang
How to use JNX25/studyverse-smollm2-instruct 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 "JNX25/studyverse-smollm2-instruct" \ --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": "JNX25/studyverse-smollm2-instruct", "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 "JNX25/studyverse-smollm2-instruct" \ --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": "JNX25/studyverse-smollm2-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use JNX25/studyverse-smollm2-instruct with Docker Model Runner:
docker model run hf.co/JNX25/studyverse-smollm2-instruct
π CosmiQ AI β The Intelligent Assistant
CosmiQ AI is a highly-optimized, lightweight Small Language Model (SLM) designed for swift, multi-turn assistant-style conversations. Built on top of the SmolLM2 (135M) architecture, this model is fine-tuned to enable efficient, low-latency text generation directly on edge devices such as mobile phones and standard laptops without requiring heavy GPU infrastructure.
ποΈ Model Architecture
CosmiQ AI leverages a compact yet powerful architecture heavily inspired by the structural refinements found in foundational models like Llama-3:
- Architecture Type: Autoregressive Decoder-Only Transformer
- Parameters: 135 Million (13.5 Crore) β Perfect for local deployment with an extremely low memory footprint.
- Attention Mechanism: Grouped-Query Attention (GQA) to accelerate text streaming speed and optimize Key-Value (KV) cache utilization.
- Position Embeddings: Rotary Position Embedding (RoPE) for stable long-context processing.
- Vocabulary Size: 49,152 tokens.
π§ Training Methodology & Algorithms
The raw foundational knowledge was aligned into a conversational, assistant-ready state using two core paradigms:
- Supervised Fine-Tuning (SFT): The model underwent strict optimization to understand multi-turn conversation syntaxes, explicitly learning to track boundaries using special chat markers like
<|im_start|>userand<|im_start|>assistant. - Direct Preference Optimization (DPO): Aligned through preference optimization to output concise, factual, and helpful multi-turn responses while actively penalizing repetitive or unhelpful generations.
π Dataset Insights
The stellar accuracy of this 135M parameter model is a direct result of being trained on highly curated, high-quality synthetic datasets rather than unverified scraped web text:
- Cosmopedia v2: A massive synthetic dataset containing high-quality textbooks, structured academic tutorials, and educational narratives scaled using larger foundational models (like Mixtral). This enables CosmiQ AI to excel exceptionally well at science and academic queries (e.g., explaining photosynthesis, stomata, etc.).
- UltraChat & UltraFeedback: Highly polished conversational data used during instruction fine-tuning to perfect the modelβs persona, social interaction, and question-answering conversational flow.
π Deployment & Integration
This model is actively hosted and integrated into production via Hugging Face Spaces using a robust streaming architecture:
- Frontend UI Framework: Gradio 6
- Streaming Backend: PyTorch
TextIteratorStreamerrunning with advanced structural history filters to prevent null or misaligned conversational tensors from interrupting runtime processing.
Quick Usage via Transformers Pipeline
You can test and run this model locally using the following Python script:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "JNX25/studyverse-smollm2-instruct"
print("Loading Tokenizer & Model...")
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)
# Structuring a conversational thread
messages = [{"role": "user", "content": "Explain photosynthesis in one clear sentence."}]
rendered_chat = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Processing Tensors
inputs = tokenizer(rendered_chat, return_tensors="pt")
outputs = model.generate(
input_ids=inputs["input_ids"],
attention_mask=inputs["attention_mask"],
max_new_tokens=150,
do_sample=True,
temperature=0.7,
top_p=0.9,
eos_token_id=tokenizer.eos_token_id
)
print("\n--- Response ---")
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 13