{"id":26686199,"url":"https://github.com/harmeshgv/gpu-powered-bert-finetuning","last_synced_at":"2026-04-16T19:40:06.197Z","repository":{"id":276022149,"uuid":"927879234","full_name":"harmeshgv/gpu-powered-bert-finetuning","owner":"harmeshgv","description":"Efficient fine-tuning of BERT models using CUDA-powered GPUs, optimized for laptops and devices with NVIDIA RTX 3000/4000 series or CUDA-compatible GPUs. Ideal for fast NLP model training with PyTorch and Hugging Face Transformers.","archived":false,"fork":false,"pushed_at":"2025-08-03T18:54:19.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-03T20:44:04.777Z","etag":null,"topics":["bert-model","cuda","finetuning-llms","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harmeshgv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-05T17:36:16.000Z","updated_at":"2025-08-03T18:54:23.000Z","dependencies_parsed_at":"2025-03-09T19:26:16.018Z","dependency_job_id":"799b2485-7839-47ae-a9ab-9b777347831b","html_url":"https://github.com/harmeshgv/gpu-powered-bert-finetuning","commit_stats":null,"previous_names":["harmesh095/gpu-powered-bert-finetuning","harmeshgv/gpu-powered-bert-finetuning"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harmeshgv/gpu-powered-bert-finetuning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmeshgv%2Fgpu-powered-bert-finetuning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmeshgv%2Fgpu-powered-bert-finetuning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmeshgv%2Fgpu-powered-bert-finetuning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmeshgv%2Fgpu-powered-bert-finetuning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harmeshgv","download_url":"https://codeload.github.com/harmeshgv/gpu-powered-bert-finetuning/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmeshgv%2Fgpu-powered-bert-finetuning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270859063,"owners_count":24658148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bert-model","cuda","finetuning-llms","pytorch"],"created_at":"2025-03-26T11:17:10.680Z","updated_at":"2026-04-16T19:40:06.171Z","avatar_url":"https://github.com/harmeshgv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GPU-Powered BERT Fine-Tuning for Sentiment Analysis\n\nThis project provides a complete workflow for fine-tuning a BERT model for sentiment analysis on the IMDb dataset. It is optimized for use with NVIDIA GPUs and includes a Streamlit web application for real-time inference.\n\n## Features\n\n- **Efficient Fine-Tuning:** Leverages Hugging Face Transformers and PyTorch for efficient training on CUDA-enabled GPUs.\n- **Pre-configured Scripts:** Includes scripts for setup, training, and running the application.\n- **Interactive Web App:** A Streamlit app to test the fine-tuned model with your own text.\n\n## Tech Stack\n\n- **Python 3.9+**\n- **PyTorch**\n- **Hugging Face Transformers**\n- **Streamlit**\n- **Scikit-learn**\n- **Accelerate**\n\n## Getting Started\n\n### Prerequisites\n\n- **NVIDIA GPU:** A CUDA-compatible GPU is required for training.\n- **NVIDIA Drivers:** Ensure you have the latest NVIDIA drivers installed.\n- **Python 3.9+:** Make sure you have a compatible Python version installed.\n\n### Installation\n\n1.  **Clone the repository:**\n\n    ```bash\n    git clone https://github.com/your-username/gpu-powered-bert-finetuning.git\n    cd gpu-powered-bert-finetuning\n    ```\n\n2.  **Run the setup script:**\n\n    This will create a virtual environment, install the required dependencies, and check for GPU availability.\n\n    ```bash\n    ./setup.sh\n    ```\n\n## Usage\n\n### Training the Model\n\nTo fine-tune the BERT model on the IMDb dataset, run the setup script with the `--train` flag:\n\n```bash\n./setup.sh --train\n```\n\nThe script will download the dataset, tokenize it, and train the model. The fine-tuned model will be saved in the `model/fine_tuned_bert` directory.\n\n### Running the Streamlit App\n\nOnce the model is trained, you can run the Streamlit web application to perform sentiment analysis on your own text:\n\n```bash\nstreamlit run app/app.py\n```\n\nThe app will be available at `http://localhost:8501`.\n\n## Project Structure\n\n```\n.\n├── app\n│   └── app.py              # Streamlit application\n├── finetuned_results       # Training checkpoints\n├── model\n│   └── fine_tuned_bert     # Saved fine-tuned model\n├── src\n│   ├── gpu_check.py        # GPU availability check\n│   └── train_model.py      # Model training script\n├── requirements.txt        # Python dependencies\n└── setup.sh                # Setup script\n```\n\n## Results\n\nThe following table shows the performance of the BERT model before and after fine-tuning on the IMDb dataset:\n\n| Stage                         | Description                                                                      | Model Used        | Accuracy   |\n|-------------------------------|----------------------------------------------------------------------------------|-------------------|------------|\n| Baseline (Before Fine-Tuning) | Directly used bert-base-uncased pretrained model on raw dataset (no fine-tuning) | Bert (Pretrained) | 52.4%      |\n| Fine-Tuning (Raw data)        | Fine-tuned BERT on dataset without additional preprocessing                      | Bert (Fine-Tuned) | 89.4%      |\n\nThese results demonstrate the significant improvement in accuracy after fine-tuning the model on the target dataset.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or find any bugs.\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmeshgv%2Fgpu-powered-bert-finetuning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharmeshgv%2Fgpu-powered-bert-finetuning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmeshgv%2Fgpu-powered-bert-finetuning/lists"}