{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Failed to detect the name of this notebook, you can set it manually with the WANDB_NOTEBOOK_NAME environment variable to enable code saving.\n", "\u001b[34m\u001b[1mwandb\u001b[0m: Currently logged in as: \u001b[33mmasatoshi136\u001b[0m (\u001b[33mmasa136\u001b[0m). Use \u001b[1m`wandb login --relogin`\u001b[0m to force relogin\n" ] }, { "data": { "text/plain": [ "True" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import sys\n", "sys.path.append(\"../../\")\n", "sys.path.append(\"../../src/model\")\n", "\n", "from src.utils.sequence import seqs_to_one_hot\n", "\n", "import wandb\n", "wandb.login(host=\"https://api.wandb.ai\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "wandb version 0.17.5 is available! To upgrade, please run:\n", " $ pip install wandb --upgrade" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Tracking run with wandb version 0.17.4" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Run data is saved locally in /raid/home/ueharam1/prj/RLfinetuning_Diffusion_Bioseq/tutorials/UTR/wandb/run-20240720_114912-lcrvmb2u" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Syncing run effortless-sea-9 to Weights & Biases (docs)
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " View project at https://wandb.ai/masa136/RLfinetuning_Diffusion_Bioseq-tutorials_UTR" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " View run at https://wandb.ai/masa136/RLfinetuning_Diffusion_Bioseq-tutorials_UTR/runs/lcrvmb2u" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stderr", "output_type": "stream", "text": [ "\u001b[34m\u001b[1mwandb\u001b[0m: Downloading large artifact UTR-dataset:v0, 3683.51MB. 4 files... \n", "\u001b[34m\u001b[1mwandb\u001b[0m: 4 of 4 files downloaded. \n", "Done. 0:0:7.4\n" ] } ], "source": [ "run = wandb.init()\n", "artifact = run.use_artifact('fderc_diffusion/Diffusion-DNA-RNA/UTR-dataset:v0')\n", "dir = artifact.download()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0utrrl
00CCACTCGATTAACATGTTAACAACATACTCGTCCGGCCGATCAGCG...-1.949703
11CAAATCATGTGCAGCCCTGGCGACCGTACTGCGGTACAAGAAAGTA...-1.460671
22GTTATACTAGAAGAAACTTGAGATTATGGAGCAGTCCGTCAAGGAC...-1.781243
33CTTAGACAAAAACAACGCGCTTTCCAGTATGCGGAGCCTTGACGGT...-1.643680
44GTATCAAATCACGGCCAACCCGACGGAGTACCCCGCGTCGATGGTC...-1.061173
\n", "
" ], "text/plain": [ " Unnamed: 0 utr rl\n", "0 0 CCACTCGATTAACATGTTAACAACATACTCGTCCGGCCGATCAGCG... -1.949703\n", "1 1 CAAATCATGTGCAGCCCTGGCGACCGTACTGCGGTACAAGAAAGTA... -1.460671\n", "2 2 GTTATACTAGAAGAAACTTGAGATTATGGAGCAGTCCGTCAAGGAC... -1.781243\n", "3 3 CTTAGACAAAAACAACGCGCTTTCCAGTATGCGGAGCCTTGACGGT... -1.643680\n", "4 4 GTATCAAATCACGGCCAACCCGACGGAGTACCCCGCGTCGATGGTC... -1.061173" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "datafile = pd.read_csv(\"artifacts/UTR-dataset:v0/dataset.csv.gz\")\n", "datafile.head()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(326033, 50, 4)\n" ] } ], "source": [ "seq_x = [seqs_to_one_hot(seq)[:, 0, :] for seq in datafile['utr']]\n", "x = np.array(seq_x)\n", "print(x.shape)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Make three clases " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "y = np.array(datafile['rl'])\n", "y1 = np.zeros(len(datafile['rl']))\n", "\n", "y1[np.quantile(y,0.97)effortless-sea-9 at: https://wandb.ai/masa136/RLfinetuning_Diffusion_Bioseq-tutorials_UTR/runs/lcrvmb2u
View project at: https://wandb.ai/masa136/RLfinetuning_Diffusion_Bioseq-tutorials_UTR
Synced 6 W&B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Find logs at: ./wandb/run-20240720_114912-lcrvmb2u/logs" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "The new W&B backend becomes opt-out in version 0.18.0; try it out with `wandb.require(\"core\")`! See https://wandb.me/wandb-core for more information." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "wandb.finish()" ] } ], "metadata": { "kernelspec": { "display_name": "diffusion", "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.12.4" } }, "nbformat": 4, "nbformat_minor": 2 }