Instructions to use iaroy/sgc-522m-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iaroy/sgc-522m-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iaroy/sgc-522m-base", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("iaroy/sgc-522m-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use iaroy/sgc-522m-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iaroy/sgc-522m-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iaroy/sgc-522m-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/iaroy/sgc-522m-base
- SGLang
How to use iaroy/sgc-522m-base 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 "iaroy/sgc-522m-base" \ --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": "iaroy/sgc-522m-base", "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 "iaroy/sgc-522m-base" \ --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": "iaroy/sgc-522m-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use iaroy/sgc-522m-base with Docker Model Runner:
docker model run hf.co/iaroy/sgc-522m-base
Configuration Parsing Warning:In tokenizer_config.json: "tokenizer_config.chat_template" does not match any of the allowed types
sgc-522m-base
sgc (Single-GPU Coder) is a 522M-parameter decoder-only transformer for Python and C++ code. This repository holds the pretrained model: trained from scratch on 103B tokens of code, web text and math in 76.3 hours on one NVIDIA GH200 GPU, first with a context of 8,192 tokens at the file level, then 32,768 at the repository level. It completes code and fills in the middle; it is not a chat model. The post-trained models are sgc-522m-sft and sgc-522m.
- Paper: One GPU, 0.1 Trillion Tokens: Pretraining a Sub-Billion-Parameter Code Model
- Code, training and evaluation records: github.com/indrajeetadityaroy9/single-gpu-code-llm
- Pretraining data: iaroy/sgc-data
Results
pass@1 with greedy decoding, scored by each benchmark's official tool.
| Benchmark | pass@1 |
|---|---|
| HumanEval / HumanEval+ (EvalPlus) | 26.8 / 22.0 |
| MBPP / MBPP+ (EvalPlus) | 44.4 / 36.5 |
| MBPP, 3-shot (lm-evaluation-harness) | 32.2 |
| HumanEval-C++ / MBPP-C++ (MultiPL-E) | 21.7 / 36.8 |
| HumanEval infilling: single-line / multi-line / random-span | 55.3 / 26.1 / 11.3 |
Usage
Code completion: give the start of a file or function; the model continues it and ends with <|bos|>, its
end-of-text token. The tokenizer adds <|bos|> at the start of every encoding, so do not add it yourself.
Fill-in-the-middle, in prefix-suffix-middle order (the tokenizer adds the leading <|bos|>):
<|fim▁begin|>{prefix}<|fim▁hole|>{suffix}<|fim▁end|>
The model writes the middle and ends it with <|bos|>. Load it with transformers (trust_remote_code=True) or serve
it with vLLM (vllm serve iaroy/sgc-522m-base --trust-remote-code --dtype bfloat16).
- Downloads last month
- 30