{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "93e252d5-c7d2-48bd-9d21-70bb5694a026", "metadata": { "tags": [] }, "outputs": [], "source": [ "from _mydelta.multi_prompt import MultiPrompt" ] }, { "cell_type": "code", "execution_count": 2, "id": "c9cd7bc9-cd12-4e77-9176-d71c614a6094", "metadata": { "tags": [] }, "outputs": [], "source": [ "from pathlib import Path\n", "path = Path('/disks/ssd/trained_final/cont_thesis/cont_thesis_t5_small_glue-cola/10_combine_128_simple')\n", "best_out = MultiPrompt.get_saved_final_emb(\n", " config_path=path / 'config.json',\n", " weights_path=path / 'best.pt'\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "id": "853f0084-5b12-40e0-a6ea-da6cd96bcd88", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "torch.Size([10, 512])" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "best_out.shape" ] }, { "cell_type": "code", "execution_count": 4, "id": "0807f193-4cb5-4d84-9210-3581e2e49c51", "metadata": { "tags": [] }, "outputs": [], "source": [ "import torch\n", "\n", "sd = torch.load(path / 'best.pt')" ] }, { "cell_type": "code", "execution_count": 7, "id": "73685dcd-d842-4265-b1db-760124840212", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "tensor([0.3015], device='cuda:0')" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sd['prompts.2.sadcl_coeff_pretrained']" ] }, { "cell_type": "code", "execution_count": 16, "id": "dffe272c-97d5-41de-ac31-fd2702163670", "metadata": {}, "outputs": [], "source": [ "from accelerate import Accelerator\n", "import accelerate.utils.other as auo\n", "import accelerate.logging as al" ] }, { "cell_type": "code", "execution_count": 25, "id": "8d184d14-a9b7-41ae-b5f8-cf977b7009fd", "metadata": { "tags": [] }, "outputs": [], "source": [ "# Accelerator()\n", "\n", "al" ] }, { "cell_type": "code", "execution_count": 28, "id": "972a0e50-43aa-44eb-8c10-3e86fba0819d", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/plain": [ "50" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "auo.logger.getEffectiveLevel()" ] }, { "cell_type": "code", "execution_count": 18, "id": "7a247b50-57a0-43cd-9a8d-18d58ea1fd27", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "__main__\n" ] } ], "source": [ "print(__name__)" ] }, { "cell_type": "code", "execution_count": null, "id": "6abe432e-bb4b-4610-899d-e7759512181c", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:deep]", "language": "python", "name": "conda-env-deep-py" }, "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.13" } }, "nbformat": 4, "nbformat_minor": 5 }