Text Generation
Transformers
Safetensors
English
qwen2
solidity
smart-contracts
token-risk
lora
conversational
text-generation-inference
Instructions to use coronerai/coroner-coder-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use coronerai/coroner-coder-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="coronerai/coroner-coder-7b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("coronerai/coroner-coder-7b") model = AutoModelForCausalLM.from_pretrained("coronerai/coroner-coder-7b", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use coronerai/coroner-coder-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "coronerai/coroner-coder-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "coronerai/coroner-coder-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/coronerai/coroner-coder-7b
- SGLang
How to use coronerai/coroner-coder-7b 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 "coronerai/coroner-coder-7b" \ --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": "coronerai/coroner-coder-7b", "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 "coronerai/coroner-coder-7b" \ --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": "coronerai/coroner-coder-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use coronerai/coroner-coder-7b with Docker Model Runner:
docker model run hf.co/coronerai/coroner-coder-7b
|
Download README.md from coronerai/coroner-coder-7b: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/coronerai/coroner-coder-7b/resolve/main/README.md
- Command line
-
hf download hf://coronerai/coroner-coder-7b/README.md
-
curl -L -o README.md https://huggingface.co/coronerai/coroner-coder-7b/resolve/main/README.md
2.47 kB
| license: apache-2.0 | |
| base_model: Qwen/Qwen2.5-Coder-7B-Instruct | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - solidity | |
| - smart-contracts | |
| - token-risk | |
| - lora | |
| language: | |
| - en | |
|  | |
| # Coroner Coder 7B | |
| A small model that fixes the patterns the Coroner scanner flags in an ERC-20 token contract: it takes a Solidity source plus the scanner's flags and returns a corrected contract and a short list of changes. | |
| > Always compile and review the result yourself. A patch that compiles is not an audit. Not financial or security advice. | |
| ## What it fixes | |
| The same patterns the Coroner pre-mortem scanner reports from source code: | |
| `mint_with_live_owner`, `blacklist_function`, `pause_function`, `tax_changeable`, `risky_opcode` (selfdestruct, delegatecall, tx.origin) and `owner_privileges`. | |
| ## Training | |
| - Base: Qwen2.5-Coder-7B-Instruct (Apache 2.0). Method: LoRA (rank 16) on 4-bit weights, one epoch (88 steps), then merged to 16-bit. | |
| - Data: 1,400 synthetic examples. Each is a flawed token contract with its fix, generated from templates in two source layouts. **Every target is verified**: the corrected contract compiles with solc 0.8.24, keeps the ERC-20 interface and clears the flagged patterns. Generator and verifier: https://github.com/coroner-hash/ai/tree/main/coder | |
| ## Evaluation | |
| A fix counts only if the patched contract compiles, keeps the ERC-20 interface, clears every flag and adds none. 40 held-out contracts in a third source layout the model never saw in training (greedy decoding): | |
| | | Base model | Coroner Coder | | |
| |---|---|---| | |
| | Compiles | 1.00 | 0.925 | | |
| | Flags cleared | 0.125 | 0.925 | | |
| | Full fix (all checks) | 0.125 | 0.925 | | |
| Returning the contract unchanged scores 0.05. In the layouts it was trained on the model scores 1.00, which mostly shows it learned the templates. | |
| ## Limits | |
| - **Synthetic, narrow data.** All contracts are single-file ERC-20 variants without imports. Real contracts from a market will be messier; expect lower numbers. This is a first version. | |
| - About 1 in 13 outputs did not compile in the held-out test. Always compile. | |
| - It removes risky features; it does not find new bugs, and it can change behaviour. Review the diff. | |
| - Only the scanner's six patterns. Not a general Solidity auditor. | |
| Source, data generator and scorer: https://github.com/coroner-hash/ai | |