{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b12ae8a3-9e08-402c-894c-31697fad6c56", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8950b2cbd1c44912917219b84af806ce", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(HTML(value='
\n", " \n", " \n", " [ 198/9180 01:00 < 46:32, 3.22 it/s, Epoch 0.64/30]\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EpochTraining LossValidation Loss

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "model = ConsistentSentenceClassifier(\n", " freeze_bert=False)\n", "\n", "training_args = TrainingArguments(\n", " output_dir=\"../factual-consistency-classification-ja-avgpool-unfrozen\",\n", " learning_rate=1e-4,\n", " per_device_train_batch_size=64,\n", " per_device_eval_batch_size=8,\n", " num_train_epochs=30,\n", " weight_decay=0.02,\n", " evaluation_strategy=\"epoch\",\n", " eval_accumulation_steps=4,\n", " save_strategy=\"epoch\",\n", " load_best_model_at_end=True,\n", " save_total_limit=5,\n", " push_to_hub=True,\n", ")\n", "\n", "data_collator = DataCollatorWithPadding(tokenizer=tokenizer)\n", "trainer = Trainer(\n", " model=model,\n", " args=training_args,\n", " train_dataset=tokenized_dataset[\"train\"],\n", " eval_dataset=tokenized_dataset[\"test\"],\n", " tokenizer=tokenizer,\n", " data_collator=data_collator,\n", " compute_metrics=get_metrics(),\n", ")\n", "\n", "trainer.train()\n", "trainer.push_to_hub('factual-consistency-classification-ja-avgpool-unfrozen')" ] }, { "cell_type": "code", "execution_count": null, "id": "a6eb93f7-5a38-49a2-be0d-e42267e23a0a", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "environment": { "kernel": "python3", "name": "pytorch-gpu.2-0.m112", "type": "gcloud", "uri": "gcr.io/deeplearning-platform-release/pytorch-gpu.2-0:m112" }, "kernelspec": { "display_name": "Python 3", "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.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }