Text Generation
Transformers
PyTorch
Safetensors
code
llama
python
javascript
cpp
sql
html
code-generation
codebharat
PyTorch
byte-level-bpe
text-generation-inference
Instructions to use Ravi5528/codebharat-100m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ravi5528/codebharat-100m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ravi5528/codebharat-100m")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ravi5528/codebharat-100m") model = AutoModelForCausalLM.from_pretrained("Ravi5528/codebharat-100m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Ravi5528/codebharat-100m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ravi5528/codebharat-100m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ravi5528/codebharat-100m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ravi5528/codebharat-100m
- SGLang
How to use Ravi5528/codebharat-100m 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 "Ravi5528/codebharat-100m" \ --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": "Ravi5528/codebharat-100m", "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 "Ravi5528/codebharat-100m" \ --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": "Ravi5528/codebharat-100m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ravi5528/codebharat-100m with Docker Model Runner:
docker model run hf.co/Ravi5528/codebharat-100m
CodeBharat-100M
CodeBharat-100M is a 100.68M parameter decoder-only Transformer pretrained from scratch on code (Python, JavaScript, TypeScript, C++, SQL, HTML/CSS, and synthetic textbooks).
Model Details
- Architecture: Decoder-Only Transformer (Llama/Qwen-style: RMSNorm, RoPE, SwiGLU, Grouped-Query Attention)
- Parameters: 100,679,424 (100.68M)
- Vocabulary: 49,152 tokens (Byte-level BPE)
- Context Window: 1,024 tokens
- Training Device: NVIDIA GeForce RTX 5050 GPU
- Final Validation Loss: 1.3891
Quickstart Usage
Native PyTorch / Tokenizers Usage
import torch
from tokenizers import Tokenizer
from pathlib import Path
# Load tokenizer and model weights
tokenizer = Tokenizer.from_file("tokenizer.json")
weights = torch.load("pytorch_model.bin", map_location="cuda" if torch.cuda.is_available() else "cpu")
Run Inference via CLI
python 100m-codebharat/scripts/11_generate.py --prompt "def binary_search(arr, target):"
Model Card Info
- Developed by: CodeBharat Team
- Model Type: Causal Language Model for Code
- License: Apache 2.0
- Downloads last month
- -