Text Generation
Transformers
Safetensors
code
t5
text2text-generation
code-generation
bug-fixing
code-repair
codet5
debugging
text-generation-inference
Instructions to use Sagar123x/brainbug with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sagar123x/brainbug with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sagar123x/brainbug")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Sagar123x/brainbug") model = AutoModelForSeq2SeqLM.from_pretrained("Sagar123x/brainbug", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Sagar123x/brainbug with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sagar123x/brainbug" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sagar123x/brainbug", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Sagar123x/brainbug
- SGLang
How to use Sagar123x/brainbug 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 "Sagar123x/brainbug" \ --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": "Sagar123x/brainbug", "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 "Sagar123x/brainbug" \ --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": "Sagar123x/brainbug", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Sagar123x/brainbug with Docker Model Runner:
docker model run hf.co/Sagar123x/brainbug
| language: | |
| - code | |
| license: mit | |
| tags: | |
| - code-generation | |
| - bug-fixing | |
| - code-repair | |
| - codet5 | |
| - debugging | |
| datasets: | |
| - custom | |
| metrics: | |
| - accuracy | |
| - exact-match | |
| library_name: transformers | |
| pipeline_tag: text2text-generation | |
| # brainbug | |
| ## Model Description | |
| This is a fine-tuned **CodeT5** model for automatic bug detection and code repair. The model has been trained to identify and fix various types of programming errors in Python code. | |
| ## Supported Error Types | |
| - **WVAV**: Wrong Variable Used in Variable Assignment | |
| - **MLAC**: Missing Line After Call | |
| - **WPFV**: Wrong Parameter in Function/Method Call | |
| - And more... | |
| ## Model Details | |
| - **Base Model**: `Salesforce/codet5-base` | |
| - **Fine-tuned on**: Custom bug-fix dataset | |
| - **Task**: Code-to-Code generation (bug fixing) | |
| - **Language**: Python | |
| - **Model Size**: 220M parameters | |
| ## Usage | |
| ```python | |
| from transformers import T5ForConditionalGeneration, RobertaTokenizer | |
| # Load model and tokenizer | |
| model = T5ForConditionalGeneration.from_pretrained("Sagar123x/brainbug") | |
| tokenizer = RobertaTokenizer.from_pretrained("Sagar123x/brainbug") | |
| # Example: Fix buggy code | |
| faulty_code = """ | |
| def check_for_file(self, file_path): | |
| files = self.connection.glob(file_path) | |
| return len(files) == 1 | |
| """ | |
| # Prepare input | |
| input_text = f"Fix WVAV: {faulty_code}" | |
| inputs = tokenizer(input_text, return_tensors="pt", max_length=256, truncation=True) | |
| # Generate fix | |
| outputs = model.generate(**inputs, max_length=256, num_beams=5) | |
| fixed_code = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| print(fixed_code) | |
| ``` | |
| ## Training Details | |
| - **Training Epochs**: 10 | |
| - **Batch Size**: 1 (with gradient accumulation) | |
| - **Learning Rate**: 3e-5 | |
| - **Optimizer**: AdamW | |
| - **Hardware**: NVIDIA RTX 4050 (6GB) | |
| ## Performance Metrics | |
| - **Exact Match Accuracy**: 2.60% | |
| - **Token-Level Accuracy**: 28.52% | |
| - **Average Similarity**: 76.75% | |
| ## Limitations | |
| - Trained primarily on Python code | |
| - Best performance on error types seen during training | |
| - May not handle very long code snippets (>256 tokens) | |
| - Requires error type specification for optimal results | |
| ## Citation | |
| ```bibtex | |
| @misc{brainbug-codet5, | |
| author = {Your Name}, | |
| title = {BrainBug: CodeT5 for Automatic Bug Repair}, | |
| year = {2025}, | |
| publisher = {HuggingFace}, | |
| howpublished = {\url{https://huggingface.co/Sagar123x/brainbug}} | |
| } | |
| ``` | |
| ## License | |
| MIT License | |
| ## Contact | |
| For questions or issues, please open an issue on the model repository. | |