{ "cells": [ { "cell_type": "code", "execution_count": 5, "id": "c6866894", "metadata": {}, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings(\"ignore\")" ] }, { "cell_type": "code", "execution_count": 16, "id": "7b293125", "metadata": { "scrolled": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Some weights of BertForSequenceClassification were not initialized from the model checkpoint at bert-base-multilingual-uncased and are newly initialized: ['classifier.bias', 'classifier.weight']\n", "You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "1ddac164d1df40438dddfddf1730f471", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Map: 0%| | 0/2312 [00:00\n", " \n", " \n", " [ 187/1300 17:25 < 1:44:52, 0.18 it/s, Epoch 0.72/5]\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EpochTraining LossValidation Loss

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Train the model\n", "trainer.train()\n" ] }, { "cell_type": "code", "execution_count": null, "id": "3ca0b7d2", "metadata": {}, "outputs": [], "source": [ "# Evaluate the model\n", "eval_results = trainer.evaluate()\n", "print(\"Evaluation Results:\", eval_results)\n", "\n", "# Save the model\n", "model.save_pretrained('./fine-tuned-bert-urdu')\n", "tokenizer.save_pretrained('./fine-tuned-bert-urdu')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }