"
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ " \n",
+ "
\n",
+ " [5252/5252 2:05:27, Epoch 2/2]\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " Epoch | \n",
+ " Training Loss | \n",
+ " Validation Loss | \n",
+ " Model Preparation Time | \n",
+ " Accuracy | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 1 | \n",
+ " 0.251400 | \n",
+ " 0.328844 | \n",
+ " 0.004500 | \n",
+ " 0.901430 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 0.194400 | \n",
+ " 0.263013 | \n",
+ " 0.004500 | \n",
+ " 0.921162 | \n",
+ "
\n",
+ " \n",
+ "
"
+ ]
+ },
+ "metadata": {}
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ ""
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ " \n",
+ "
\n",
+ " [7001/7001 1:14:30]\n",
+ "
\n",
+ " "
+ ]
+ },
+ "metadata": {}
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "TrainOutput(global_step=5252, training_loss=0.3096036569634559, metrics={'train_runtime': 7529.7371, 'train_samples_per_second': 22.312, 'train_steps_per_second': 0.698, 'total_flos': 1.3018809239230685e+19, 'train_loss': 0.3096036569634559, 'epoch': 2.0})"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 24
+ }
+ ],
+ "source": [
+ "trainer.train()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 159
+ },
+ "id": "b8caa0kpH9uf",
+ "outputId": "b35c476a-76fc-4cca-9115-77ef9fc46aff"
+ },
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ ""
+ ],
+ "text/html": [
+ "\n",
+ " \n",
+ " \n",
+ "
\n",
+ " [7001/7001 11:44]\n",
+ "
\n",
+ " "
+ ]
+ },
+ "metadata": {}
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": [
+ "{'eval_loss': 0.26301252841949463,\n",
+ " 'eval_model_preparation_time': 0.0045,\n",
+ " 'eval_accuracy': 0.9211621221049624,\n",
+ " 'eval_runtime': 704.6584,\n",
+ " 'eval_samples_per_second': 79.473,\n",
+ " 'eval_steps_per_second': 9.935,\n",
+ " 'epoch': 2.0}"
+ ]
+ },
+ "metadata": {},
+ "execution_count": 25
+ }
+ ],
+ "source": [
+ "trainer.evaluate()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 54
+ },
+ "collapsed": true,
+ "id": "GQo5AFJ1N1GC",
+ "outputId": "9fad62a4-b67c-4dc3-c7d5-12f2b7d2d225"
+ },
+ "outputs": [
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ ""
+ ],
+ "text/html": []
+ },
+ "metadata": {}
+ },
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "{'test_loss': 0.26301252841949463, 'test_model_preparation_time': 0.0045, 'test_accuracy': 0.9211621221049624, 'test_runtime': 707.3371, 'test_samples_per_second': 79.172, 'test_steps_per_second': 9.898}\n"
+ ]
+ }
+ ],
+ "source": [
+ "outputs = trainer.predict(test_data)\n",
+ "print(outputs.metrics)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/",
+ "height": 850
+ },
+ "id": "vZE0GZXnIVtZ",
+ "outputId": "a2ddddb1-ee5e-4ada-f647-9612eb861408"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Accuracy: 0.9212\n",
+ "F1 Score: 0.9210\n"
+ ]
+ },
+ {
+ "output_type": "display_data",
+ "data": {
+ "text/plain": [
+ "