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
File size: 1,352 Bytes
6af0329 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | """Upload exported CodeBharat-100M model folder to Hugging Face Hub.
Usage:
python upload_to_hf.py --repo-id "YOUR_USERNAME/codebharat-100m" --token "YOUR_HF_TOKEN"
"""
import argparse
from pathlib import Path
from huggingface_hub import HfApi, create_repo
def main():
parser = argparse.ArgumentParser(description="Upload CodeBharat-100M to Hugging Face Hub")
parser.add_argument("--repo-id", type=str, required=True, help="Target HF repo ID, e.g. username/codebharat-100m")
parser.add_argument("--token", type=str, default=None, help="Hugging Face User Access Token (write permission)")
parser.add_argument("--private", action="store_true", help="Create as a private repository")
args = parser.parse_args()
model_dir = Path(__file__).resolve().parent
api = HfApi()
print(f"[hf-upload] Creating repository: {args.repo_id}")
create_repo(repo_id=args.repo_id, token=args.token, private=args.private, exist_ok=True)
print(f"[hf-upload] Uploading files from {model_dir} to {args.repo_id}...")
api.upload_folder(
folder_path=str(model_dir),
repo_id=args.repo_id,
repo_type="model",
token=args.token,
)
print(f"[done] Model successfully published at: https://huggingface.co/{args.repo_id}")
if __name__ == "__main__":
main()
|