{"id":25992679,"url":"https://github.com/jisnap/fine_tuning_pretrained_models","last_synced_at":"2026-05-26T23:06:52.182Z","repository":{"id":279817338,"uuid":"940029047","full_name":"JisnaP/Fine_tuning_pretrained_models","owner":"JisnaP","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-27T18:29:52.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T22:11:09.101Z","etag":null,"topics":["autotokenizer","datasets","huggingface","transformers"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/JisnaP.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}},"created_at":"2025-02-27T13:56:24.000Z","updated_at":"2025-02-27T18:32:36.000Z","dependencies_parsed_at":"2025-02-27T22:21:43.403Z","dependency_job_id":null,"html_url":"https://github.com/JisnaP/Fine_tuning_pretrained_models","commit_stats":null,"previous_names":["jisnap/fine_tuning_pretrained_models"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JisnaP%2FFine_tuning_pretrained_models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JisnaP%2FFine_tuning_pretrained_models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JisnaP%2FFine_tuning_pretrained_models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JisnaP%2FFine_tuning_pretrained_models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JisnaP","download_url":"https://codeload.github.com/JisnaP/Fine_tuning_pretrained_models/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242042882,"owners_count":20062485,"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","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":["autotokenizer","datasets","huggingface","transformers"],"created_at":"2025-03-05T14:28:45.068Z","updated_at":"2026-05-26T23:06:47.148Z","avatar_url":"https://github.com/JisnaP.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paraphrase Detection API using FastAPI \u0026 BERT\n\n## 🚀 Overview\nThis FastAPI application serves a **BERT-based model** (`bert-base-uncased`) fine-tuned for **sentence pair classification**, determining whether two sentences are paraphrases.\n\n## 📌 Features\n- **FastAPI for serving the model**\n- **Tokenization using Hugging Face Transformers**\n- **Inference using PyTorch**\n\n\n---\n\n## 🛠 Installation\n\n### 1️⃣ **Clone the repository**\n```bash\ngit clone https://github.com/JisnaP/Fine_tuning_pretrained_models.git\ncd Fine_tuning_pretrained_models\n```\n\n### 2️⃣ **Create a virtual environment **\n```bash\npython -m venv venv\nsource venv/bin/activate  \n```\n\n### 3️⃣ **Install dependencies**\n```bash\npip install -r requirements.txt\n```\n📌 Setup Instructions\n1️⃣ Run Colab Notebook to Fine-tune and Save Model\nBefore running the API, you must first run the Colab notebook to train and save the model parameters.\n\nOpen and run the Google Colab notebook: fine_tuning_pretrained_models_using_trainer_api_for_paraphrase_sentences.ipynb\nSave the trained model and download it. (You will have use these as weights in the model in app.py)\nMove model.pth to the models/ directory in your local repo.\n---\n\n## 🎯 Running the API\n\n### **1️⃣ Start the FastAPI Server**\n```bash\nuvicorn app:app --host 0.0.0.0 --port 8000\n```\n- The API will now be available at: `http://127.0.0.1:8000`\n- You can test the API using the interactive **Swagger UI** at: `http://127.0.0.1:8000/docs`\n\n### **2️⃣ Example API Request**\nSend a `POST` request to `/predict` with a JSON payload containing two sentences:\n```json\n{\n    \"sentence1\": \"The weather is nice today.\",\n    \"sentence2\": \"It's a beautiful day outside.\"\n}\n```\n\n\n\n### **3️⃣ Example API Response**\n```json\n{\n    \"paraphrase\": true,\n    \"confidence\": 0.89\n}\n```\n- `paraphrase: true` means the sentences are paraphrases\n- `confidence: 0.89` indicates an 89% confidence level\n\n---\n\n## 🔹 Model Used\nThis API uses the **BERT base uncased (`bert-base-uncased`)** model fine-tuned on a paraphrase detection dataset glue/mrpc.\n\nIf the model is not downloaded, it will be automatically fetched from Hugging Face.\n\n---\n\n\n\n\n## 📜 License\nThis project is open-source and available under the **MIT License**.\n\n---\n\n## 🔗 References\n- [FastAPI Documentation](https://fastapi.tiangolo.com/)\n- [Hugging Face Transformers](https://huggingface.co/transformers/)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjisnap%2Ffine_tuning_pretrained_models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjisnap%2Ffine_tuning_pretrained_models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjisnap%2Ffine_tuning_pretrained_models/lists"}