{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:17.326993Z",
     "iopub.status.busy": "2025-06-03T17:50:17.326733Z",
     "iopub.status.idle": "2025-06-03T17:50:17.338411Z",
     "shell.execute_reply": "2025-06-03T17:50:17.338081Z",
     "shell.execute_reply.started": "2025-06-03T17:50:17.326979Z"
    }
   },
   "outputs": [],
   "source": [
    "# setup autoload\n",
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:21.040680Z",
     "start_time": "2024-05-16T13:58:19.777010Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:17.339932Z",
     "iopub.status.busy": "2025-06-03T17:50:17.339748Z",
     "iopub.status.idle": "2025-06-03T17:50:19.626102Z",
     "shell.execute_reply": "2025-06-03T17:50:19.625625Z",
     "shell.execute_reply.started": "2025-06-03T17:50:17.339921Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The autoreload extension is already loaded. To reload it, use:\n",
      "  %reload_ext autoreload\n"
     ]
    }
   ],
   "source": [
    "import ast\n",
    "import os\n",
    "import shutil\n",
    "import sys\n",
    "from collections import defaultdict\n",
    "\n",
    "import json\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from preference_data_preparation_4min_30b_task import *\n",
    "from preference_helper import *\n",
    "from sklearn.model_selection import train_test_split\n",
    "from suno_utils.utils.s3 import download_s3_files\n",
    "from suno_utils.utils.text import read_json, read_jsonl, write_json, write_jsonl\n",
    "from tqdm import tqdm\n",
    "\n",
    "pd.set_option(\"display.max_rows\", 500)\n",
    "pd.set_option(\"display.max_columns\", 500)\n",
    "pd.set_option(\"display.width\", 1000)\n",
    "\n",
    "# setup autoload\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "\n",
    "def custom_parse(x):\n",
    "    try:\n",
    "        return json.loads(x)\n",
    "    except:\n",
    "        return {}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:21.082172Z",
     "start_time": "2024-05-16T13:58:21.041926Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:19.627850Z",
     "iopub.status.busy": "2025-06-03T17:50:19.627740Z",
     "iopub.status.idle": "2025-06-03T17:50:19.716460Z",
     "shell.execute_reply": "2025-06-03T17:50:19.715985Z",
     "shell.execute_reply.started": "2025-06-03T17:50:19.627837Z"
    }
   },
   "outputs": [],
   "source": [
    "OUT_DATA_DIR = \"/app/suno/data/dpo/30b_t6_v35\"\n",
    "os.makedirs(OUT_DATA_DIR, exist_ok=True)\n",
    "shutil.copyfile(\n",
    "    \"/app/suno/data/dpo/7v_v20_full/tokenizer_60k.json\",\n",
    "    os.path.join(OUT_DATA_DIR, \"tokenizer_60k.json\"),\n",
    ")\n",
    "NPZ_DIR = \"/app/suno/data/dpo/30b_npz\"\n",
    "# NOTE FOR 30b we increase this from 6016 up\n",
    "N_TOKENS_AUDIO = 6016"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:53.962528Z",
     "start_time": "2024-05-16T13:58:21.105919Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:19.718113Z",
     "iopub.status.busy": "2025-06-03T17:50:19.718009Z",
     "iopub.status.idle": "2025-06-03T17:50:32.285399Z",
     "shell.execute_reply": "2025-06-03T17:50:32.284893Z",
     "shell.execute_reply.started": "2025-06-03T17:50:19.718102Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preference data shape (492414, 89)\n"
     ]
    }
   ],
   "source": [
    "df = pd.read_pickle(\n",
    "    # \"/home/tony/Data/Preference/30b_v3/interesting_clips_v4_t_4_20240923_full_with_sem_distance_and_similarity.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v2/interesting_clips_v4_t_3_20240919_full_l10_with_cer.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v3/interesting_clips_v4_t_4_20240925_full_l10_with_cer.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v5/interesting_clips_v4_t_5_20241029_full_with_cer.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_t_6_20241117_full_with_cer.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_t_6_20241118_full.pkl\"\n",
    "    \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250222_full.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250227_full_long.pkl\"\n",
    ")  # , engine='python')\n",
    "# df = pd.read_csv(\n",
    "#     \"/home/tony/Data/Preference/30b_v0/interesting_clips_v4_t_1_20240808.csv\"\n",
    "# )  # , engine='python')\n",
    "print(\"Preference data shape\", df.shape)\n",
    "\n",
    "# df_cover = pd.read_pickle(\n",
    "#     \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_t_6_20241109_full_with_sem_distance_and_similarity.pkl\"\n",
    "# )\n",
    "# print(df_cover.shape)\n",
    "\n",
    "# df_artist = pd.read_pickle(\n",
    "#     \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_t_6_20241109_full_with_sem_distance_and_similarity_artist.pkl\"\n",
    "# )\n",
    "# print(df_cover.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:32.287322Z",
     "iopub.status.busy": "2025-06-03T17:50:32.287207Z",
     "iopub.status.idle": "2025-06-03T17:50:32.307829Z",
     "shell.execute_reply": "2025-06-03T17:50:32.307455Z",
     "shell.execute_reply.started": "2025-06-03T17:50:32.287309Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_cover[df_cover[\"preference\"]][\"similarity\"].hist(bins=200)\n",
    "# plt.show()\n",
    "# df_cover[\"similarity_diff\"] = df_cover[\"similarity\"].diff()\n",
    "# df_cover[df_cover[\"preference\"]][\"similarity_diff\"].hist(bins=200)\n",
    "# plt.show()\n",
    "# df_cover[\"continued_parent\"] = None\n",
    "# df_cover[\"continue_at\"] = -1\n",
    "# df_cover[df_cover[\"preference\"]][\"similarity\"].describe()\n",
    "# df_cover_drops_id = df_cover[\n",
    "#     (df_cover[\"preference\"])\n",
    "#     & (~((0.1 < df_cover[\"similarity\"]) & (df_cover[\"similarity\"] <= 0.99)))\n",
    "# ][\"s3_id\"].unique()\n",
    "# print(len(df_cover_drops_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:32.308426Z",
     "iopub.status.busy": "2025-06-03T17:50:32.308264Z",
     "iopub.status.idle": "2025-06-03T17:50:32.319769Z",
     "shell.execute_reply": "2025-06-03T17:50:32.319419Z",
     "shell.execute_reply.started": "2025-06-03T17:50:32.308414Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_artist[df_artist[\"preference\"]][\"similarity\"].hist(bins=200)\n",
    "# plt.show()\n",
    "# df_artist[\"similarity_diff\"] = df_artist[\"similarity\"].diff()\n",
    "# df_artist[df_artist[\"preference\"]][\"similarity_diff\"].hist(bins=200)\n",
    "# plt.show()\n",
    "# df_artist[\"continued_parent\"] = None\n",
    "# df_artist[\"continue_at\"] = -1\n",
    "# df_artist[df_artist[\"preference\"]][\"similarity\"].describe()\n",
    "# df_artist_drops_id = df_artist[\n",
    "#     (df_artist[\"preference\"])\n",
    "#     & ((~((0 < df_artist[\"similarity\"]) & (df_artist[\"similarity\"] <= 0.99)))\n",
    "#     | (~(df_artist[\"similarity_diff\"] > -0.2)))\n",
    "# ][\"s3_id\"].unique()\n",
    "# print(len(df_artist_drops_id))\n",
    "\n",
    "# print(\"before filter on cover similarity\", df.shape)\n",
    "# df = df[~df[\"s3_id\"].isin(df_cover_drops_id)].copy()\n",
    "# print(\"after filter on cover similarity\", df.shape)\n",
    "# df = df[~df[\"s3_id\"].isin(df_artist_drops_id)].copy()\n",
    "# print(\"after filter on artist similarity\", df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:32.320291Z",
     "iopub.status.busy": "2025-06-03T17:50:32.320179Z",
     "iopub.status.idle": "2025-06-03T17:50:32.978455Z",
     "shell.execute_reply": "2025-06-03T17:50:32.977949Z",
     "shell.execute_reply.started": "2025-06-03T17:50:32.320281Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "after dropna (492414, 84)\n"
     ]
    }
   ],
   "source": [
    "df = df.dropna(axis=1, how=\"all\")\n",
    "print(\"after dropna\", df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.199480Z",
     "start_time": "2024-05-16T13:58:53.963687Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:50:32.979175Z",
     "iopub.status.busy": "2025-06-03T17:50:32.978946Z",
     "iopub.status.idle": "2025-06-03T17:52:56.645432Z",
     "shell.execute_reply": "2025-06-03T17:52:56.644926Z",
     "shell.execute_reply.started": "2025-06-03T17:50:32.979161Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6442462\n",
      "6442462\n",
      "pre-downloaded df (492414, 84)\n",
      "downloaded df (492414, 84)\n"
     ]
    }
   ],
   "source": [
    "converted_paths = os.listdir(NPZ_DIR)\n",
    "print(len(converted_paths))\n",
    "\n",
    "converted_paths = set([f.replace(\".npz\", \"\") for f in converted_paths])\n",
    "print(len(converted_paths))\n",
    "\n",
    "print(\"pre-downloaded df\", df.shape)\n",
    "df[df[\"s3_id\"].isin(converted_paths)].shape\n",
    "df = df[df[\"s3_id\"].isin(converted_paths)].copy()\n",
    "print(\"downloaded df\", df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.467253Z",
     "start_time": "2024-05-16T13:58:56.207647Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:52:56.646057Z",
     "iopub.status.busy": "2025-06-03T17:52:56.645919Z",
     "iopub.status.idle": "2025-06-03T17:52:57.767989Z",
     "shell.execute_reply": "2025-06-03T17:52:57.767565Z",
     "shell.execute_reply.started": "2025-06-03T17:52:56.646044Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "is_30b\n",
      "True    492414\n",
      "Name: count, dtype: int64\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "task\n",
       "artist_consistency    226216\n",
       "cover                 223066\n",
       "infill                 42932\n",
       "infill_intro             196\n",
       "artist_cover               4\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"is_30b\"] = df[\"model_name\"].str.contains(\"-t\")\n",
    "print(df[\"is_30b\"].value_counts())\n",
    "df[\"task\"].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# LET's do the data prep"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:52:57.768584Z",
     "iopub.status.busy": "2025-06-03T17:52:57.768466Z",
     "iopub.status.idle": "2025-06-03T17:52:57.782596Z",
     "shell.execute_reply": "2025-06-03T17:52:57.782236Z",
     "shell.execute_reply.started": "2025-06-03T17:52:57.768572Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(492414, 85)\n"
     ]
    }
   ],
   "source": [
    "# drop extend for now\n",
    "# reason is -- cause they are likely caused by extend from 13b\n",
    "# we don't want contamination\n",
    "# df = df[df[\"task\"] != \"extend\"].copy()\n",
    "print(df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.592883Z",
     "start_time": "2024-05-16T13:58:56.470781Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:52:57.783307Z",
     "iopub.status.busy": "2025-06-03T17:52:57.782993Z",
     "iopub.status.idle": "2025-06-03T17:52:57.929472Z",
     "shell.execute_reply": "2025-06-03T17:52:57.928973Z",
     "shell.execute_reply.started": "2025-06-03T17:52:57.783295Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preference  model_name    \n",
      "False       chirp-v4-h-t-6    246207\n",
      "True        chirp-v4-h-t-6    246207\n",
      "Name: count, dtype: int64\n",
      "before filter on model name (492414, 85)\n",
      "after filter on model name (492414, 85)\n"
     ]
    }
   ],
   "source": [
    "## for 13b this is easy for now\n",
    "print(df.groupby([\"preference\"])[\"model_name\"].value_counts())\n",
    "print(\"before filter on model name\", df.shape)\n",
    "df = df[df[\"model_name\"].isin([\"chirp-v4-h-t-6\", \"chirp-v3p5-engine-t-6\"])]\n",
    "# df = df[df[\"model_name\"].isin([\"chirp-v3p5-engine-t-6\"])]\n",
    "print(\"after filter on model name\", df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:52:57.930077Z",
     "iopub.status.busy": "2025-06-03T17:52:57.929956Z",
     "iopub.status.idle": "2025-06-03T17:52:57.945943Z",
     "shell.execute_reply": "2025-06-03T17:52:57.945579Z",
     "shell.execute_reply.started": "2025-06-03T17:52:57.930065Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "is_public\n",
      "False    477662\n",
      "True      14752\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(df[\"is_public\"].value_counts())\n",
    "# remove public for now cause fucking users\n",
    "# df = df[~df[\"is_public\"]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.909539Z",
     "start_time": "2024-05-16T13:58:56.595736Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:52:57.946651Z",
     "iopub.status.busy": "2025-06-03T17:52:57.946358Z",
     "iopub.status.idle": "2025-06-03T17:52:58.425517Z",
     "shell.execute_reply": "2025-06-03T17:52:58.425002Z",
     "shell.execute_reply.started": "2025-06-03T17:52:57.946639Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "before filter on request id pairs (492414, 85)\n",
      "after filter on request id pairs (492414, 85)\n",
      "preference  model_name    \n",
      "False       chirp-v4-h-t-6    246207\n",
      "True        chirp-v4-h-t-6    246207\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(\"before filter on request id pairs\", df.shape)\n",
    "df = df[\n",
    "    df[\"request_id\"].isin(\n",
    "        df[\"request_id\"].value_counts().index[df[\"request_id\"].value_counts() == 2]\n",
    "    )\n",
    "]\n",
    "print(\"after filter on request id pairs\", df.shape)\n",
    "print(df.groupby([\"preference\"])[\"model_name\"].value_counts())\n",
    "assert df.shape[0] == df[\"request_id\"].nunique() * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:52:58.426302Z",
     "iopub.status.busy": "2025-06-03T17:52:58.426024Z",
     "iopub.status.idle": "2025-06-03T17:54:05.548721Z",
     "shell.execute_reply": "2025-06-03T17:54:05.548216Z",
     "shell.execute_reply.started": "2025-06-03T17:52:58.426289Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "unique_requests 246207\n",
      "before removing duplicates (492414, 149)\n",
      "after removing duplicates (492414, 142)\n"
     ]
    }
   ],
   "source": [
    "# Let's use the old selection for now -- for quality assurance\n",
    "# expand the metadata columns -- this takes forever...~ 6 mins\n",
    "# test_slice = df[\"metadata\"].apply(lambda x: ast.literal_eval(str(x)))\n",
    "# test_slice = df[\"metadata\"].apply(lambda x: custom_parse(x))\n",
    "test_slice = df[\"metadata\"]  # .apply(lambda x: custom_parse(x))\n",
    "test_slice_series = test_slice.apply(pd.Series)\n",
    "df = pd.concat([df, test_slice_series], axis=1, join=\"inner\")\n",
    "print(\"unique_requests\", df[\"request_id\"].nunique())\n",
    "# remove the duplicates\n",
    "print(\"before removing duplicates\", df.shape)\n",
    "df = df.loc[:, ~df.columns.duplicated()].copy()\n",
    "print(\"after removing duplicates\", df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:05.549335Z",
     "iopub.status.busy": "2025-06-03T17:54:05.549203Z",
     "iopub.status.idle": "2025-06-03T17:54:06.352623Z",
     "shell.execute_reply": "2025-06-03T17:54:06.352187Z",
     "shell.execute_reply.started": "2025-06-03T17:54:05.549322Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "task\n",
       "artist_consistency    226216\n",
       "cover                 223066\n",
       "infill                 42932\n",
       "infill_intro             196\n",
       "artist_cover               4\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"task\"].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:06.353326Z",
     "iopub.status.busy": "2025-06-03T17:54:06.353111Z",
     "iopub.status.idle": "2025-06-03T17:54:06.989772Z",
     "shell.execute_reply": "2025-06-03T17:54:06.989342Z",
     "shell.execute_reply.started": "2025-06-03T17:54:06.353312Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pos_diff_preference\n",
       "1.0    164312\n",
       "2.0     81895\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = df.sort_values(by=[\"request_id\", \"preference\", \"diff_preference\"])\n",
    "df[\"pos_diff_preference\"] = df[\"diff_preference\"].diff()\n",
    "# df[\"cer_diff_preference\"] = df[\"cer\"].diff()\n",
    "df[df[\"preference\"]][\"pos_diff_preference\"].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:06.990464Z",
     "iopub.status.busy": "2025-06-03T17:54:06.990250Z",
     "iopub.status.idle": "2025-06-03T17:54:18.463380Z",
     "shell.execute_reply": "2025-06-03T17:54:18.462882Z",
     "shell.execute_reply.started": "2025-06-03T17:54:06.990451Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Found 56082 duplicated prompts 28042 unique requests\n",
      "Found 14205 request_ids with duplicate prompts but not highest play counts in their group\n",
      "['4e63112e-d263-4f17-9b19-a54c6c9fb5ed', 'c8ebad8f-c615-415c-b862-94b70ff16db4', 'e96de9de-c73f-49d7-b849-86ad6c337eb6', '30ef041d-b590-47a8-b983-facbcd836603', 'd3e2e49c-3a1b-4fb8-93cd-9772b4591df5', '234579d2-d149-4b95-bcaf-4b90a0ae0644', '8e3097d6-c0b7-4ddf-8e32-431104b6932e', 'a2fcf558-6273-4748-93c5-5bdf73c52dce', '89f7a081-6625-4347-80fe-9293c1a9de9d', '0727f86a-7750-40a2-ad80-52d794d54914']\n",
      "Before dedup user gen requests 492414\n",
      "After dedup user gen requests 464004\n"
     ]
    }
   ],
   "source": [
    "# Find duplicated prompts with count > 2\n",
    "duplicate_entries = df.groupby([\"user_id\", \"prompt_text\", \"tags\", \"task\"]).filter(\n",
    "    lambda x: len(x) > 2\n",
    ")\n",
    "print(\n",
    "    \"Found\",\n",
    "    len(duplicate_entries),\n",
    "    \"duplicated prompts\",\n",
    "    len(duplicate_entries[\"request_id\"].unique()),\n",
    "    \"unique requests\",\n",
    ")\n",
    "\n",
    "# Group by user_id, prompt_text, and tags to find duplicate prompt groups\n",
    "prompt_groups = duplicate_entries.groupby([\"user_id\", \"prompt_text\", \"tags\", \"task\"])\n",
    "\n",
    "# For each prompt group, find the request_id with the highest total reaction_play_count\n",
    "low_play_count_request_ids = []\n",
    "for prompt_key, prompt_group in prompt_groups:\n",
    "    # Get the sum of reaction_play_count for each request_id in this group\n",
    "    request_play_counts = prompt_group.groupby(\"request_id\")[\n",
    "        \"reaction_play_count\"\n",
    "    ].sum()\n",
    "\n",
    "    # Find the max play count in this group\n",
    "    max_play_count = request_play_counts.max()\n",
    "\n",
    "    # Add request_ids that don't have the max play count to our filter list\n",
    "    lower_play_count_request_ids = request_play_counts[\n",
    "        request_play_counts < max_play_count\n",
    "    ].index.tolist()\n",
    "    low_play_count_request_ids.extend(lower_play_count_request_ids)\n",
    "\n",
    "# Display the filtered request IDs\n",
    "print(\n",
    "    f\"Found {len(low_play_count_request_ids)} request_ids with duplicate prompts but not highest play counts in their group\"\n",
    ")\n",
    "print(\n",
    "    low_play_count_request_ids[:10]\n",
    "    if len(low_play_count_request_ids) > 10\n",
    "    else low_play_count_request_ids\n",
    ")\n",
    "print(\"Before dedup user gen requests\", df.shape[0])\n",
    "df = df[~df[\"request_id\"].isin(low_play_count_request_ids)]\n",
    "print(\"After dedup user gen requests\", df.shape[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:18.464075Z",
     "iopub.status.busy": "2025-06-03T17:54:18.463865Z",
     "iopub.status.idle": "2025-06-03T17:54:18.696519Z",
     "shell.execute_reply": "2025-06-03T17:54:18.696029Z",
     "shell.execute_reply.started": "2025-06-03T17:54:18.464062Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "positive param_experiment\n",
      "step_12             11664\n",
      "step_8              11306\n",
      "text_3              11230\n",
      "text_1              11112\n",
      "temp_s_80            5820\n",
      "temp_s_70            5763\n",
      "adjust_cfg_steps     5713\n",
      "min_p_01              495\n",
      "min_p_02              491\n",
      "min_p_005             465\n",
      "min_p_0001            199\n",
      "min_p_002             179\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "try:\n",
    "    print(\"positive\", df[df[\"preference\"]][\"param_experiment\"].value_counts())\n",
    "except:\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:18.697208Z",
     "iopub.status.busy": "2025-06-03T17:54:18.697000Z",
     "iopub.status.idle": "2025-06-03T17:54:18.710873Z",
     "shell.execute_reply": "2025-06-03T17:54:18.710491Z",
     "shell.execute_reply.started": "2025-06-03T17:54:18.697195Z"
    }
   },
   "outputs": [],
   "source": [
    "# df[df[\"preference\"]][\"cer_diff_preference\"].hist(bins=50)\n",
    "# print(df[df[\"preference\"]][\"cer_diff_preference\"].quantile(0.95))\n",
    "# plt.show()\n",
    "# print(df[df[\"preference\"]][\"cer\"].hist(bins=50))\n",
    "# plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:40.799375Z",
     "start_time": "2024-05-16T13:59:36.394236Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:18.713998Z",
     "iopub.status.busy": "2025-06-03T17:54:18.713723Z",
     "iopub.status.idle": "2025-06-03T17:54:20.791088Z",
     "shell.execute_reply": "2025-06-03T17:54:20.790606Z",
     "shell.execute_reply.started": "2025-06-03T17:54:18.713984Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "17781\n",
      "good_continue_at\n",
      "True    464004\n",
      "Name: count, dtype: int64\n",
      "\n",
      " Check some basics... \n",
      " preference\n",
      "False    232002\n",
      "True     232002\n",
      "Name: count, dtype: int64 is_30b\n",
      "True    464004\n",
      "Name: count, dtype: int64 model_name\n",
      "chirp-v4-h-t-6    464004\n",
      "Name: count, dtype: int64 preference  model_name    \n",
      "False       chirp-v4-h-t-6    232002\n",
      "True        chirp-v4-h-t-6    232002\n",
      "Name: count, dtype: int64\n",
      "task\n",
      "artist_consistency    215926\n",
      "cover                 207594\n",
      "infill                 40286\n",
      "infill_intro             194\n",
      "artist_cover               4\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "df[\"id\"] = df[\"str_id\"]\n",
    "# get the original duration of the clips, if they are concacted\n",
    "df[\"original_duration_s\"] = df[\"total_start_s\"] + df[\"duration\"]\n",
    "# classify the continue at behavoirs by the duration choice\n",
    "audio_prompt_id_to_continue_at = {}\n",
    "\n",
    "for _, row in df[~df[\"continued_parent\"].isna()].iterrows():\n",
    "    audio_prompt_id = row[\"continued_parent\"]\n",
    "    if audio_prompt_id not in audio_prompt_id_to_continue_at:\n",
    "        audio_prompt_id_to_continue_at[audio_prompt_id] = row[\"continue_at\"]\n",
    "    else:\n",
    "        # pick the max\n",
    "        audio_prompt_id = max(\n",
    "            audio_prompt_id_to_continue_at[audio_prompt_id], row[\"continue_at\"]\n",
    "        )\n",
    "print(len(audio_prompt_id_to_continue_at))\n",
    "df[\"has_continue_and_start_continue_at\"] = df[\"id\"].apply(\n",
    "    lambda x: audio_prompt_id_to_continue_at.get(x)\n",
    ")\n",
    "# we want continue at to be at most of the clip...\n",
    "df[\"good_continue_at\"] = (\n",
    "    (df[\"has_continue_and_start_continue_at\"] / df[\"duration\"]) > 0.9\n",
    ") | df[\"has_continue_and_start_continue_at\"].isna()\n",
    "print(df[\"good_continue_at\"].value_counts())\n",
    "\n",
    "\n",
    "print(\n",
    "    \"\\n Check some basics... \\n\",\n",
    "    df[\"preference\"].value_counts(),\n",
    "    df[\"is_30b\"].value_counts(),\n",
    "    df[\"model_name\"].value_counts(),\n",
    "    df.groupby([\"preference\"])[\"model_name\"].value_counts(),\n",
    ")\n",
    "\n",
    "df = df.sort_values(by=[\"request_id\", \"preference\"])\n",
    "df[\"duration_rel_diff\"] = df[\"duration\"].diff()\n",
    "df[\"play_rel_diff\"] = df[\"reaction_play_count\"].diff()\n",
    "print(df[\"task\"].value_counts())\n",
    "\n",
    "df[\"post_infill_duration\"] = (\n",
    "    df[\"duration\"]\n",
    "    + df[\"infill_context_end_s\"]\n",
    "    - df[\"infill_context_start_s\"]\n",
    "    - df[\"include_future_s\"]\n",
    "    - df[\"include_history_s\"]\n",
    "    - df[\"infill_dur_s\"]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:20.791779Z",
     "iopub.status.busy": "2025-06-03T17:54:20.791566Z",
     "iopub.status.idle": "2025-06-03T17:54:21.000214Z",
     "shell.execute_reply": "2025-06-03T17:54:20.999797Z",
     "shell.execute_reply.started": "2025-06-03T17:54:20.791766Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAGhCAYAAAB/I44UAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA5bklEQVR4nO3dfXRU9YHG8WcmL7zlhZgJAoLIJiagARLUQ4NDU13R3QI9G9g1nFIVlyNYirCKAktREqDhRXARZQtLWQSBpq4glSp21S0unvBWDymFRiBiJWzqJhOBvCCQZO7+wWZkYkgyYZLJb+b7OYdzmHt/M/f3cEfz5N47d2yWZVkCAAAwiD3QEwAAAPAVBQYAABiHAgMAAIxDgQEAAMahwAAAAONQYAAAgHEoMAAAwDgUGAAAYBwKDAAAMA4FBgAAGOeGCsy//du/KSUlRT/72c88yy5fvqzc3F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q/Td735Xffr0UU1NjX7zm9/o0KFD2rhxY1Du5wbN5Q6Gfc23UfvJ1q1btXHjRpWXl2vw4MFasGCB53BcMHj66ad1+PBhnT9/XjfddJPuuusuPf30057zpJcvX9ayZcv0zjvv6MqVK3I6nVq4cGGnOMzYWgcPHtSjjz76reVZWVlatmyZLMvSmjVr9MYbb6iyslJ33XWXFi5cqIEDB3rGnj9/XosXL9Z//dd/yW6368EHH9SCBQvUo0ePjozik+Zy5+Tk6Cc/+Yn+9Kc/qaqqSr169dK9996rWbNmeZ0iNTF3SkpKk8uXLl3q+eWjNe/r//mf/1FOTo4OHTqkbt26KSsrS7Nnz1Z4eOf7/bClzH/5y1/03HPP6dSpU7p48aL69OmjBx54QNOnT1dUVJRnvEmZJWn+/Pk6cOCAysrKFB0drZSUFD3xxBO69957JQXffm7QXO5g2NcUGAAAYByugQEAAMahwAAAAONQYAAAgHEoMAAAwDgUGAAAYBwKDAAAMA4FBgAAGIcCAwAAjEOBAQAAxqHAAAAA41BgAACAcSgwAADAOP8HWTYXCdo4YRUAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df[\"post_infill_duration\"].hist(bins=np.linspace(-5, 360, 100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:21.000795Z",
     "iopub.status.busy": "2025-06-03T17:54:21.000677Z",
     "iopub.status.idle": "2025-06-03T17:54:21.014623Z",
     "shell.execute_reply": "2025-06-03T17:54:21.014274Z",
     "shell.execute_reply.started": "2025-06-03T17:54:21.000783Z"
    }
   },
   "outputs": [],
   "source": [
    "# df = df[df[\"task\"].isin([\"extend\", \"\"])].copy()\n",
    "# print(df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.035167Z",
     "start_time": "2024-05-16T13:59:40.801098Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:21.015247Z",
     "iopub.status.busy": "2025-06-03T17:54:21.015093Z",
     "iopub.status.idle": "2025-06-03T17:54:21.952769Z",
     "shell.execute_reply": "2025-06-03T17:54:21.952273Z",
     "shell.execute_reply.started": "2025-06-03T17:54:21.015235Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "after duration 0.9985819087766484\n",
      "after infill duration 0.9897759502073258\n",
      "neg_filter_reaction_play_count 1.0\n",
      "neg_filter_upvote_count 0.9892\n",
      "neg_filter_norm_play_frac 1.0\n",
      "neg_filter_continues 1.0\n",
      "----------------\n",
      "pos_filter_continues 1.0\n",
      "pos_filter_reaction_play_count 1.0\n",
      "pos_filter_relative_play_count 0.9704\n",
      "pos_filter_cer_diff_preference 1.0\n",
      "pos_filter_bad_flags 0.9998\n",
      "after filter on play counts 0.9586\n",
      "after filter on higher quality 0.3119\n",
      "----------------\n",
      "negative 226706 positive 54319\n",
      "----------------\n",
      "total pair requests 232002  --> selected pair requests 53552 frac 0.231\n"
     ]
    }
   ],
   "source": [
    "normal_pos_play_count = 3\n",
    "# this is lower, cause a concat is probably already ensuring that it is good\n",
    "concat_pos_play_count = 1\n",
    "# this is a filter on the concated clip\n",
    "concat_total_play_count = 3\n",
    "\n",
    "all_fitlers = (df[\"duration\"] >= 10) & (df[\"duration\"] <= 240)\n",
    "print(\"after duration\", all_fitlers.sum() / df.shape[0])\n",
    "infill_duration_filter = (\n",
    "    ~df[\"task\"].isin(\n",
    "        [\n",
    "            \"infill\",\n",
    "            \"infill_intro\",\n",
    "            \"infill_outro\",\n",
    "        ]\n",
    "    )\n",
    ") | (df[\"post_infill_duration\"] <= 239)\n",
    "print(\"after infill duration\", infill_duration_filter.sum() / df.shape[0])\n",
    "# negative fitlers\n",
    "total_negative = df[~df[\"preference\"]].shape[0]\n",
    "neg_filter_reaction_play_count = (~df[\"preference\"]) & (df[\"reaction_play_count\"] >= 1)\n",
    "print(\n",
    "    \"neg_filter_reaction_play_count\",\n",
    "    round(neg_filter_reaction_play_count.sum() / total_negative, 4),\n",
    ")\n",
    "neg_filter_upvote_count = (~df[\"preference\"]) & (df[\"upvote_count\"] == 0)\n",
    "print(\n",
    "    \"neg_filter_upvote_count\",\n",
    "    round(neg_filter_upvote_count.sum() / total_negative, 4),\n",
    ")\n",
    "neg_filter_norm_play_frac = (~df[\"preference\"]) & (df[\"norm_play_frac\"] <= 3.1)\n",
    "print(\n",
    "    \"neg_filter_norm_play_frac\",\n",
    "    round(neg_filter_norm_play_frac.sum() / total_negative, 4),\n",
    ")\n",
    "neg_filter_continues = (~df[\"preference\"]) & (\n",
    "    df[\"has_continue_and_start_continue_at\"].isna()\n",
    ")\n",
    "print(\n",
    "    \"neg_filter_continues\",\n",
    "    round(neg_filter_continues.sum() / total_negative, 4),\n",
    ")\n",
    "\n",
    "neg_filter_selection_mask = (\n",
    "    all_fitlers\n",
    "    & infill_duration_filter\n",
    "    & neg_filter_reaction_play_count\n",
    "    & neg_filter_upvote_count\n",
    "    & neg_filter_norm_play_frac\n",
    "    & neg_filter_continues\n",
    ")\n",
    "\n",
    "print(\"----------------\")\n",
    "total_positive = df[df[\"preference\"]].shape[0]\n",
    "assert total_positive == total_negative\n",
    "pos_filter_continues = (df[\"preference\"]) & (df[\"good_continue_at\"])\n",
    "print(\"pos_filter_continues\", round(pos_filter_continues.sum() / total_positive, 4))\n",
    "pos_filter_reaction_play_count = (df[\"preference\"]) & (df[\"reaction_play_count\"] >= 1)\n",
    "print(\n",
    "    \"pos_filter_reaction_play_count\",\n",
    "    round(pos_filter_reaction_play_count.sum() / total_positive, 4),\n",
    ")\n",
    "pos_filter_relative_play_count = (df[\"preference\"]) & (df[\"play_rel_diff\"] >= 0)\n",
    "print(\n",
    "    \"pos_filter_relative_play_count\",\n",
    "    round(pos_filter_relative_play_count.sum() / total_positive, 4),\n",
    ")\n",
    "pos_filter_cer_diff_preference = (\n",
    "    df[\n",
    "        \"preference\"\n",
    "    ]  # & (df[\"pos_diff_preference\"] == 2) # & (df[\"cer_diff_preference\"] < 0.5) & (df[\"cer\"] < 0.99)\n",
    ")\n",
    "print(\n",
    "    \"pos_filter_cer_diff_preference\",\n",
    "    round(pos_filter_cer_diff_preference.sum() / total_positive, 4),\n",
    ")\n",
    "pos_filter_bad_flags = (\n",
    "    (df[\"preference\"]) & (df[\"flag_count\"] == 0) & (df[\"dislike_count\"] == 0)\n",
    ")\n",
    "print(\n",
    "    \"pos_filter_bad_flags\",\n",
    "    round(pos_filter_bad_flags.sum() / total_positive, 4),\n",
    ")\n",
    "pos_filter_play_counts = (df[\"preference\"]) & (\n",
    "    (\n",
    "        (df[\"part_of_concat\"])\n",
    "        & (df[\"reaction_play_count\"] >= concat_pos_play_count)\n",
    "        & (df[\"concat_play_counts\"] >= concat_total_play_count)\n",
    "    )\n",
    "    | (\n",
    "        (~df[\"part_of_concat\"]) & (df[\"reaction_play_count\"] >= normal_pos_play_count)\n",
    "        # & (df[\"norm_play_frac\"] >= 2.1)  # this is a bit of a luxury cut...\n",
    "    )\n",
    ")\n",
    "print(\n",
    "    \"after filter on play counts\",\n",
    "    round(pos_filter_play_counts.sum() / total_positive, 4),\n",
    ")\n",
    "high_quality_tasks_filter = (\n",
    "    (df[\"task\"].isin([\"cover\", \"extend\", \"artist_consistency\", \"\"]))\n",
    "    & (\n",
    "        (df[\"upvote_count\"] >= 1)  # (df[\"upvote_count\"] >= 1)\n",
    "        | (df[\"reaction_play_count\"] >= 5)\n",
    "        | (df[\"concat_play_counts\"] >= 5)\n",
    "    )\n",
    "    & (\n",
    "        (df[\"part_of_concat\"])\n",
    "        | (\n",
    "            (~df[\"part_of_concat\"])\n",
    "            & (df[\"norm_play_frac\"] >= 5.1)  # this is a bit of a luxury cut...\n",
    "            & (\n",
    "                df[\"norm_play_frac\"] >= df[\"reaction_play_count\"] / 3\n",
    "            )  # play duration is not low on average\n",
    "        )\n",
    "    )\n",
    ")\n",
    "medium_quality_tasks_filter = (\n",
    "    df[\"task\"].isin(\n",
    "        [\n",
    "            \"infill\",\n",
    "            \"infill_intro\",\n",
    "            \"infill_outro\",\n",
    "        ]\n",
    "    )\n",
    ") & (\n",
    "    (\n",
    "        df[\"upvote_count\"] >= 1\n",
    "    )  # (df[\"upvote_count\"] >= 1)  (df[\"pos_diff_preference\"] == 2)\n",
    "    | (df[\"reaction_play_count\"] >= 5)\n",
    "    | (df[\"concat_play_counts\"] >= 5)\n",
    ")\n",
    "pos_filter_higher_quality = (df[\"preference\"]) & (\n",
    "    high_quality_tasks_filter | medium_quality_tasks_filter\n",
    ")\n",
    "print(\n",
    "    \"after filter on higher quality\",\n",
    "    round(pos_filter_higher_quality.sum() / total_positive, 4),\n",
    ")\n",
    "\n",
    "user_gen_filter = (\n",
    "    df[\"user_n_clips\"] >= 100\n",
    ")  # user needs to have genereated at least 100 over the time period\n",
    "\n",
    "print(\"----------------\")\n",
    "pos_filter_selectin_mask = (\n",
    "    (df[\"preference\"])  # get basics aligned\n",
    "    & all_fitlers\n",
    "    & infill_duration_filter\n",
    "    & pos_filter_continues\n",
    "    & pos_filter_reaction_play_count\n",
    "    & pos_filter_relative_play_count\n",
    "    & pos_filter_cer_diff_preference\n",
    "    & pos_filter_bad_flags\n",
    "    & pos_filter_play_counts\n",
    "    & pos_filter_higher_quality\n",
    "    & user_gen_filter\n",
    ")\n",
    "print(\n",
    "    \"negative\",\n",
    "    sum(neg_filter_selection_mask),\n",
    "    \"positive\",\n",
    "    sum(pos_filter_selectin_mask),\n",
    ")\n",
    "\n",
    "neg_filter_requests = df[neg_filter_selection_mask][\"request_id\"].unique()\n",
    "pos_filter_requests = df[pos_filter_selectin_mask][\"request_id\"].unique()\n",
    "# looking for very strong signal here:\n",
    "# listen to the positive/negative more than once\n",
    "# disliked one of the clips\n",
    "unique_requests = set(pos_filter_requests).intersection(neg_filter_requests)\n",
    "print(\"----------------\")\n",
    "print(\n",
    "    \"total pair requests\",\n",
    "    df[\"request_id\"].nunique(),\n",
    "    \" --> selected pair requests\",\n",
    "    len(unique_requests),\n",
    "    f\"frac {len(unique_requests) / df['request_id'].nunique():.3f}\",\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.250737Z",
     "start_time": "2024-05-16T13:59:41.036434Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:21.953544Z",
     "iopub.status.busy": "2025-06-03T17:54:21.953350Z",
     "iopub.status.idle": "2025-06-03T17:54:22.287572Z",
     "shell.execute_reply": "2025-06-03T17:54:22.287074Z",
     "shell.execute_reply.started": "2025-06-03T17:54:21.953531Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30b_t6_v35 requests 53552 clips 107104 total khrs 4.211; N gpus for 1000 iters 6.694; 4 gpus for x iters 1673.500; n unique users 20691 n pro users 20161\n"
     ]
    }
   ],
   "source": [
    "df_slice = df[df[\"request_id\"].isin(set(unique_requests))].copy()\n",
    "print(\n",
    "    f\"{os.path.basename(OUT_DATA_DIR)} requests\",\n",
    "    df_slice[\"request_id\"].nunique(),\n",
    "    \"clips\",\n",
    "    df_slice.shape[0],\n",
    "    f\"total khrs {sum(df_slice['duration'] / 3600 / 1000):.3f};\",\n",
    "    f\"N gpus for 1000 iters {df_slice.shape[0] / 8 / 2 / 1000:.3f};\",\n",
    "    f\"4 gpus for x iters {df_slice.shape[0] / 8 / 2 / 4:.3f};\",\n",
    "    f\"n unique users {df_slice['user_id'].nunique()}\",\n",
    "    f\"n pro users {df_slice[df_slice['is_pro_user']]['user_id'].nunique()}\",\n",
    ")\n",
    "# 76171 152342 total khrs 2.880 n gpus for 1250 iters 3.809\n",
    "# v10 has 78866\n",
    "# v14 has 110402\n",
    "# 30b_t4_v12 requests 47755 clips 95510 total khrs 4.555; N gpus for 1000 iters 5.969; 4 gpus for x iters 1492.344; n unique users 13790 n pro users 13526\n",
    "# 30b_t4_v20 requests 18306 clips 36612 total khrs 1.754; N gpus for 1000 iters 2.288; 4 gpus for x iters 572.062; n unique users 6943 n pro users 6714\n",
    "# 30b_t5_v5 requests 21318 clips 42636 total khrs 1.938; N gpus for 1000 iters 2.665; 4 gpus for x iters 666.188; n unique users 11661 n pro users 9347\n",
    "# 30b_t5_v6 requests 22833 clips 45666 total khrs 2.072; N gpus for 1000 iters 2.854; 4 gpus for x iters 713.531; n unique users 12576 n pro users 9910\n",
    "# 30b_t5_v7 requests 33197 clips 66394 total khrs 2.846; N gpus for 1000 iters 4.150; 4 gpus for x iters 1037.406; n unique users 16665 n pro users 13050\n",
    "# 30b_t5_v8 requests 20907 clips 41814 total khrs 1.629; N gpus for 1000 iters 2.613; 4 gpus for x iters 653.344; n unique users 11102 n pro users 9052\n",
    "# 30b_t5_v9 requests 24645 clips 49290 total khrs 1.918; N gpus for 1000 iters 3.081; 4 gpus for x iters 770.156; n unique users 12661 n pro users 10229\n",
    "# 30b_t5_v11 requests 21975 clips 43950 total khrs 1.508; N gpus for 1000 iters 2.747; 4 gpus for x iters 686.719; n unique users 11173 n pro users 9270\n",
    "# 30b_t5_v12 requests 21436 clips 42872 total khrs 1.582; N gpus for 1000 iters 2.679; 4 gpus for x iters 669.875; n unique users 11553 n pro users 9374\n",
    "# 30b_t5_v13 requests 25912 clips 51824 total khrs 1.922; N gpus for 1000 iters 3.239; 4 gpus for x iters 809.750; n unique users 13429 n pro users 10737\n",
    "# 30b_t5_v14 requests 27687 clips 55374 total khrs 2.036; N gpus for 1000 iters 3.461; 4 gpus for x iters 865.219; n unique users 14196 n pro users 11227\n",
    "# 30b_t5_v15 requests 29563 clips 59126 total khrs 2.225; N gpus for 1000 iters 3.695; 4 gpus for x iters 923.844; n unique users 14684 n pro users 11642\n",
    "# 30b_t6_v1 requests 24678 clips 49356 total khrs 1.934; N gpus for 1000 iters 3.085; 4 gpus for x iters 771.188; n unique users 11350 n pro users 10065\n",
    "# 30b_t6_v2 requests 49341 clips 98682 total khrs 4.332; N gpus for 1000 iters 6.168; 4 gpus for x iters 1541.906; n unique users 19992 n pro users 16972\n",
    "# 30b_t6_v3 requests 54967 clips 109934 total khrs 4.826; N gpus for 1000 iters 6.871; 4 gpus for x iters 1717.719; n unique users 21653 n pro users 18266\n",
    "# 30b_t6_v5 requests 29459 clips 58918 total khrs 2.657; N gpus for 1000 iters 3.682; 4 gpus for x iters 920.594; n unique users 14091 n pro users 11884\n",
    "# 30b_t6_v7 requests 40056 clips 80112 total khrs 3.354; N gpus for 1000 iters 5.007; 4 gpus for x iters 1251.750; n unique users 17440 n pro users 14476\n",
    "# 30b_t6_v8 requests 31681 clips 63362 total khrs 2.681; N gpus for 1000 iters 3.960; 4 gpus for x iters 990.031; n unique users 15180 n pro users 15078\n",
    "# 30b_t6_v9 requests 55785 clips 111570 total khrs 4.727; N gpus for 1000 iters 6.973; 4 gpus for x iters 1743.281; n unique users 23114 n pro users 22871\n",
    "# 30b_t6_v10 requests 52209 clips 104418 total khrs 4.515; N gpus for 1000 iters 6.526; 4 gpus for x iters 1631.531; n unique users 22216 n pro users 21893\n",
    "# 30b_t6_v11 requests 31338 clips 62676 total khrs 2.493; N gpus for 1000 iters 3.917; 4 gpus for x iters 979.312; n unique users 15190 n pro users 14973\n",
    "# 30b_t6_v13 requests 50856 clips 101712 total khrs 3.987; N gpus for 1000 iters 6.357; 4 gpus for x iters 1589.250; n unique users 23547 n pro users 23097\n",
    "# 30b_t6_v15 requests 65213 clips 130426 total khrs 5.217; N gpus for 1000 iters 8.152; 4 gpus for x iters 2037.906; n unique users 28763 n pro users 27964\n",
    "# 30b_t6_v16 requests 37907 clips 75814 total khrs 2.956; N gpus for 1000 iters 4.738; 4 gpus for x iters 1184.594; n unique users 18448 n pro users 17212\n",
    "# 30b_t6_v17 requests 51543 clips 103086 total khrs 4.154; N gpus for 1000 iters 6.443; 4 gpus for x iters 1610.719; n unique users 24223 n pro users 21829\n",
    "# 30b_t6_v18 requests 94965 clips 189930 total khrs 7.483; N gpus for 1000 iters 11.871; 4 gpus for x iters 2967.656; n unique users 23852 n pro users 21767\n",
    "# 30b_t6_v19 requests 34289 clips 68578 total khrs 2.846; N gpus for 1000 iters 4.286; 4 gpus for x iters 1071.531; n unique users 11802 n pro users 10830\n",
    "# 30b_t6_v20 requests 53258 clips 106516 total khrs 4.270; N gpus for 1000 iters 6.657; 4 gpus for x iters 1664.312; n unique users 22096 n pro users 21171\n",
    "# 30b_t6_v22 requests 29971 clips 59942 total khrs 1.992; N gpus for 1000 iters 3.746; 4 gpus for x iters 936.594; n unique users 13611 n pro users 13036\n",
    "# 30b_t6_v24 requests 45333 clips 90666 total khrs 3.343; N gpus for 1000 iters 5.667; 4 gpus for x iters 1416.656; n unique users 18853 n pro users 18049\n",
    "# 30b_t6_v25 requests 28154 clips 56308 total khrs 2.401; N gpus for 1000 iters 3.519; 4 gpus for x iters 879.812; n unique users 12946 n pro users 12361\n",
    "# 30b_t6_v26 requests 30428 clips 60856 total khrs 2.599; N gpus for 1000 iters 3.804; 4 gpus for x iters 950.875; n unique users 13822 n pro users 13163\n",
    "# 30b_t6_v27 requests 43731 clips 87462 total khrs 3.862; N gpus for 1000 iters 5.466; 4 gpus for x iters 1366.594; n unique users 17898 n pro users 16865\n",
    "# 30b_t6_v28 requests 56869 clips 113738 total khrs 5.064; N gpus for 1000 iters 7.109; 4 gpus for x iters 1777.156; n unique users 22004 n pro users 20244\n",
    "# 30b_t6_v29 requests 32729 clips 65458 total khrs 2.604; N gpus for 1000 iters 4.091; 4 gpus for x iters 1022.781; n unique users 13739 n pro users 13503\n",
    "# 30b_t6_v30 requests 32553 clips 65106 total khrs 2.592; N gpus for 1000 iters 4.069; 4 gpus for x iters 1017.281; n unique users 13712 n pro users 13478\n",
    "# 30b_t6_v31 requests 41523 clips 83046 total khrs 3.164; N gpus for 1000 iters 5.190; 4 gpus for x iters 1297.594; n unique users 16266 n pro users 15967\n",
    "# 30b_t6_v34 requests 53552 clips 107104 total khrs 4.211; N gpus for 1000 iters 6.694; 4 gpus for x iters 1673.500; n unique users 20691 n pro users 20161\n",
    "# 30b_t6_v35 requests 53552 clips 107104 total khrs 4.211; N gpus for 1000 iters 6.694; 4 gpus for x iters 1673.500; n unique users 20691 n pro users 20161"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.277006Z",
     "start_time": "2024-05-16T13:59:41.252105Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.288212Z",
     "iopub.status.busy": "2025-06-03T17:54:22.288075Z",
     "iopub.status.idle": "2025-06-03T17:54:22.333048Z",
     "shell.execute_reply": "2025-06-03T17:54:22.332585Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.288200Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "positive in playlist (14348, 149)\n",
      "task\n",
      "artist_consistency    47026\n",
      "cover                 34492\n",
      "infill                25456\n",
      "infill_intro            130\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "test_mask = (df_slice[\"preference\"]) & (\n",
    "    (df_slice[\"is_in_playlist\"]) | (df_slice[\"concat_in_playlist\"])\n",
    ")\n",
    "print(\"positive in playlist\", df_slice[test_mask].shape)\n",
    "print(df_slice[\"task\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.333710Z",
     "iopub.status.busy": "2025-06-03T17:54:22.333526Z",
     "iopub.status.idle": "2025-06-03T17:54:22.471714Z",
     "shell.execute_reply": "2025-06-03T17:54:22.471290Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.333697Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAGdCAYAAAAMm0nCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGli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+M3v6amRk6nM0y9AgAAPUWPDDAxMTEaNWqUdu/e7Zvn8Xi0e/duv1NKAACgd+qRF/FK0ty5c7VkyRKNHj1aY8eO1caNG/Xll19qxowZ4e4aAAAIsx4bYL7//e/riy++0LPPPiu3261rrrlGL7zwAqeQAABAz7wLCQAAoDM98hoYAACAzhBgAACAcQgwAADAOAQYAABgHAJMEL3yyiu68cYbNWbMGN1+++3at29fuLsUVs8995zS0tL8fr73ve/5lp89e1aFhYWaOHGisrKy9JOf/ETV1dVh7HH32Lt3r+677z65XC6lpaVp586dfsu9Xq+eeeYZuVwujR07VnPmzNHf//53vzanTp3SokWLNG7cOI0fP15Lly5VfX19N+5F6HVVp4cffviC4ysvL8+vTaTX6fnnn9fMmTOVlZWl7Oxs5efn69NPP/VrY+V9VlVVpXvvvVcZGRnKzs7WE088oaampu7clZCyUqe77777guPpscce82sT6XXavHmzpk2bpnHjxmncuHHKzc3Ve++951ve044lAkyQ7NixQ0VFRfrxj3+sN954Q+np6crLy7vg24R7m6uvvloffPCB72fz5s2+ZatWrdKf//xnrV27Vi+99JJOnDih+fPnh7G33aOhoUFpaWlavnx5u8uLi4v10ksvqaCgQFu3blXfvn2Vl5ens2fP+to8+OCDqqysVElJidavX6+PP/74gg9b03VVJ0maPHmy3/H19NNP+y2P9Drt2bNHs2bN0tatW1VSUqKmpibl5eWpoaHB16ar91lzc7PmzZunxsZGbdmyRatXr9Ybb7yhZ599Nhy7FBJW6iRJd9xxh9/xtHjxYt+y3lCnK664Qg8++KBef/11vfbaa/rWt76lH//4xzp8+LCkHngseREUP/zhD72FhYW+6ebmZq/L5fI+//zzYexVeD377LPeH/zgB+0uq62t9Y4aNcr79ttv++ZVVlZ6R44c6S0tLe2mHobfyJEjve+8845v2uPxeK+//nrvCy+84JtXW1vrHT16tPfNN9/0er1f12nfvn2+Nu+99543LS3N+/nnn3df57tR2zp5vV7vkiVLvPfff3+Hr+mNdaqpqfGOHDnSu2fPHq/Xa+199u6773rT09O9brfb12bz5s3ecePGec+ePdut/e8ubevk9Xq9//Zv/+Z9/PHHO3xNb6yT1+v1Tpgwwbt169YeeSwxAhME586d04EDBzRp0iTfPLvdrkmTJqm0tDSMPQu/I0eOyOVy6bvf/a4WLVqkqqoqSdL+/fvV2NjoV7MRI0Zo8ODBKisrC1Nvw+/48eNyu91+dYmPj1dGRobvWCotLVVCQoLGjBnjazNp0iTZ7fZed9pyz549ys7O1q233qrly5fr5MmTvmW9sU5nzpyRJCUmJkqy9j4rKyvTyJEj/b4k1OVyqa6uTpWVld3X+W7Utk4ttm/frokTJ2rq1Kl66qmn9OWXX/qW9bY6NTc366233lJDQ4OysrJ65LHUY7+J1yQnT55Uc3OzkpOT/eYnJydfcJ61Nxk7dqyKioo0fPhwud1u/fKXv9SsWbO0fft2VVdXKzo6WgkJCX6vSU5OltvtDlOPw69l39s7llrONVdXV2vAgAF+y6OiopSYmNirajd58mTdfPPNGjJkiI4dO6ann35a99xzj373u9/J4XD0ujp5PB6tWrVK48aN08iRIyXJ0vusurr6gm84b5nuLXWSpKlTp2rw4MEaOHCgKioqtGbNGn322Wdat26dpN5Tp4qKCt155506e/as+vXrp1/+8pdKTU1VeXl5jzuWCDAImZycHN/v6enpysjI0A033KC3335bffr0CWPPEAmmTJni+73losubbrrJNyrT2xQWFurw4cN+15nhQh3VKTc31/d7WlqaUlJSNGfOHB09elTDhg3r7m6GzfDhw/X73/9eZ86c0X//939ryZIlevnll8PdrXZxCikIkpKS5HA4Lrhgt6amhmc3tZKQkKBvfOMbOnr0qJxOpxobG1VbW+vXpqamRikpKWHqYfi17Htnx5LT6dQXX3zht7ypqUmnT5/u1bUbOnSokpKSdOTIEUm9q04rVqzQu+++q40bN+qKK67wzbfyPnM6nRfcSdIy3Vvq1J6MjAxJ8jueekOdYmJidNVVV2n06NFatGiR0tPTtWnTph55LBFggiAmJkajRo3S7t27ffM8Ho92796trKysMPasZ6mvr9exY8eUkpKi0aNHKzo62q9mn376qaqqqpSZmRm+TobZkCFDlJKS4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AABgHAIMAAAwDgEGAAAY5/8AE6QNt5dVBYEAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df_slice[\"post_infill_duration\"].hist(bins=np.linspace(-5, 300, 100))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.323409Z",
     "start_time": "2024-05-16T13:59:41.278278Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.472384Z",
     "iopub.status.busy": "2025-06-03T17:54:22.472199Z",
     "iopub.status.idle": "2025-06-03T17:54:22.485993Z",
     "shell.execute_reply": "2025-06-03T17:54:22.485642Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.472371Z"
    }
   },
   "outputs": [],
   "source": [
    "# interesting_clips_must_be_positive_mask = (\n",
    "#     (df_slice[\"upvoted\"] == True)\n",
    "#     | (df_slice[\"has_action\"] == True)\n",
    "#     | (df_slice[\"part_of_concat\"] == True)\n",
    "# )\n",
    "# interesting_clips_must_be_not_negative_mask = (df_slice[\"downvoted\"] == False) # & (df_slice[\"dislike_count\"] < 1)\n",
    "# interesting_clips_mask = interesting_clips_must_be_positive_mask & interesting_clips_must_be_not_negative_mask\n",
    "# assert interesting_clips_mask.eq(df_slice[\"preference\"]).all()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.392244Z",
     "start_time": "2024-05-16T13:59:41.324472Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.486646Z",
     "iopub.status.busy": "2025-06-03T17:54:22.486397Z",
     "iopub.status.idle": "2025-06-03T17:54:22.496709Z",
     "shell.execute_reply": "2025-06-03T17:54:22.496364Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.486634Z"
    }
   },
   "outputs": [],
   "source": [
    "# save positive ids\n",
    "# positive_preference_ids = df_slice[df_slice[\"preference\"] == False][\"s3_id\"].to_json(orient='values')\n",
    "# with open('/home/tony/Data/Preference/7b_v2/7v_v20_full_recut_id_negative.json', 'w') as file:\n",
    "#     file.write(positive_preference_ids)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.497371Z",
     "iopub.status.busy": "2025-06-03T17:54:22.497105Z",
     "iopub.status.idle": "2025-06-03T17:54:22.507650Z",
     "shell.execute_reply": "2025-06-03T17:54:22.507313Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.497359Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice_2 = pd.read_pickle(\"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_t_6_20241118_full_slice.pkl\")\n",
    "# df_total = pd.concat([df_slice, df_slice_2])\n",
    "# print(df_total.shape)\n",
    "# df_slice = df_total"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.508347Z",
     "iopub.status.busy": "2025-06-03T17:54:22.508043Z",
     "iopub.status.idle": "2025-06-03T17:54:22.518358Z",
     "shell.execute_reply": "2025-06-03T17:54:22.518020Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.508335Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice_prev = pd.read_pickle(\n",
    "#     \"/home/tony/Data/Preference/30b_v2/interesting_clips_v4_t_3_v13_20240902_slice.pkl\"\n",
    "# )\n",
    "# df_slice_prev = df_slice_prev[\n",
    "#     (\n",
    "#         (df_slice_prev[\"task\"] != \"infill\")\n",
    "#         & (df_slice_prev[\"task\"] != \"cover\")\n",
    "#         & (df_slice_prev[\"task\"] != \"artist_consistency\")\n",
    "#     )\n",
    "# ].copy()\n",
    "# df_slice = pd.concat([df_slice, df_slice_prev])\n",
    "# print(df_slice.shape)\n",
    "# print(df_slice[\"task\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.519002Z",
     "iopub.status.busy": "2025-06-03T17:54:22.518741Z",
     "iopub.status.idle": "2025-06-03T17:54:22.529174Z",
     "shell.execute_reply": "2025-06-03T17:54:22.528840Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.518991Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice[(df_slice[\"preference\"]) & ((df_slice[\"task\"].str.strip() == \"\") | (df_slice[\"task\"].str.strip() == \"cover\"))].to_pickle(\n",
    "#     \"/home/tony/Data/Preference/30b_v5/interesting_clips_v4_t_5_20241018_full_with_cer_pos_gen.pkl\"\n",
    "# )\n",
    "# df_slice[(df_slice[\"preference\"]) & ((df_slice[\"task\"].str.strip() == \"\") | (df_slice[\"task\"].str.strip() == \"cover\"))].shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.529840Z",
     "iopub.status.busy": "2025-06-03T17:54:22.529563Z",
     "iopub.status.idle": "2025-06-03T17:54:22.539819Z",
     "shell.execute_reply": "2025-06-03T17:54:22.539479Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.529828Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice.to_pickle(\"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250108_full_slice.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.540455Z",
     "iopub.status.busy": "2025-06-03T17:54:22.540220Z",
     "iopub.status.idle": "2025-06-03T17:54:22.550593Z",
     "shell.execute_reply": "2025-06-03T17:54:22.550253Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.540443Z"
    }
   },
   "outputs": [],
   "source": [
    "# with open(\"/home/tony/Data/Preference/30b_v6/similarities_30b_t6.json\", \"r\") as fp:\n",
    "#     all_similarities = json.load(fp)\n",
    "\n",
    "# df_slice[\"similarity\"] = df_slice[\"id\"].map(all_similarities)\n",
    "# df_cover = df_slice[df_slice[\"task\"] == \"cover\"].copy()\n",
    "# df_artist = df_slice[df_slice[\"task\"] == \"artist_consistency\"].copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.551222Z",
     "iopub.status.busy": "2025-06-03T17:54:22.550992Z",
     "iopub.status.idle": "2025-06-03T17:54:22.561326Z",
     "shell.execute_reply": "2025-06-03T17:54:22.560991Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.551210Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_cover[df_cover[\"preference\"]][\"similarity\"].hist(bins=200, label=\"positive\", alpha=0.5)\n",
    "# df_cover[~df_cover[\"preference\"]][\"similarity\"].hist(bins=200, label=\"negative\", alpha=0.5)\n",
    "# plt.legend()\n",
    "# plt.show()\n",
    "# df_cover[\"similarity_diff\"] = df_cover[\"similarity\"].diff()\n",
    "# df_cover[df_cover[\"preference\"]][\"similarity_diff\"].hist(bins=200)\n",
    "# plt.show()\n",
    "# df_cover[\"continued_parent\"] = None\n",
    "# df_cover[\"continue_at\"] = -1\n",
    "# too_similar = (df_cover[\"similarity\"] >= 0.99)\n",
    "# too_different = ( df_cover[\"similarity\"] < 0.25)\n",
    "# too_big_difference = (df_cover[\"similarity_diff\"] < -0.2)\n",
    "# df_cover_drops_id = df_cover[\n",
    "#     (df_cover[\"preference\"])\n",
    "#     & (too_similar | too_different | too_big_difference)\n",
    "# ][\"s3_id\"].unique()\n",
    "# print(\"total rows\", df_cover.shape[0], \"total drops\", len(df_cover_drops_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.561990Z",
     "iopub.status.busy": "2025-06-03T17:54:22.561724Z",
     "iopub.status.idle": "2025-06-03T17:54:22.572069Z",
     "shell.execute_reply": "2025-06-03T17:54:22.571736Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.561979Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_artist[df_artist[\"preference\"]][\"similarity\"].hist(bins=200, label=\"positive\", alpha=0.5)\n",
    "# df_artist[~df_artist[\"preference\"]][\"similarity\"].hist(bins=200, label=\"negative\", alpha=0.5)\n",
    "# plt.legend()\n",
    "# plt.show()\n",
    "# df_artist[\"similarity_diff\"] = df_artist[\"similarity\"].diff()\n",
    "# df_artist[df_artist[\"preference\"]][\"similarity_diff\"].hist(bins=200)\n",
    "# plt.show()\n",
    "# too_similar = (df_artist[\"similarity\"] >= 0.95)\n",
    "# too_different = ( df_artist[\"similarity\"] < 0.4)\n",
    "# too_big_difference = (df_artist[\"similarity_diff\"] < -0.2)\n",
    "# df_artist_drops_id = df_artist[\n",
    "#     (df_artist[\"preference\"])\n",
    "#     & (too_similar | too_different | too_big_difference)\n",
    "# ][\"s3_id\"].unique()\n",
    "# print(\"total rows\", df_artist.shape[0], \"total drops\", len(df_artist_drops_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.572652Z",
     "iopub.status.busy": "2025-06-03T17:54:22.572543Z",
     "iopub.status.idle": "2025-06-03T17:54:22.583384Z",
     "shell.execute_reply": "2025-06-03T17:54:22.583040Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.572640Z"
    }
   },
   "outputs": [],
   "source": [
    "# print(\"before filter on cover similarity\", df_slice.shape)\n",
    "# df_slice = df_slice[~df_slice[\"s3_id\"].isin(df_cover_drops_id)].copy()\n",
    "# print(\"after filter on cover similarity\", df_slice.shape)\n",
    "# df_slice = df_slice[~df_slice[\"s3_id\"].isin(df_artist_drops_id)].copy()\n",
    "# print(\"after filter on artist similarity\", df_slice.shape)\n",
    "# df_slice = df_slice[\n",
    "#     df_slice[\"request_id\"].isin(\n",
    "#         df_slice[\"request_id\"].value_counts().index[df_slice[\"request_id\"].value_counts() == 2]\n",
    "#     )\n",
    "# ]\n",
    "# print(\"after filter on request id pairs\", df_slice.shape)\n",
    "# print(df_slice.groupby([\"preference\"])[\"model_name\"].value_counts())\n",
    "# assert df_slice.shape[0] == df_slice[\"request_id\"].nunique() * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.583917Z",
     "iopub.status.busy": "2025-06-03T17:54:22.583768Z",
     "iopub.status.idle": "2025-06-03T17:54:22.595801Z",
     "shell.execute_reply": "2025-06-03T17:54:22.595438Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.583905Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "is_public\n",
      "False    102411\n",
      "True       4693\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(df_slice[\"is_public\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T14:00:20.866354Z",
     "start_time": "2024-05-16T14:00:12.443344Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:22.596466Z",
     "iopub.status.busy": "2025-06-03T17:54:22.596206Z",
     "iopub.status.idle": "2025-06-03T17:54:22.853727Z",
     "shell.execute_reply": "2025-06-03T17:54:22.853189Z",
     "shell.execute_reply.started": "2025-06-03T17:54:22.596454Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(107104, 149)\n",
      "task\n",
      "artist_consistency    47026\n",
      "cover                 34492\n",
      "infill                25456\n",
      "infill_intro            130\n",
      "Name: count, dtype: int64\n"
     ]
    },
    {
     "ename": "NameError",
     "evalue": "name 'BREAK' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[38], line 8\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_slice[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtask\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mvalue_counts())\n\u001b[1;32m      5\u001b[0m \u001b[38;5;66;03m# df_slice = df_slice[df_slice[\"task\"].isin([\"extend\", \"\"])].copy()\u001b[39;00m\n\u001b[1;32m      6\u001b[0m \u001b[38;5;66;03m# print(df_slice.shape)\u001b[39;00m\n\u001b[1;32m      7\u001b[0m \u001b[38;5;66;03m# print(df_slice[\"task\"].value_counts())\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m \u001b[43mBREAK\u001b[49m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'BREAK' is not defined"
     ]
    }
   ],
   "source": [
    "# df_slice[\"npz_path\"] = df_slice[\"s3_id\"].map(lambda x: f\"{NPZ_DIR}/{x}.npz\")\n",
    "# df_slice.to_pickle(\"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250222_full_v34.pkl\")\n",
    "print(df_slice.shape)\n",
    "print(df_slice[\"task\"].value_counts())\n",
    "# df_slice = df_slice[df_slice[\"task\"].isin([\"extend\", \"\"])].copy()\n",
    "# print(df_slice.shape)\n",
    "# print(df_slice[\"task\"].value_counts())\n",
    "BREAK"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Need to kick out the ones has gpt prompt -- these are pairs with different text inputs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.932296Z",
     "start_time": "2024-05-16T13:59:41.932287Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.212360Z",
     "iopub.status.busy": "2025-06-03T17:54:34.212080Z",
     "iopub.status.idle": "2025-06-03T17:54:34.235582Z",
     "shell.execute_reply": "2025-06-03T17:54:34.235158Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.212346Z"
    }
   },
   "outputs": [],
   "source": [
    "# don't have continue at\n",
    "df_slice[\"request_id\"] = df_slice[\"request_id\"].astype(str)\n",
    "# df_slice[df_slice[\"continue_at\"].isna()][\"request_id\"].nunique(), df_slice[\"request_id\"].nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.236456Z",
     "iopub.status.busy": "2025-06-03T17:54:34.236199Z",
     "iopub.status.idle": "2025-06-03T17:54:34.455568Z",
     "shell.execute_reply": "2025-06-03T17:54:34.455060Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.236444Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(107104, 149)\n",
      "(107104, 149)\n",
      "(107104, 149)\n"
     ]
    }
   ],
   "source": [
    "print(df_slice.shape)\n",
    "df_slice = df_slice[df_slice[\"request_id\"].apply(lambda x: len(x) > 3)]\n",
    "print(df_slice.shape)\n",
    "# df_slice = df_slice[df_slice[\"is_pro_user\"]].copy()\n",
    "print(df_slice.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.932966Z",
     "start_time": "2024-05-16T13:59:41.932957Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.456277Z",
     "iopub.status.busy": "2025-06-03T17:54:34.456065Z",
     "iopub.status.idle": "2025-06-03T17:54:34.488186Z",
     "shell.execute_reply": "2025-06-03T17:54:34.487736Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.456263Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "53552\n"
     ]
    }
   ],
   "source": [
    "final_filtered_requests = df_slice[\"request_id\"].astype(str).unique()\n",
    "# final_filtered_requests = df_slice[df_slice[\"is_pro_user\"]][\"request_id\"].astype(str).unique()\n",
    "print(len(final_filtered_requests))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.933558Z",
     "start_time": "2024-05-16T13:59:41.933550Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.489215Z",
     "iopub.status.busy": "2025-06-03T17:54:34.489041Z",
     "iopub.status.idle": "2025-06-03T17:54:34.502602Z",
     "shell.execute_reply": "2025-06-03T17:54:34.502243Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.489202Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice.to_csv(\"/home/tony/Data/Preference/30b_v2/interesting_clips_v4_t_3_20240902_slice.csv\", index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.503255Z",
     "iopub.status.busy": "2025-06-03T17:54:34.503003Z",
     "iopub.status.idle": "2025-06-03T17:54:34.513420Z",
     "shell.execute_reply": "2025-06-03T17:54:34.513077Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.503243Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice[\"continue_at\"] = -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.934277Z",
     "start_time": "2024-05-16T13:59:41.934268Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.514138Z",
     "iopub.status.busy": "2025-06-03T17:54:34.513831Z",
     "iopub.status.idle": "2025-06-03T17:54:34.804246Z",
     "shell.execute_reply": "2025-06-03T17:54:34.803742Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.514126Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "53016 536\n",
      "(106032, 149) (1072, 149)\n"
     ]
    }
   ],
   "source": [
    "train_requests, val_requests = train_test_split(\n",
    "    sorted(list(final_filtered_requests)), test_size=0.01, random_state=42\n",
    ")\n",
    "print(len(train_requests), len(val_requests))\n",
    "\n",
    "train_df = df_slice[df_slice[\"request_id\"].astype(str).isin(set(train_requests))].copy()\n",
    "val_df = df_slice[df_slice[\"request_id\"].astype(str).isin(set(val_requests))].copy()\n",
    "train_df = train_df.sort_values(by=[\"request_id\", \"preference\"])\n",
    "train_df = train_df  # .reset_index()\n",
    "val_df = val_df.sort_values(by=[\"request_id\", \"preference\"])\n",
    "val_df = val_df  # .reset_index()\n",
    "\n",
    "print(train_df.shape, val_df.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Actually make"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.934954Z",
     "start_time": "2024-05-16T13:59:41.934946Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.804964Z",
     "iopub.status.busy": "2025-06-03T17:54:34.804755Z",
     "iopub.status.idle": "2025-06-03T17:54:34.818973Z",
     "shell.execute_reply": "2025-06-03T17:54:34.818591Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.804950Z"
    }
   },
   "outputs": [],
   "source": [
    "# val_df[[\"request_id\", \"metadata\", \"updated_at\", \"user_id\", \"preference\"]].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.935620Z",
     "start_time": "2024-05-16T13:59:41.935613Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:34.819744Z",
     "iopub.status.busy": "2025-06-03T17:54:34.819423Z",
     "iopub.status.idle": "2025-06-03T17:54:38.465225Z",
     "shell.execute_reply": "2025-06-03T17:54:38.464730Z",
     "shell.execute_reply.started": "2025-06-03T17:54:34.819731Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 106032/106032 [00:03<00:00, 29206.33it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4,168 hours of 106032 clips, 6.627 nodes, 1104.5 iters\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "total_duration = 0\n",
    "for i, row in tqdm(train_df.iterrows(), total=len(train_df)):\n",
    "    # we need to alternate between preference: neg, pos\n",
    "    # print(i, row)\n",
    "    try:\n",
    "        assert row[\"preference\"] == (i % 2 == 1)\n",
    "        total_duration += row[\"duration\"]\n",
    "    except Exception as E:\n",
    "        print(i, row)\n",
    "        print(E)\n",
    "        raise ValueError()\n",
    "\n",
    "print(\n",
    "    f\"{round(total_duration / 60 / 60):,} hours of {train_df.shape[0]} clips, {train_df.shape[0] / 8 / 2 / 1000} nodes, {train_df.shape[0] / 8 / 2 / 6} iters\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.936268Z",
     "start_time": "2024-05-16T13:59:41.936260Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:38.466047Z",
     "iopub.status.busy": "2025-06-03T17:54:38.465710Z",
     "iopub.status.idle": "2025-06-03T17:54:57.146249Z",
     "shell.execute_reply": "2025-06-03T17:54:57.145770Z",
     "shell.execute_reply.started": "2025-06-03T17:54:38.466033Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t_data_memmap is set to: 6016\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1072/1072 [00:18<00:00, 58.06it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 1072 clips, 0 different prompts\n",
      "31 hours of False\n",
      "31 hours of True\n",
      "cover: 22.4 hours\n",
      "infill: 7.0 hours\n",
      "artist_consistency: 33.1 hours\n",
      "Done\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "make_dataset(\n",
    "    val_df, OUT_DATA_DIR, is_val=True, npz_dir=NPZ_DIR, t_data_memmap=N_TOKENS_AUDIO\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:57.147791Z",
     "iopub.status.busy": "2025-06-03T17:54:57.147571Z",
     "iopub.status.idle": "2025-06-03T17:54:57.161472Z",
     "shell.execute_reply": "2025-06-03T17:54:57.161112Z",
     "shell.execute_reply.started": "2025-06-03T17:54:57.147777Z"
    }
   },
   "outputs": [],
   "source": [
    "# test_npz = np.load(\"/app/suno/data/dpo/30b_npz/26d19085-18da-4701-af43-122684543891.npz\")\n",
    "# for k in test_npz.keys():\n",
    "#     print(k)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.936964Z",
     "start_time": "2024-05-16T13:59:41.936957Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T17:54:57.162121Z",
     "iopub.status.busy": "2025-06-03T17:54:57.161880Z",
     "iopub.status.idle": "2025-06-03T18:23:10.526179Z",
     "shell.execute_reply": "2025-06-03T18:23:10.525816Z",
     "shell.execute_reply.started": "2025-06-03T17:54:57.162109Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t_data_memmap is set to: 6016\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 10%|██████████▊                                                                                               | 10863/106032 [03:51<24:41, 64.25it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "94184, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4b8b4277-1b8d-44e5-8c07-5ed05f31786a.npz.\n",
      "WTF --> 94185, skip, preference: True, 8d2026fd-75d5-44ec-ba5a-49c4889b9664, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 13%|█████████████▋                                                                                            | 13720/106032 [04:37<22:58, 66.95it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "118580, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/f94c1f7e-4c61-4f19-9f86-4b28ac3d4e85.npz.\n",
      "WTF --> 118581, skip, preference: True, 82bff42a-b4ae-4b2b-b634-9d87f6d783ca, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 14%|██████████████▌                                                                                           | 14511/106032 [04:50<23:33, 64.74it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "125286, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/7a6eba06-f97f-46cb-8e14-80fc7391df4c.npz.\n",
      "WTF --> 125287, skip, preference: True, f9417c54-e71b-4600-8e78-ddc844a60245, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 15%|███████████████▋                                                                                          | 15682/106032 [05:09<22:41, 66.35it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "135624, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/2c74927d-a411-4cf8-963a-ae1d446adcd5.npz.\n",
      "WTF --> 135625, skip, preference: True, bc8ee5e7-8a6f-4082-87d7-441a20d6920a, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 17%|██████████████████▎                                                                                       | 18295/106032 [05:50<21:23, 68.37it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "158584, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/0f167b33-4aa5-40d6-a29f-54605c594a6b.npz.\n",
      "WTF --> 158585, skip, preference: True, f9813bca-8804-4bcd-a1f6-88460f5a2366, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 19%|████████████████████▎                                                                                     | 20313/106032 [06:22<21:24, 66.75it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "175714, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/37322b37-63f7-4a04-af49-9462004936b5.npz.\n",
      "WTF --> 175715, skip, preference: True, bb42a441-8453-4cd0-9663-12d73a0b36a4, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 21%|█████████████████████▊                                                                                    | 21771/106032 [06:46<20:50, 67.39it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "187972, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/0d3a1912-f38a-4c43-8424-ba7d5b9e64f6.npz.\n",
      "WTF --> 187973, skip, preference: True, 56d334d0-0c43-46b0-b09b-eddab6f954e1, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 22%|██████████████████████▉                                                                                   | 22918/106032 [07:04<21:16, 65.11it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "198224, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/72b745b1-adb0-4dee-8127-354ef500348f.npz.\n",
      "WTF --> 198225, skip, preference: True, eca9ad37-2945-49b3-b672-8a9073f8aef8, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 24%|█████████████████████████▎                                                                                | 25258/106032 [07:42<20:04, 67.07it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "218304, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/b616162d-5ba3-4bd3-ad23-1821b0638dfb.npz.\n",
      "WTF --> 218305, skip, preference: True, e0e2e373-1c18-4fed-bd53-bff9e83bbfd9, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 24%|█████████████████████████▉                                                                                | 25972/106032 [07:53<20:04, 66.47it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "225084, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/2ef7d11c-be1e-450b-9780-e1a0eb710de7.npz.\n",
      "WTF --> 225085, skip, preference: True, 9620af75-378c-49ab-ac29-58d5d198083f, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 27%|████████████████████████████▌                                                                             | 28578/106032 [08:34<19:12, 67.19it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "247980, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/52da13f6-990a-4fbe-915f-4386b3a1d040.npz.\n",
      "WTF --> 247981, skip, preference: True, d3b3cd5d-c67d-4a92-bceb-ca25e5057c9b, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 27%|████████████████████████████▋                                                                             | 28692/106032 [08:36<19:18, 66.75it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "249104, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a855b474-ff2e-496e-a794-ef240760eae4.npz.\n",
      "WTF --> 249105, skip, preference: True, b6dc68fa-f048-4432-860c-1b88d0645306, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 30%|███████████████████████████████▋                                                                          | 31676/106032 [09:23<18:37, 66.54it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "275390, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/3218f11c-e7a7-4832-b2e6-253a8990b11e.npz.\n",
      "WTF --> 275391, skip, preference: True, d9e9f67e-d61b-4078-a006-f47c18bac6d1, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 30%|████████████████████████████████▏                                                                         | 32202/106032 [09:32<18:48, 65.44it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "279784, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/e99c467d-2dec-44e8-838d-220e78b29948.npz.\n",
      "WTF --> 279785, skip, preference: True, d74a1602-07ba-4e87-b362-c752c541ee5e, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 31%|████████████████████████████████▋                                                                         | 32652/106032 [09:39<18:14, 67.02it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "283446, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a3208df0-6b0d-49ae-9d39-a1dcd877b15d.npz.\n",
      "WTF --> 283447, skip, preference: True, 5165beda-3382-4acd-8ac8-359dcad895f1, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 31%|████████████████████████████████▉                                                                         | 32996/106032 [09:44<18:45, 64.89it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "286522, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/594b2d02-db1a-4174-a3cc-6a2415d1e14f.npz.\n",
      "WTF --> 286523, skip, preference: True, 9f1b1440-11c6-46aa-86f3-0a7a8cdffc14, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 32%|█████████████████████████████████▍                                                                        | 33466/106032 [09:52<18:19, 65.99it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "290520, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/73879327-c5b6-4ce1-ad60-6050a2c809c1.npz.\n",
      "WTF --> 290521, skip, preference: True, d41ba42d-e133-4b3e-8689-e6ad5eef51dd, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 32%|█████████████████████████████████▉                                                                        | 33895/106032 [09:59<18:10, 66.17it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "294252, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/3ea10a88-42ae-493d-8e5a-994e3e1a45e7.npz.\n",
      "WTF --> 294253, skip, preference: True, 39da92bd-355c-429d-9aa7-83d462f5d125, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 35%|████████████████████████████████████▉                                                                     | 36950/106032 [10:46<16:37, 69.22it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "319088, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/02530857-9e54-4eae-8427-24d11228d929.npz.\n",
      "WTF --> 319089, skip, preference: True, 3d52b897-edfe-4e46-965d-616676e26b78, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 40%|██████████████████████████████████████████▏                                                               | 42221/106032 [12:06<14:50, 71.69it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "365068, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/a3a314b8-4c81-4297-be73-c3b2b299b573.npz.\n",
      "WTF --> 365069, skip, preference: True, b8ac793a-62c5-4db2-8e48-ffb0a7d06e71, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 41%|███████████████████████████████████████████▋                                                              | 43696/106032 [12:28<15:44, 66.02it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "377738, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4b528cdc-35f9-4771-b9a0-0fd01df03444.npz.\n",
      "WTF --> 377739, skip, preference: True, 774d13a4-5254-43d5-82ae-366bc5c30a81, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 42%|████████████████████████████████████████████                                                              | 44127/106032 [12:35<14:39, 70.39it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "381590, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4809e637-e5e2-432e-91c0-1f9102e4b97f.npz.\n",
      "WTF --> 381591, skip, preference: True, e6019ae0-68d6-41f7-b8ba-e98c65d30e04, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 51%|██████████████████████████████████████████████████████                                                    | 54022/106032 [15:02<11:55, 72.66it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "465800, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/722d8c11-a12f-41fa-b007-bb0e5b3dc3a4.npz.\n",
      "WTF --> 465801, skip, preference: True, 9408e449-42e7-408f-9f06-3feba0b8dd54, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 51%|██████████████████████████████████████████████████████▏                                                   | 54143/106032 [15:03<11:48, 73.21it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "467020, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/bf756fd9-5bf1-4e54-b4e9-00673f772d51.npz.\n",
      "WTF --> 467021, skip, preference: True, 5bfb5599-f1cc-4639-9a19-0ebfe773331f, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 51%|██████████████████████████████████████████████████████▎                                                   | 54291/106032 [15:05<11:47, 73.13it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "468326, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/15490ee6-f701-4d02-9904-8cf2f703349d.npz.\n",
      "WTF --> 468327, skip, preference: True, 6bc6f973-6945-4dc6-8995-9ab5771069c7, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 52%|███████████████████████████████████████████████████████                                                   | 55077/106032 [15:17<12:07, 70.04it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "475156, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/19337065-f07e-4c6b-b729-9378dc820ec9.npz.\n",
      "WTF --> 475157, skip, preference: True, ae7b5acd-07ed-4bce-a55d-8d40e90334af, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 54%|█████████████████████████████████████████████████████████▌                                                | 57531/106032 [15:54<11:15, 71.78it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "496438, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/aecaca0d-24ee-40f4-be04-ac9bfcfec3bf.npz.\n",
      "WTF --> 496439, skip, preference: True, acbca1bb-484b-4bb0-937a-8a0902095730, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 58%|█████████████████████████████████████████████████████████████▊                                            | 61853/106032 [16:58<10:26, 70.51it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "533526, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/57f69434-ca7b-4815-b1ef-43b2c9fc13a6.npz.\n",
      "WTF --> 533527, skip, preference: True, 26bdbd4c-b761-4474-9ef5-603ce90f3520, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 61%|████████████████████████████████████████████████████████████████▎                                         | 64366/106032 [17:35<09:55, 69.91it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "555260, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/9f2085d0-6a2a-4003-b5a2-951a5166b1fb.npz.\n",
      "WTF --> 555261, skip, preference: True, 8257dc3d-7d7c-4979-a3c1-87df4fe12d51, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 62%|█████████████████████████████████████████████████████████████████▌                                        | 65627/106032 [17:54<09:31, 70.74it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "566062, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/cabb58bd-fd59-4407-87d9-f6ec9f9abdc5.npz.\n",
      "WTF --> 566063, skip, preference: True, 773b6002-fb82-402e-b34d-61205c5f138d, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 62%|██████████████████████████████████████████████████████████████████                                        | 66039/106032 [18:00<09:37, 69.24it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "569710, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a8b14db3-0cd2-43eb-ab49-f0299538b0cb.npz.\n",
      "WTF --> 569711, skip, preference: True, 9c36744b-bd71-4dbb-992d-60853a889544, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 63%|███████████████████████████████████████████████████████████████████                                       | 67061/106032 [18:16<08:58, 72.32it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "578810, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/fb6a54a1-1a1f-4ab6-a2a1-5975a0ef1a66.npz.\n",
      "WTF --> 578811, skip, preference: True, 8567a22d-33ad-4240-9b12-6b89be6ce804, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 65%|█████████████████████████████████████████████████████████████████████▏                                    | 69235/106032 [18:48<08:32, 71.85it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "598170, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a5254c3a-9a52-4667-920c-b2da59899873.npz.\n",
      "WTF --> 598171, skip, preference: True, 9391fef0-296e-4bbf-b355-46d1b6bbea53, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 67%|██████████████████████████████████████████████████████████████████████▋                                   | 70750/106032 [19:10<08:05, 72.66it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "611364, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/b3583555-fa44-46a2-83a5-7b245d8fe73e.npz.\n",
      "WTF --> 611365, skip, preference: True, f6308203-26b2-4aed-b442-f683cbf2fe35, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 68%|███████████████████████████████████████████████████████████████████████▉                                  | 71957/106032 [19:28<08:08, 69.69it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "621642, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/b3b3191d-8dd5-4c8c-99b5-58960e3eedc5.npz.\n",
      "WTF --> 621643, skip, preference: True, ba492700-8c4a-4a45-97a7-515cba30bf24, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 68%|████████████████████████████████████████████████████████████████████████▍                                 | 72411/106032 [19:35<07:49, 71.60it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "625782, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/a22cc4a1-d9dd-4d95-a9b7-fdaee255f370.npz.\n",
      "WTF --> 625783, skip, preference: True, 12085923-62a4-4a00-85e1-2688f7a68bc1, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 71%|██████████████████████████████████████████████████████████████████████████▉                               | 74981/106032 [20:14<07:53, 65.62it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "648204, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/198805ec-ebcb-48e4-83cf-65a1aee296f0.npz.\n",
      "WTF --> 648205, skip, preference: True, 9bbb9f94-e7dd-4a74-8c8c-91e30a50b378, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 71%|███████████████████████████████████████████████████████████████████████████▌                              | 75620/106032 [20:23<07:09, 70.75it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "653992, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/b83d0a66-016a-4393-9450-e1aa56438482.npz.\n",
      "WTF --> 653993, skip, preference: True, 834fc805-5871-460c-bda6-3e5af927f12f, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 73%|█████████████████████████████████████████████████████████████████████████████▍                            | 77501/106032 [20:52<06:56, 68.58it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "669964, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/31467219-e20a-433c-bd2b-2a2e5e9d4a1c.npz.\n",
      "WTF --> 669965, skip, preference: True, 79736067-df96-4e99-8d8f-bc1aec4ea1c6, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 74%|██████████████████████████████████████████████████████████████████████████████▉                           | 78975/106032 [21:14<06:39, 67.72it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "683038, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/fe9a7930-f83e-43e5-8bc5-3cb4df703129.npz.\n",
      "WTF --> 683039, skip, preference: True, d45c62b6-5c8e-4b6c-912a-b43865036331, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 75%|███████████████████████████████████████████████████████████████████████████████▊                          | 79857/106032 [21:27<06:08, 71.00it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "690696, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/5c363f7b-1a9a-4640-ab75-1f9d2b35f732.npz.\n",
      "WTF --> 690697, skip, preference: True, 5a870c4d-3c28-46ec-9282-ba13f98ced1b, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 79%|███████████████████████████████████████████████████████████████████████████████████▎                      | 83375/106032 [22:20<05:26, 69.36it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "721452, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/a46f406a-3555-4844-834f-056802df083f.npz.\n",
      "WTF --> 721453, skip, preference: True, 08f3fec0-bc20-4955-b048-681f18fdba89, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 83%|███████████████████████████████████████████████████████████████████████████████████████▉                  | 88002/106032 [23:29<04:17, 69.98it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "760320, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/295dab62-90a6-4cff-bc14-1ca526dadac0.npz.\n",
      "WTF --> 760321, skip, preference: True, f7113fe5-afd6-4e50-a429-2bb41ea2a076, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 84%|████████████████████████████████████████████████████████████████████████████████████████▊                 | 88797/106032 [23:41<04:01, 71.51it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "767232, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/4cb4a6de-e7b2-4349-9ad8-465603d23540.npz.\n",
      "WTF --> 767233, skip, preference: True, ec028870-4395-4429-ba17-1063b0de5c7e, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 85%|█████████████████████████████████████████████████████████████████████████████████████████▊                | 89839/106032 [23:56<03:44, 72.21it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "776776, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/0364a0ac-670d-427f-ab5a-afb1357a06d0.npz.\n",
      "WTF --> 776777, skip, preference: True, 3e3a5536-4088-4041-ac86-ddd2244365e8, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 85%|██████████████████████████████████████████████████████████████████████████████████████████▌               | 90582/106032 [24:07<03:38, 70.58it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "783668, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/7bacbcb7-8260-4496-b8cc-c4d4db6cc0ab.npz.\n",
      "WTF --> 783669, skip, preference: True, c59cf741-2abd-4ccd-bad0-4e41d4b1b109, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 86%|███████████████████████████████████████████████████████████████████████████████████████████               | 91143/106032 [24:16<03:30, 70.86it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "788698, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/6bbec2f1-a856-42a8-add8-8dcf7d2bb4b0.npz.\n",
      "WTF --> 788699, skip, preference: True, a87dcde8-09ff-478d-a0f4-2f2865f7a8cf, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 86%|███████████████████████████████████████████████████████████████████████████████████████████▋              | 91664/106032 [24:23<03:18, 72.30it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "793480, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/e200fe5b-afbe-41e5-8a65-505b67147dff.npz.\n",
      "WTF --> 793481, skip, preference: True, 61dc5774-9bb7-4cde-8ebc-fd14069efdc3, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 88%|█████████████████████████████████████████████████████████████████████████████████████████████▍            | 93520/106032 [24:51<02:58, 70.15it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "810216, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/9de9078b-59fc-44e4-b560-bbe49d8940e9.npz.\n",
      "WTF --> 810217, skip, preference: True, 51cdbfc3-34b0-47c0-983a-0186798d6600, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 89%|█████████████████████████████████████████████████████████████████████████████████████████████▊            | 93840/106032 [24:56<02:50, 71.40it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "813232, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/fabd0673-c394-42c1-8518-61b3ae66145a.npz.\n",
      "WTF --> 813233, skip, preference: True, 1b09d9dc-fe0a-494b-9c3b-f8c5049d8aa5, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 91%|████████████████████████████████████████████████████████████████████████████████████████████████          | 96154/106032 [25:30<02:18, 71.39it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "834040, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/cff3be35-ce68-44d9-a050-f273562f0e0a.npz.\n",
      "WTF --> 834041, skip, preference: True, cbec2cc8-3210-4f9b-a14d-e8aec6454626, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 91%|████████████████████████████████████████████████████████████████████████████████████████████████▏         | 96187/106032 [25:31<02:18, 70.98it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "834234, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/308b4091-32b7-4bee-846f-0e4dab37f7a5.npz.\n",
      "WTF --> 834235, skip, preference: True, bc432aa2-cc98-4168-bd65-ee77f2f072c1, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 92%|█████████████████████████████████████████████████████████████████████████████████████████████████▋        | 97768/106032 [25:54<01:54, 72.33it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "848562, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a434fa5e-28c7-4ea5-820b-21b7e5d752d2.npz.\n",
      "WTF --> 848563, skip, preference: True, dd0a7265-cb21-4bf3-a0f4-977e7ab7dc5a, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 94%|███████████████████████████████████████████████████████████████████████████████████████████████████▌      | 99617/106032 [26:22<01:29, 71.85it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "864430, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/6d8920ec-8682-492e-8126-640b5d6bede1.npz.\n",
      "WTF --> 864431, skip, preference: True, 92606537-ccbd-42d6-bd4b-bf0c49dfe523, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 96%|████████████████████████████████████████████████████████████████████████████████████████████████████▍    | 101428/106032 [26:49<01:04, 71.20it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "880440, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/2a3d13b1-d0e4-470c-81e3-24b6e2ccc05b.npz.\n",
      "WTF --> 880441, skip, preference: True, 5d20422b-2f77-48cc-9ed6-86dc1edb58d8, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 97%|█████████████████████████████████████████████████████████████████████████████████████████████████████▎   | 102356/106032 [27:02<00:52, 70.11it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "888386, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/8976c887-b36e-463e-abc6-6f886366b10c.npz.\n",
      "WTF --> 888387, skip, preference: True, fe7ef4a6-873c-4646-b516-4a96e1e38d87, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 98%|███████████████████████████████████████████████████████████████████████████████████████████████████████▏ | 104241/106032 [27:31<00:25, 70.94it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "904964, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/bdbcb196-ac09-4578-9480-022af7f66c97.npz.\n",
      "WTF --> 904965, skip, preference: True, 629f376f-7621-4a7f-bbc6-a2c72d564e56, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 99%|███████████████████████████████████████████████████████████████████████████████████████████████████████▋ | 104729/106032 [27:38<00:18, 69.06it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "909348, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/e6df418c-da4e-4e13-959d-c18949c5dcd4.npz.\n",
      "WTF --> 909349, skip, preference: True, ab046f04-12f8-4374-99c7-7c5ab8c1d918, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 99%|████████████████████████████████████████████████████████████████████████████████████████████████████████▎| 105285/106032 [27:46<00:10, 70.18it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "914596, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/fb17c3fc-f335-44e7-b728-2681380770db.npz.\n",
      "WTF --> 914597, skip, preference: True, a0db573f-66d2-43d4-bf72-e28f50ed0652, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 106032/106032 [27:58<00:00, 63.18it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 105914 clips, 9 different prompts\n",
      "3,060 hours of False\n",
      "3,037 hours of True\n",
      "infill: 811.0 hours\n",
      "cover: 2202.9 hours\n",
      "artist_consistency: 3083.2 hours\n",
      "🚨 Error infill: 37\n",
      "🚨 Error infill_intro: 22\n",
      "Done\n"
     ]
    }
   ],
   "source": [
    "make_dataset(\n",
    "    train_df, OUT_DATA_DIR, is_val=False, npz_dir=NPZ_DIR, t_data_memmap=N_TOKENS_AUDIO\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-01-29T19:46:47.549860Z",
     "start_time": "2024-01-29T19:46:47.548015Z"
    }
   },
   "source": [
    "# Validation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.937879Z",
     "start_time": "2024-05-16T13:59:41.937870Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:10.526721Z",
     "iopub.status.busy": "2025-06-03T18:23:10.526569Z",
     "iopub.status.idle": "2025-06-03T18:23:11.358620Z",
     "shell.execute_reply": "2025-06-03T18:23:11.358232Z",
     "shell.execute_reply.started": "2025-06-03T18:23:10.526708Z"
    }
   },
   "outputs": [],
   "source": [
    "# verify\n",
    "mm = np.memmap(os.path.join(OUT_DATA_DIR, f\"data_val.bin\"), dtype=np.uint16, mode=\"r\")\n",
    "test_metas = read_jsonl(os.path.join(OUT_DATA_DIR, f\"meta_val.jsonl\"))\n",
    "test_info = read_json(os.path.join(OUT_DATA_DIR, f\"info_val.json\"))\n",
    "mm = mm.reshape(-1, N_TOKENS_AUDIO, 13)\n",
    "assert len(mm) == len(test_metas)\n",
    "assert mm[:100, :, 0].min() >= 0\n",
    "assert mm[:100, :, 0].max() <= 4000\n",
    "assert mm[:100, :, 1:].min() >= 0\n",
    "assert mm[:100, :, 1:].max() <= 2048"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.359149Z",
     "iopub.status.busy": "2025-06-03T18:23:11.359000Z",
     "iopub.status.idle": "2025-06-03T18:23:11.373406Z",
     "shell.execute_reply": "2025-06-03T18:23:11.373131Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.359136Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Counter({'artist_consistency': 500, 'cover': 348, 'infill': 224})\n"
     ]
    }
   ],
   "source": [
    "task_counts = Counter()\n",
    "for test_meta in test_metas:\n",
    "    task_counts[test_meta.get(\"task\")] += 1\n",
    "print(task_counts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.938629Z",
     "start_time": "2024-05-16T13:59:41.938621Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.373894Z",
     "iopub.status.busy": "2025-06-03T18:23:11.373708Z",
     "iopub.status.idle": "2025-06-03T18:23:11.384224Z",
     "shell.execute_reply": "2025-06-03T18:23:11.383961Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.373883Z"
    }
   },
   "outputs": [],
   "source": [
    "# # randomly listen to some stuff\n",
    "# from suno_utils.tasks.dac_2c_12cb import preload_models as preload_codec_models\n",
    "# from suno_utils.tasks.dac_2c_12cb import (\n",
    "#     encode as codec_encode,\n",
    "#     decode_stream_to_full_audio as codec_decode,\n",
    "#     EMBEDDING_RATE as CODEC_EMBEDDING_RATE,\n",
    "#     decode as decode\n",
    "# )\n",
    "# os.environ[\"CUDA_VISIBLE_DEVICES\"] = \"0\"\n",
    "# _ = preload_codec_models(\"/app/suno/data/dpo/models/dac_2c_25x12.pt\", device=\"cuda\")\n",
    "# assert len(test_metas) == len(mm)\n",
    "# idx_list = list(range(len(test_metas)))\n",
    "# # random.shuffle(idx_list)\n",
    "# # idx_list = [idx for idx in idx_list if \"text\" in test_metas[idx]]\n",
    "# print(len(mm))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.939205Z",
     "start_time": "2024-05-16T13:59:41.939198Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.384719Z",
     "iopub.status.busy": "2025-06-03T18:23:11.384533Z",
     "iopub.status.idle": "2025-06-03T18:23:11.394877Z",
     "shell.execute_reply": "2025-06-03T18:23:11.394619Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.384708Z"
    }
   },
   "outputs": [],
   "source": [
    "# import random\n",
    "# idx = random.choice(test_info[\"perference_0\"][\"idx_list\"])\n",
    "# assert \"original_duration_s\" in test_metas[idx]\n",
    "# # positive index should be shifted by 1\n",
    "# pos_idx = idx + 1\n",
    "# print(\n",
    "#     \"tags:\",\n",
    "#     test_metas[idx].get(\"tags\") == test_metas[pos_idx].get(\"tags\"),\n",
    "#     test_metas[idx].get(\"tags\"),\n",
    "# )\n",
    "# arr = mm[idx, 1:].copy().astype(np.int16)[:, 1:]\n",
    "# pos_arr = mm[pos_idx, 1:].copy().astype(np.int16)[:, 1:]\n",
    "# pad_idx_arr = np.where(arr == COARSE_PAD_TOKEN)[0]\n",
    "# if len(pad_idx_arr) > 0:\n",
    "#     arr = arr[: pad_idx_arr[0], :]\n",
    "# pos_pad_idx_arr = np.where(pos_arr == COARSE_PAD_TOKEN)[0]\n",
    "# if len(pos_pad_idx_arr) > 0:\n",
    "#     pos_arr = pos_arr[: pos_pad_idx_arr[0], :]\n",
    "# a = decode(arr)\n",
    "# print(\"\\n negative example \\n\", test_metas[idx])\n",
    "# a.play(compress=False)\n",
    "# pos_a = decode(pos_arr)\n",
    "# print(\"\\n positive example \\n\", test_metas[pos_idx])\n",
    "# pos_a.play(compress=False)\n",
    "# print(\n",
    "#     \"text:\",\n",
    "#     test_metas[idx].get(\"text\") == test_metas[pos_idx].get(\"text\"),\n",
    "#     test_metas[idx].get(\"text\"),\n",
    "# )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.939977Z",
     "start_time": "2024-05-16T13:59:41.939969Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.395336Z",
     "iopub.status.busy": "2025-06-03T18:23:11.395171Z",
     "iopub.status.idle": "2025-06-03T18:23:11.405088Z",
     "shell.execute_reply": "2025-06-03T18:23:11.404831Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.395325Z"
    }
   },
   "outputs": [],
   "source": [
    "# val_df[val_df[\"tags\"] == 'a vibrant blend of experimental jazz fusion, drum-and-bass and swagger fuzzed-out guitars']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.940610Z",
     "start_time": "2024-05-16T13:59:41.940603Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.405558Z",
     "iopub.status.busy": "2025-06-03T18:23:11.405381Z",
     "iopub.status.idle": "2025-06-03T18:23:11.415284Z",
     "shell.execute_reply": "2025-06-03T18:23:11.415029Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.405547Z"
    }
   },
   "outputs": [],
   "source": [
    "# from collections import Counter\n",
    "# c = Counter()\n",
    "# for _, row in df_slice.iterrows():\n",
    "#     # print(row[\"metadata\"])\n",
    "#     for k in ast.literal_eval(row[\"metadata\"]).keys():\n",
    "#         c[k] += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.941167Z",
     "start_time": "2024-05-16T13:59:41.941159Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.415753Z",
     "iopub.status.busy": "2025-06-03T18:23:11.415576Z",
     "iopub.status.idle": "2025-06-03T18:23:11.425411Z",
     "shell.execute_reply": "2025-06-03T18:23:11.425153Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.415742Z"
    }
   },
   "outputs": [],
   "source": [
    "# original_npz_path = f\"/app/suno/data/dpo/7b_npz/{test_metas[idx]['id']}.npz\"\n",
    "# original_npz_path = \"/app/suno/data/dpo/7b_npz/729c3011-f672-4ccd-8d82-1cbf2b52ff69.npz\"\n",
    "# original_arr = np.load(original_npz_path)[\"v2_raw\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.941801Z",
     "start_time": "2024-05-16T13:59:41.941793Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.425878Z",
     "iopub.status.busy": "2025-06-03T18:23:11.425703Z",
     "iopub.status.idle": "2025-06-03T18:23:11.437205Z",
     "shell.execute_reply": "2025-06-03T18:23:11.436941Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.425868Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "536 0\n"
     ]
    }
   ],
   "source": [
    "def validation_on_metas(input_metas):\n",
    "    total_bad = 0\n",
    "    total_good = 0\n",
    "    for idx in range(len(input_metas)):\n",
    "        if idx % 2 == 0:\n",
    "            pos_idx = idx + 1\n",
    "            if input_metas[idx].get(\"tags\") != input_metas[pos_idx].get(\"tags\"):\n",
    "                # print(test_metas[idx].get(\"text\") == test_metas[pos_idx].get(\"text\"), test_metas[idx].get(\"tags\"), test_metas[pos_idx].get(\"tags\"))\n",
    "                total_bad += 1\n",
    "            else:\n",
    "                total_good += 1\n",
    "    print(total_good, total_bad)\n",
    "    return\n",
    "\n",
    "\n",
    "validation_on_metas(test_metas)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.942520Z",
     "start_time": "2024-05-16T13:59:41.942511Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.437684Z",
     "iopub.status.busy": "2025-06-03T18:23:11.437506Z",
     "iopub.status.idle": "2025-06-03T18:23:11.452153Z",
     "shell.execute_reply": "2025-06-03T18:23:11.451878Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.437672Z"
    }
   },
   "outputs": [],
   "source": [
    "train_info = read_json(os.path.join(OUT_DATA_DIR, f\"info_tr.json\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.943072Z",
     "start_time": "2024-05-16T13:59:41.943065Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.452567Z",
     "iopub.status.busy": "2025-06-03T18:23:11.452461Z",
     "iopub.status.idle": "2025-06-03T18:23:11.462792Z",
     "shell.execute_reply": "2025-06-03T18:23:11.462535Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.452556Z"
    }
   },
   "outputs": [],
   "source": [
    "n_neg_tr = train_info[\"perference_0\"][\"idx_list\"]\n",
    "n_pos_tr = train_info[\"perference_1\"][\"idx_list\"]\n",
    "assert len(n_pos_tr) == len(n_neg_tr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.944246Z",
     "start_time": "2024-05-16T13:59:41.944237Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.463261Z",
     "iopub.status.busy": "2025-06-03T18:23:11.463084Z",
     "iopub.status.idle": "2025-06-03T18:23:11.473286Z",
     "shell.execute_reply": "2025-06-03T18:23:11.473030Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.463250Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total samples 105914 (106032, 149)\n"
     ]
    }
   ],
   "source": [
    "total_iters = len(n_neg_tr) + len(n_pos_tr)\n",
    "print(\"total samples\", total_iters, train_df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.945249Z",
     "start_time": "2024-05-16T13:59:41.945241Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.473753Z",
     "iopub.status.busy": "2025-06-03T18:23:11.473580Z",
     "iopub.status.idle": "2025-06-03T18:23:11.483807Z",
     "shell.execute_reply": "2025-06-03T18:23:11.483551Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.473743Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 epoch per batch 4, total 1654.90625\n"
     ]
    }
   ],
   "source": [
    "print(\"1 epoch per batch 4, total\", total_iters / 8 / 2 / 4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.945972Z",
     "start_time": "2024-05-16T13:59:41.945964Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.484264Z",
     "iopub.status.busy": "2025-06-03T18:23:11.484103Z",
     "iopub.status.idle": "2025-06-03T18:23:11.493971Z",
     "shell.execute_reply": "2025-06-03T18:23:11.493716Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.484253Z"
    }
   },
   "outputs": [],
   "source": [
    "# !cd /home/tony/Work/tony/slurm/30b_dpo && sbatch sbatch_ipo_30b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.494396Z",
     "iopub.status.busy": "2025-06-03T18:23:11.494252Z",
     "iopub.status.idle": "2025-06-03T18:23:11.519875Z",
     "shell.execute_reply": "2025-06-03T18:23:11.519597Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.494385Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cache kept!\n"
     ]
    }
   ],
   "source": [
    "import shutil\n",
    "\n",
    "# Basic file copy\n",
    "shutil.copy(\n",
    "    \"/home/tony/Work/tony/Preference/make_dataset_auk_30b_t6.ipynb\",\n",
    "    os.path.join(OUT_DATA_DIR, \"make_dataset.ipynb\"),\n",
    ")\n",
    "print(\"Cache kept!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# some gymathtics loading prev data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.946562Z",
     "start_time": "2024-05-16T13:59:41.946555Z"
    },
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.520398Z",
     "iopub.status.busy": "2025-06-03T18:23:11.520190Z",
     "iopub.status.idle": "2025-06-03T18:23:11.530947Z",
     "shell.execute_reply": "2025-06-03T18:23:11.530687Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.520386Z"
    }
   },
   "outputs": [],
   "source": [
    "# prev_v3_data = \"/app/suno/data/dpo/7v_v20_full/\"\n",
    "\n",
    "# test_val_metas = read_jsonl(os.path.join(prev_v3_data, f\"meta_val.jsonl\"))\n",
    "# test_tr_metas = read_jsonl(os.path.join(prev_v3_data, f\"meta_tr.jsonl\"))\n",
    "\n",
    "# all_ids = set()\n",
    "# for meta in test_val_metas:\n",
    "#     all_ids.add(meta[\"id\"])\n",
    "# for meta in test_tr_metas:\n",
    "#     all_ids.add(meta[\"id\"])\n",
    "# print(len(all_ids), len(test_val_metas) + len(test_tr_metas))\n",
    "\n",
    "# all_ids = list(all_ids)\n",
    "# with open(\"/home/tony/Data/Preference/7b_v2/7v_v20_full_recut_id.json\", \"w\") as fp:\n",
    "#     json.dump(all_ids, fp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.531406Z",
     "iopub.status.busy": "2025-06-03T18:23:11.531246Z",
     "iopub.status.idle": "2025-06-03T18:23:11.541406Z",
     "shell.execute_reply": "2025-06-03T18:23:11.541153Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.531396Z"
    }
   },
   "outputs": [],
   "source": [
    "# x_data = train_df[train_df[\"preference\"]][\"similarity\"]\n",
    "# y_data = train_df[~train_df[\"preference\"]][\"similarity\"]\n",
    "# from matplotlib.colors import LogNorm\n",
    "\n",
    "# fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 10))\n",
    "\n",
    "# # 2D Histogram\n",
    "# h = ax1.hist2d(\n",
    "#     x_data,\n",
    "#     y_data,\n",
    "#     bins=(50, 50),\n",
    "#     cmap=\"coolwarm\",\n",
    "#     range=[[0, 1], [0, 1]],\n",
    "#     norm=LogNorm(),\n",
    "# )\n",
    "\n",
    "# ax1.set_xlabel(\"Semantic Distance (Preferred)\")\n",
    "# ax1.set_ylabel(\"Semantic Distance (Non-Preferred)\")\n",
    "# ax1.set_title(\n",
    "#     \"2D Histogram of Semantic Distances: Preferred vs Non-Preferred (Log Scale)\"\n",
    "# )\n",
    "\n",
    "# cbar1 = plt.colorbar(h[3], ax=ax1)\n",
    "# cbar1.set_label(\"Number of Request IDs (Log Scale)\")\n",
    "\n",
    "# # Scatter plot\n",
    "# ax2.scatter(x_data, y_data, alpha=0.1, s=1)\n",
    "# ax2.set_xlabel(\"Semantic Distance (Preferred)\")\n",
    "# ax2.set_ylabel(\"Semantic Distance (Non-Preferred)\")\n",
    "# ax2.set_title(\"Scatter Plot of Semantic Distances: Preferred vs Non-Preferred\")\n",
    "# ax2.set_xlim(0, 1)\n",
    "# ax2.set_ylim(0, 1)\n",
    "\n",
    "# plt.tight_layout()\n",
    "# plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.542984Z",
     "iopub.status.busy": "2025-06-03T18:23:11.542801Z",
     "iopub.status.idle": "2025-06-03T18:23:11.552756Z",
     "shell.execute_reply": "2025-06-03T18:23:11.552494Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.542973Z"
    }
   },
   "outputs": [],
   "source": [
    "# train_metas = read_jsonl(os.path.join(OUT_DATA_DIR, f\"meta_tr.jsonl\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-06-03T18:23:11.553192Z",
     "iopub.status.busy": "2025-06-03T18:23:11.553046Z",
     "iopub.status.idle": "2025-06-03T18:23:11.563349Z",
     "shell.execute_reply": "2025-06-03T18:23:11.563110Z",
     "shell.execute_reply.started": "2025-06-03T18:23:11.553181Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['perference_0', 'perference_1'])"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_info.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "suno_env_dev",
   "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.15"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
