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)# pip install -U transformers accelerate # 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=256) 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 cloud structured inference wrapper
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207---base_model: Qwen/Qwen2.5-Coder-0.5B-Instructlibrary_name: peftpipeline_tag: text-generationtags:- base_model:adapter:Qwen/Qwen2.5-Coder-0.5B-Instruct- lora- transformers---# Model Card for Model ID<!-- Provide a quick summary of what the model is/does. -->## Model Details### Model Description<!-- Provide a longer summary of what this model is. -->- **Developed by:** [More Information Needed]- **Funded by [optional]:** [More Information Needed]- **Shared by [optional]:** [More Information Needed]- **Model type:** [More Information Needed]- **Language(s) (NLP):** [More Information Needed]- **License:** [More Information Needed]- **Finetuned from model [optional]:** [More Information Needed]### Model Sources [optional]<!-- Provide the basic links for the model. -->- **Repository:** [More Information Needed]- **Paper [optional]:** [More Information Needed]- **Demo [optional]:** [More Information Needed]## Uses<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->### Direct Use<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->[More Information Needed]### Downstream Use [optional]<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->[More Information Needed]### Out-of-Scope Use<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->[More Information Needed]## Bias, Risks, and Limitations<!-- This section is meant to convey both technical and sociotechnical limitations. -->[More Information Needed]### Recommendations<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.## How to Get Started with the ModelUse the code below to get started with the model.[More Information Needed]## Training Details### Training Data<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->[More Information Needed]### Training Procedure<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->#### Preprocessing [optional][More Information Needed]#### Training Hyperparameters- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->#### Speeds, Sizes, Times [optional]<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->[More Information Needed]## Evaluation<!-- This section describes the evaluation protocols and provides the results. -->### Testing Data, Factors & Metrics#### Testing Data<!-- This should link to a Dataset Card if possible. -->[More Information Needed]#### Factors<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->[More Information Needed]#### Metrics<!-- These are the evaluation metrics being used, ideally with a description of why. -->[More Information Needed]### Results[More Information Needed]#### Summary## Model Examination [optional]<!-- Relevant interpretability work for the model goes here -->[More Information Needed]## Environmental Impact<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).- **Hardware Type:** [More Information Needed]- **Hours used:** [More Information Needed]- **Cloud Provider:** [More Information Needed]- **Compute Region:** [More Information Needed]- **Carbon Emitted:** [More Information Needed]## Technical Specifications [optional]### Model Architecture and Objective[More Information Needed]### Compute Infrastructure[More Information Needed]#### Hardware[More Information Needed]#### Software[More Information Needed]## Citation [optional]<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->**BibTeX:**[More Information Needed]**APA:**[More Information Needed]## Glossary [optional]<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->[More Information Needed]## More Information [optional][More Information Needed]## Model Card Authors [optional][More Information Needed]## Model Card Contact[More Information Needed]### Framework versions- PEFT 0.19.0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195# Advanced Fine-Tune Coding Model (Local + Hugging Face)This project fine-tunes `Qwen/Qwen2.5-Coder-0.5B-Instruct` using LoRA for:- code fixing- debugging- explanation- confidence and relevancy-aware outputs## Files- `generate_dataset.py`: creates training dataset (5k-10k)- `finetune_coding_llm_colab.py`: local training script (LoRA) + optional upload- `infer_local.py`: test local trained model with structured JSON output- `infer_cloud.py`: run Hugging Face API inference and force the same structured JSON output- `evaluate_model.py`: run multi-prompt quality checks and report accuracy- `upload_to_hf.py`: upload local model folder to HF- `run_pipeline.py`: one command for generate + train (+ optional upload)- `requirements.txt`: Python dependencies- `training_config.json`: default values automatically used by `run_pipeline.py`## Local Setup (No Colab)Install dependencies:```bashpip install -r requirements.txt```Generate dataset (example: 8000 samples):```bashpython generate_dataset.py --size 8000 --out train.json```Train locally:```bashpython finetune_coding_llm_colab.py --dataset-size 8000```Enable 4-bit quantized loading (GPU):```bashpython finetune_coding_llm_colab.py --dataset-size 8000 --use-4bit```Fast CPU smoke run:```bashpython finetune_coding_llm_colab.py --dataset-size 5000 --max-train-samples 200 --epochs 0.1```Single command pipeline (no upload):```bashpython run_pipeline.py --dataset-size 8000 --skip-upload```If `training_config.json` exists, `run_pipeline.py` reads it automatically for defaults.Use existing dataset without regenerating:```bashpython run_pipeline.py --dataset-size 8000 --train-file train.json --skip-generate --skip-upload```Tunable training knobs:```bashpython run_pipeline.py --dataset-size 8000 --epochs 3 --batch-size 2 --learning-rate 1e-4 --max-length 512 --max-train-samples 0 --use-4bit --skip-upload```## Configure 5k-10k samples```python--dataset-size 5000--dataset-size 8000--dataset-size 10000```Recommended values:- 5000 for fast iteration- 8000 as balanced- 10000 for stronger adaptation (slower)## Hugging Face DeploymentUpload is optional and can be done after training:```bashpython upload_to_hf.py --model-dir model --repo-id your-username/your-model-name```### Update Existing HF Model RepoTo update your already-created Hugging Face model with this new JSON-output behavior:1. Retrain locally with latest code:```bashpython run_pipeline.py --dataset-size 8000 --skip-upload```2. Login to Hugging Face:```bashhuggingface-cli login```3. Upload to the same repo ID (this updates existing files):```bashpython upload_to_hf.py --model-dir model --repo-id your-username/your-existing-model-name```Optional safer rollout using a new revision/branch:```bashpython -c "from huggingface_hub import upload_folder; upload_folder(folder_path='model', repo_id='your-username/your-existing-model-name', repo_type='model', revision='v2-json-output')"```You can also trigger upload from trainer:```bashpython finetune_coding_llm_colab.py --skip-dataset-gen --skip-train --upload --hf-repo your-username/your-model-name```## Quick Inference Test (Structured JSON)After local training, inference returns JSON with:- `code`- `explanation`- `confidence`- `important_tokens`- `relevancy_score`- `hallucination`- `hallucination_check_reason`- `latency_ms````pythonpython infer_local.py --model-path model --prompt "Fix this code: def add(a,b) return a+b"```Run the same structured-output wrapper through the Hugging Face API:```bashset HF_TOKEN=your_huggingface_tokenpython infer_cloud.py --repo-id your-username/your-model-name --prompt "Fix this code: def add(a,b) return a+b"```PowerShell:```powershell$env:HF_TOKEN="your_huggingface_token"python infer_cloud.py --repo-id your-username/your-model-name --prompt "Fix this code: def add(a,b) return a+b"```If you already ran `hf auth login` or `huggingface-cli login`, you can omit `HF_TOKEN`; the saved token will be used automatically.`infer_cloud.py` applies the same JSON parsing, Python syntax check, relevancy score, hallucination flag, and auto-repair fallback as `infer_local.py`. 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.Explicit base model for LoRA adapter loading:```pythonpython infer_local.py --model-path model --base-model Qwen/Qwen2.5-Coder-0.5B-Instruct --prompt "Fix this code: def add(a,b) return a+b"````infer_local.py` automatically handles both:- LoRA adapter output folders- Fully merged/full-model output folders## Accuracy EvaluationRun default evaluation prompts:```bashpython evaluate_model.py --model-path model```Run with custom prompts:```bashpython evaluate_model.py --model-path model --prompt "Fix this code: if x = 5: print(x)" --prompt "Write python code for linear regression and explain it"```For higher quality output:- use dataset size `8000` or `10000`- use `epochs >= 3`- prefer `--use-4bit` when GPU is available- keep prompts specific and task-focused## Recommended Run Order```bashpython run_pipeline.py --dataset-size 8000 --skip-uploadpython infer_local.py --model-path model --prompt "Fix this code: def add(a,b) return a+b"python evaluate_model.py --model-path modelpython upload_to_hf.py --model-dir model --repo-id your-username/your-existing-model-name```
README.md+195-207