Text Generation
PEFT
Safetensors
Transformers
qwen2
lora
coding
code-generation
conversational
text-generation-inference
Instructions to use girish00/ConicAI_LLM_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use girish00/ConicAI_LLM_model with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-0.5B-Instruct") model = PeftModel.from_pretrained(base_model, "girish00/ConicAI_LLM_model") - Transformers
How to use girish00/ConicAI_LLM_model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="girish00/ConicAI_LLM_model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("girish00/ConicAI_LLM_model") model = AutoModelForCausalLM.from_pretrained("girish00/ConicAI_LLM_model", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use girish00/ConicAI_LLM_model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "girish00/ConicAI_LLM_model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "girish00/ConicAI_LLM_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/girish00/ConicAI_LLM_model
- SGLang
How to use girish00/ConicAI_LLM_model 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 "girish00/ConicAI_LLM_model" \ --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": "girish00/ConicAI_LLM_model", "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 "girish00/ConicAI_LLM_model" \ --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": "girish00/ConicAI_LLM_model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use girish00/ConicAI_LLM_model with Docker Model Runner:
docker model run hf.co/girish00/ConicAI_LLM_model
add structured endpoint handler
Browse files
README.md
CHANGED
|
@@ -12,6 +12,7 @@ This project fine-tunes `Qwen/Qwen2.5-Coder-0.5B-Instruct` using LoRA for:
|
|
| 12 |
- `finetune_coding_llm_colab.py`: local training script (LoRA) + optional upload
|
| 13 |
- `infer_local.py`: test local trained model with structured JSON output
|
| 14 |
- `infer_cloud.py`: run Hugging Face API inference and force the same structured JSON output
|
|
|
|
| 15 |
- `evaluate_model.py`: run multi-prompt quality checks and report accuracy
|
| 16 |
- `upload_to_hf.py`: upload local model folder to HF
|
| 17 |
- `run_pipeline.py`: one command for generate + train (+ optional upload)
|
|
@@ -171,6 +172,37 @@ python infer_cloud.py --prompt "Fix this code: def add(a,b) return a+b" --no-loc
|
|
| 171 |
`infer_cloud.py` applies the same JSON parsing, Python syntax check, relevancy score, hallucination flag, and auto-repair fallback as `infer_local.py`. If Hugging Face cannot serve your custom model repo through an inference provider, the script automatically falls back to the local `model/` folder so the command still returns the local-style JSON. Use `--no-local-fallback` if you want cloud-only failure behavior.
|
| 172 |
|
| 173 |
Hosted Hugging Face API calls usually do not return token logits, so `important_tokens` may be empty and `confidence` may be `0.0` unless your endpoint returns token-level details. When the local fallback runs, those fields are computed the same way as `infer_local.py`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
Explicit base model for LoRA adapter loading:
|
| 176 |
|
|
|
|
| 12 |
- `finetune_coding_llm_colab.py`: local training script (LoRA) + optional upload
|
| 13 |
- `infer_local.py`: test local trained model with structured JSON output
|
| 14 |
- `infer_cloud.py`: run Hugging Face API inference and force the same structured JSON output
|
| 15 |
+
- `handler.py`: custom Hugging Face Inference Endpoint handler that returns the same JSON contract from the hosted endpoint
|
| 16 |
- `evaluate_model.py`: run multi-prompt quality checks and report accuracy
|
| 17 |
- `upload_to_hf.py`: upload local model folder to HF
|
| 18 |
- `run_pipeline.py`: one command for generate + train (+ optional upload)
|
|
|
|
| 172 |
`infer_cloud.py` applies the same JSON parsing, Python syntax check, relevancy score, hallucination flag, and auto-repair fallback as `infer_local.py`. If Hugging Face cannot serve your custom model repo through an inference provider, the script automatically falls back to the local `model/` folder so the command still returns the local-style JSON. Use `--no-local-fallback` if you want cloud-only failure behavior.
|
| 173 |
|
| 174 |
Hosted Hugging Face API calls usually do not return token logits, so `important_tokens` may be empty and `confidence` may be `0.0` unless your endpoint returns token-level details. When the local fallback runs, those fields are computed the same way as `infer_local.py`.
|
| 175 |
+
|
| 176 |
+
### Cloud Output Guarantee
|
| 177 |
+
|
| 178 |
+
To make other users receive this JSON pattern with their own token, deploy this repository as a Hugging Face Dedicated Inference Endpoint. The included `handler.py` is loaded by the endpoint and returns:
|
| 179 |
+
|
| 180 |
+
```json
|
| 181 |
+
{
|
| 182 |
+
"code": "string",
|
| 183 |
+
"explanation": "string",
|
| 184 |
+
"confidence": 0.0,
|
| 185 |
+
"important_tokens": [],
|
| 186 |
+
"relevancy_score": 0.0,
|
| 187 |
+
"hallucination": false,
|
| 188 |
+
"hallucination_check_reason": "string",
|
| 189 |
+
"latency_ms": 0
|
| 190 |
+
}
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
Endpoint request example:
|
| 194 |
+
|
| 195 |
+
```powershell
|
| 196 |
+
$env:HF_TOKEN="their_huggingface_token"
|
| 197 |
+
Invoke-RestMethod `
|
| 198 |
+
-Uri "https://your-endpoint-url.endpoints.huggingface.cloud" `
|
| 199 |
+
-Method Post `
|
| 200 |
+
-Headers @{ Authorization = "Bearer $env:HF_TOKEN" } `
|
| 201 |
+
-ContentType "application/json" `
|
| 202 |
+
-Body '{"inputs":"Fix this code: def add(a,b) return a+b","parameters":{"max_new_tokens":320}}'
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
Calling the model repository directly through Hugging Face serverless inference is not enough if Hugging Face has no provider serving the custom repo. Use a Dedicated Inference Endpoint or your own cloud VM for true cloud execution.
|
| 206 |
|
| 207 |
Explicit base model for LoRA adapter loading:
|
| 208 |
|