12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "id": "4c6f353f-83e2-4780-9124-bf7f30e2a77d",
- "metadata": {
- "tags": []
- },
- "outputs": [],
- "source": [
- "from typing import Optional\n",
- "\n",
- "import numpy as np\n",
- "from tqdm import tqdm\n",
- "\n",
- "import wandb\n",
- "import torch\n",
- "import torch.nn as nn\n",
- "from transformers import T5TokenizerFast, T5ForConditionalGeneration\n",
- "\n",
- "from _config import load_config\n",
- "from _utils import print_system_info, silent_logs\n",
- "from _datasets import AutoLoad, generate_dataloader\n",
- "from _mydelta import T5Wrapper, auto_freeze, EmbeddingWrapper\n",
- "from _trainer import train_loop, valid_loop, BestFinder\n",
- "\n",
- "# configs = load_config('./config.yaml')\n",
- "\n",
- "# RANDOM_SEED = configs.shared.random_seed\n",
- "# WANDB_PROJECT_NAME = configs.shared.project_name\n",
- "# DEVICE = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n",
- "# USE_TQDM = configs.shared.use_tqdm\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "id": "ead0c663-c9e4-4625-8f3b-11e53ca59920",
- "metadata": {},
- "outputs": [],
- "source": [
- "model = T5ForConditionalGeneration.from_pretrained('google/t5-large-lm-adapt')\n",
- "tokenizer = T5TokenizerFast.from_pretrained('google/t5-large-lm-adapt', model_max_length=2048)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "e348f601-c713-49af-86e4-a40382c5a36f",
- "metadata": {},
- "outputs": [],
- "source": [
- "num_tokens = 100"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "6d9a6602-f90d-440a-b11e-ddda2d36d2f7",
- "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.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
- }
|