Text Generation
Transformers
PyTorch
Indonesian
English
code
mesosfer
bear-ai
llama-architecture
causal-lm
Instructions to use Dummy9898/bear-240m-cpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dummy9898/bear-240m-cpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Dummy9898/bear-240m-cpt")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Dummy9898/bear-240m-cpt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Dummy9898/bear-240m-cpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Dummy9898/bear-240m-cpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dummy9898/bear-240m-cpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Dummy9898/bear-240m-cpt
- SGLang
How to use Dummy9898/bear-240m-cpt 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 "Dummy9898/bear-240m-cpt" \ --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": "Dummy9898/bear-240m-cpt", "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 "Dummy9898/bear-240m-cpt" \ --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": "Dummy9898/bear-240m-cpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Dummy9898/bear-240m-cpt with Docker Model Runner:
docker model run hf.co/Dummy9898/bear-240m-cpt
π» Mesosfer Bear AI - CPT
Mesosfer Bear AI (241.8M) is a high-efficiency autoregressive decoder-only language model built on a Llama-style architecture. This repository contains the official model weights and runtime engine for CPT ().
π Model Architecture Highlights
- Parameters: 241,828,864 (241.8M)
- Layers / Depth: 16 transformer blocks
- Hidden Dimension (
d_model): 1024 - FFN Hidden Dimension: 2816 (SwiGLU activation)
- Attention Heads: 16 Query heads / 4 KV heads (Grouped Query Attention 4:1)
- Context Length: 4096 tokens
- Positional Encoding: Rotary Position Embeddings (RoPE, $\theta=10000$)
- Tokenizer: 60,000 vocabulary based on Kimi-K3 BPE with native XTML markup (
<|open|>...<|close|>) and Rusttiktokenacceleration. - Training Step: Step 5,000 (Loss:
2.5907)
π Quickstart: Running Inference
You can run text generation and chat streaming immediately with zero external frameworks:
1. Installation
git clone https://huggingface.co/{REPO_ID}
cd {REPO_NAME}
pip install torch tiktoken
2. Standalone Inference Script
python inference.py --prompt "Jelaskan konsep machine learning secara singkat:"
3. Interactive Streaming Chat CLI
python cli.py --temperature 0.7 --top-p 0.9
4. Python API Usage
from engine.transformer import BearTransformer, BearConfig
from engine.tokenizer import BearTokenizer
import torch
# Load Tokenizer & Model
tokenizer = BearTokenizer.load("bear_tokenizer.json")
config = BearConfig.from_dict(torch.load("config.json"))
model = BearTransformer(config)
checkpoint = torch.load("bear_model.pt", map_location="cuda" if torch.cuda.is_available() else "cpu")
model.load_state_dict(checkpoint["model_state"] if "model_state" in checkpoint else checkpoint)
model.eval()
# Chat format
conversation = [
{"role": "system", "content": "Anda adalah asisten AI Bear yang cerdas dan ramah."},
{"role": "user", "content": "Halo! Siapa kamu?"}
]
prompt = tokenizer.apply_chat_template(conversation, thinking=True)
input_ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long)
output_ids = model.generate(input_ids, max_new_tokens=256, temperature=0.7, top_p=0.9)
response = tokenizer.decode(output_ids[0].tolist())
print(response)
π License
Distributed under the Apache-2.0 License. Developed by Mesosfer Team.
- Downloads last month
- 137