{
 "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": 4,
   "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 = \"/app2/suno/data/dpo/bluejay_mix_t1_v4\"\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/I44UAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA5WUlEQVR4nO3df3RU9YH+8WcmJBBIAiETBASRJSaggSSoJw0OTXVFdwV6NrBrOKUqLkewFGEVBb4UIQEafgguRdnCUhZBoKkrSKWKXXWLiyf8qoeUxsZAxErY1E0mgIQAIWTu9w+akYmBZMIkk8/M+3UO52Tu/czcz8MdmCf33pmxWZZlCQAAwCD2QE8AAADAVxQYAABgHAoMAAAwDgUGAAAYhwIDAACMQ4EBAADGocAAAADjUGAAAIBxKDAAAMA4FBgAAGCcmyow//7v/66kpCT99Kc/9Syr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qLi62nnnrK+t73vmfV1NR4xjT3vL5y5Yo1ZswYa9KkSdaf/vQna+/evVZ6erq1atWqQERqVksy//CHP7Tmz5/vtb+rq6s9603LbFmW9eGHH1p79+61vvjiC+vEiRPWyy+/bN11113WsWPHLMsKvv3coLncpu9rCowf/OM//qOVm5vruV1fX285nU5r/fr1AZyVf61Zs8b6/ve/3+S6c+fOWXfddZe1Z88ez7LS0lIrMTHROnLkSDvN0L8av5C73W7rvvvus37xi194lp07d85KTk62fvOb31iW9U3mo0ePesZ89NFHVlJSkvXVV1+13+RvwvUKzI9+9KPr3icYcluWZVVVVVmJiYnWoUOHLMtq2fN679691uDBg63KykrPmO3bt1vDhw+3amtr23X+rdE4s2VdfVFbsmTJde9jeuYG9957r/XGG2+ExH6+VkNuyzJ/X3MK6SZdvnxZn376qUaMGOFZZrfbNWLECB05ciSAM/O/L7/8Uk6nU3/7t3+rWbNmqby8XJJUVFSkuro6r7+DQYMGqW/fviosLAzQbP3r1KlTqqys9MoYHR2tlJQUz34+cuSIYmJiNHToUM+YESNGyG63G39K8dChQ8rIyNDDDz+shQsX6syZM551wZK7urpaktS9e3dJLXteFxYWKjEx0esDNp1Op86fP6/S0tL2m3wrNc7cYPfu3UpPT9eYMWO0atUqXbx40bPO9Mz19fV65513dOHCBaWlpYXEfpa+nbuByfu6w34SrynOnDmj+vp6xcXFeS2Pi4v71rllkw0bNkxLly7VwIEDVVlZqbVr12rixInavXu3XC6XwsPDFRMT43WfuLg4VVZWBmjG/tWQo6n93HCu3OVyqWfPnl7rO3XqpO7duxv99zBy5EiNGjVK/fr1U1lZmV5++WU99dRT+tWvfqWwsLCgyO12u5WXl6fhw4crMTFRklr0vHa5XN/6dPCG2x09e1OZJWnMmDHq27evevXqpZKSEq1cuVJffPGFXn31VUnmZi4pKdGECRNUW1urrl27au3atUpISFBxcXFQ7+fr5ZbM39cUGLRIZmam5+fBgwcrJSVF999/v/bs2aMuXboEcGZoa6NHj/b83HCh34MPPug5KhMMcnNzdfz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775bzz77rOc8aW1trZYtW6Z33nlHly9fltPp1MKFCzvEYcaWOnjwoB5//PFvLc/KytKyZctkWZbWrFmjN954Q+fOndPdd9+thQsXauDAgZ6xZ8+e1eLFi/Xf//3fstvteuihhzR//nx169atPaP45Ea5c3Jy9OMf/1h/+tOfVF1drV69eum+++7TzJkzvU6Rmpg7KSmpyeVLly71/PLRkuf1//7v/yonJ0eHDh1SZGSksrKyNGvWLHXq1PF+P2wu81/+8he98MILOn78uC5cuKA+ffrowQcf1LRp0xQVFeUZb1JmSZo3b54OHDigiooKRUdHKykpSU899ZTuu+8+ScG3nxvcKHcw7GsKDAAAMA7XwAAAAONQYAAAgHEoMAAAwDgUGAAAYBwKDAAAMA4FBgAAGIcCAwAAjEOBAQAAxqHAAAAA41BgAACAcSgwAADAOBQYAABgnP8PhqkONZ7Fjw4AAAAASUVORK5CYII=",
      "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": 51,
   "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": [
      "bluejay_mix_t1 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": 52,
   "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": 53,
   "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": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAGdCAYAAAAMm0nCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA2wElEQVR4nO3dfXQU9b3H8c9u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IAw67QB5r777tPJkyf1/PPPy+Px6KabbtJLL73EKSQAANA570ICAABoS6e8BgYAAKAtBBgAAGAcAgwAADAOAQYAABiHABNEr776qu68806NGjVK3/nOd7R///5wdymsXnjhBaWmpvr9fOMb37CW19XVqbCwUFlZWcrMzNQPfvADVVVVhbHHHWPv3r16+OGH5Xa7lZqaqh07dvgt9/l8+tnPfia3263Ro0drxowZ+vvf/+7X5vTp05o/f77GjBmjsWPHatGiRaqpqenAvQi99ur0xBNPXHF85eXl+bWJ9Dq9+OKLmjp1qjIzM5Wdna38/Hx98sknfm3svM8qKys1a9YspaenKzs7WytXrtSlS5c6cldCyk6dHnzwwSuOp6efftqvTaTXadOmTZo0aZLGjBmjMWPGKDc3V++//761vLMdSwSYINm+fbuKior0/e9/X2+++abS0tKUl5d3xbcJdzXDhw/Xzp07rZ9NmzZZy5YvX64//vGPWr16tV555RWdOHFCc+bMCWNvO0Ztba1SU1O1ZMmSFpcXFxfrlVdeUUFBgbZs2aLY2Fjl5eWprq7OavPYY4/p8OHDKikp0dq1a/XRRx9d8WFruvbqJEnjx4/3O76ee+45v+WRXqc9e/Zo2rRp2rJli0pKSnTp0iXl5eWptrbWatPe+6yhoUGzZ89WfX29Nm/erBUrVujNN9/U888/H45dCgk7dZKk+++/3+94WrBggbWsK9Spf//+euyxx/TGG2/o9ddf11e/+lV9//vfV0VFhaROeCz5EBTf/va3fYWFhdZ0Q0ODz+12+1588cUw9iq8nn/+ed83v/nNFpedPXvWd8stt/jeeecda97hw4d9I0aM8O3bt6+Dehh+I0aM8L377rvWtNfr9d1+++2+l156yZp39uxZ38iRI31vvfWWz+f7sk779++32rz//vu+1NRU3+eff95xne9Azevk8/l8Cxcu9D3yyCOtvqYr1qm6uto3YsQI3549e3w+n7332XvvvedLS0vzeTweq82mTZt8Y8aM8dXV1XVo/ztK8zr5fD7fv//7v/ueeeaZVl/TFevk8/l8t912m2/Lli2d8lhiBCYILl68qI8//ljjxo2z5jmdTo0bN0779u0LY8/C78iRI3K73fr617+u+fPnq7KyUpJ04MAB1dfX+9Xsxhtv1MCBA1VaWhqm3obf8ePH5fF4/OoSHx+v9PR061jat2+fEhISNGrUKKvNuHHj5HQ6u9xpyz179ig7O1v33nuvlixZolOnTlnLumKdzp07J0lKTEyUZO99VlpaqhEjRvh9Sajb7db58+d1+PDhjut8B2pep0bbtm1TVlaWJk6cqGeffVYXLlywlnW1OjU0NOjtt99WbW2tMjMzO+Wx1Gm/idckp06dUkNDg5KTk/3mJycnX3GetSsZPXq0ioqKNHToUHk8Hv385z/XtGnTtG3bNlVVVSk6OloJCQl+r0lOTpbH4wlTj8Ovcd9bOpYazzVXVVWpT58+fsu7deumxMTELlW78ePH6+6779agQYN07NgxPffcc3rooYf0m9/8RlFRUV2uTl6vV8uXL9eYMWM0YsQISbL1PquqqrriG84bp7tKnSRp4sSJGjhwoPr27avy8nKtWrVKn376qdasWSOp69SpvLxc3/3ud1VXV6eePXvq5z//uYYNG6aysrJOdywRYBAyOTk51u9paWlKT0/XHXfcoXfeeUc9evQIY88QCSZMmGD93njR5V133WWNynQ1hYWFqqio8LvODFdqrU65ubnW76mpqUpJSdGMGTN09OhRDRkypKO7GTZDhw7Vb3/7W507d07/8z//o4ULF2rjxo3h7laLOIUUBElJSYqKirrigt3q6mqe3dREQkKCbrjhBh09elQul0v19fU6e/asX5vq6mqlpKSEqYfh17jvbR1LLpdLJ0+e9Ft+6dIlnTlzpkvXbvDgwUpKStKRI0ckda06LV26VO+9957Wr1+v/v37W/PtvM9cLtcVd5I0TneVOrUkPT1dkvyOp65Qp5iYGF1//fUaOXKk5s+fr7S0NG3YsKFTHksEmCCIiYnRLbfcot27d1vzvF6vdu/erczMzDD2rHOpqanRsWPHlJKSopEjRyo6OtqvZp988okqKyuVkZERvk6G2aBBg5SSkuJXl/Pnz+svf/mLdSxlZmbq7NmzOnDggNXmww8/lNfr1ejRozu8z53F559/rtOnT1sflF2hTj6fT0uXLtW7776r9evXa/DgwX7L7bzPMjIydOjQIb/QvGvXLvXq1UvDhg3rkP0Itfbq1JKysjJJX/6PtyvUqSVer1cXL17slMcSp5CCZObMmVq4cKFGjhyp0aNHa/369bpw4YKmTJkS7q6FzcqVK3XHHXdo4MCBOnHihF544QU5nU5NnDhR8fHxmjp1qlasWKHExET16tVLzzzzjDIzMyM+wNTU1Ojo0aPW9PHjx1VWVqbExEQNHDhQ06dP1y9/+Utdf/31GjRokH72s5+pb9++uuuuuyRdvnBu/Pjxeuqpp1RYWKj6+notW7ZMEyZMUL9+/cK1W0HXVp0SExO1Zs0a3XvvvXK5XDp27Jh++tOf6vrrr9f48eMldY06FRYW6q233tIvfvELxcXFWdcZxMfHq0ePHrbeZ263W8OGDdOCBQv0+OOPy+PxaPXq1Zo2bZpiYmLCuHfB016djh49qm3btiknJ0e9e/dWeXm5ioqKdNtttyktLU1S16jTs88+q6997WsaMGCAampq9NZbb2nPnj1at25dpzyWeBp1EG3cuFHr1q2Tx+PRTTfdpMWLF1vDkF3Rj370I+3du1enT59Wnz59dOutt+pHP/qRdT65rq5OK1as0Ntvv62LFy/K7XZryZIlETUc25I//elPmj59+hXzJ0+erBUrVsjn8+n555/Xli1bdPbsWd16661asmSJhg4darU9ffq0li1bpj/84Q9yOp265557tHjxYsXFxXXkroRUW3UqKCjQ97//ff31r3/VuXPn1LdvX91+++2aN2+e32nbSK9Tampqi/OLioqsP57svM8+++wzFRQUaM+ePYqNjdXkyZM1f/58desWGX/jtlen//u//9Pjjz+uiooK1dbWasCAAbrrrruUn5+vXr16We0jvU6LFi3Shx9+qBMnTig+Pl6pqal66KGHdPvtt0vqfMcSAQYAABiHa2AAAIBxCDAAAMA4BBgAAGAcAgwAADAOAQYAABiHAAMAAIxDgAEAAMYhwAAAAOMQYAAAgHEIMAAAwDgEGAAAYBwCDAAAMM7/AykQA3SeKx+8AAAAAElFTkSuQmCC",
      "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": 54,
   "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": 55,
   "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": 56,
   "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": 57,
   "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": 58,
   "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": 59,
   "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": 60,
   "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": 61,
   "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": 62,
   "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": 63,
   "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": 64,
   "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": null,
   "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[66], 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_bluejay_r2.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": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(449352, 158)\n",
      "task\n",
      "                 368064\n",
      "extend            53196\n",
      "upload_extend     28092\n",
      "Name: count, dtype: int64\n",
      "(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 'NPZ_DIR' 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[3], line 14\u001b[0m\n\u001b[1;32m     12\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_30b_slice\u001b[38;5;241m.\u001b[39mshape)\n\u001b[1;32m     13\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_30b_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[0;32m---> 14\u001b[0m df_30b_slice[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnpz_path\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[43mdf_30b_slice\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43ms3_id\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmap\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43;01mlambda\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mx\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mNPZ_DIR\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m/\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mx\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m.npz\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m     15\u001b[0m df_total \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mconcat([df_13b_slice, df_30b_slice])\n\u001b[1;32m     16\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_total\u001b[38;5;241m.\u001b[39mshape)\n",
      "File \u001b[0;32m~/anaconda3/envs/suno_env_dev/lib/python3.10/site-packages/pandas/core/series.py:4700\u001b[0m, in \u001b[0;36mSeries.map\u001b[0;34m(self, arg, na_action)\u001b[0m\n\u001b[1;32m   4620\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmap\u001b[39m(\n\u001b[1;32m   4621\u001b[0m     \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m   4622\u001b[0m     arg: Callable \u001b[38;5;241m|\u001b[39m Mapping \u001b[38;5;241m|\u001b[39m Series,\n\u001b[1;32m   4623\u001b[0m     na_action: Literal[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mignore\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m   4624\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Series:\n\u001b[1;32m   4625\u001b[0m \u001b[38;5;250m    \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m   4626\u001b[0m \u001b[38;5;124;03m    Map values of Series according to an input mapping or function.\u001b[39;00m\n\u001b[1;32m   4627\u001b[0m \n\u001b[0;32m   (...)\u001b[0m\n\u001b[1;32m   4698\u001b[0m \u001b[38;5;124;03m    dtype: object\u001b[39;00m\n\u001b[1;32m   4699\u001b[0m \u001b[38;5;124;03m    \"\"\"\u001b[39;00m\n\u001b[0;32m-> 4700\u001b[0m     new_values \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_map_values\u001b[49m\u001b[43m(\u001b[49m\u001b[43marg\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mna_action\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mna_action\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   4701\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_constructor(new_values, index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mindex, copy\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\u001b[38;5;241m.\u001b[39m__finalize__(\n\u001b[1;32m   4702\u001b[0m         \u001b[38;5;28mself\u001b[39m, method\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmap\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m   4703\u001b[0m     )\n",
      "File \u001b[0;32m~/anaconda3/envs/suno_env_dev/lib/python3.10/site-packages/pandas/core/base.py:921\u001b[0m, in \u001b[0;36mIndexOpsMixin._map_values\u001b[0;34m(self, mapper, na_action, convert)\u001b[0m\n\u001b[1;32m    918\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(arr, ExtensionArray):\n\u001b[1;32m    919\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m arr\u001b[38;5;241m.\u001b[39mmap(mapper, na_action\u001b[38;5;241m=\u001b[39mna_action)\n\u001b[0;32m--> 921\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43malgorithms\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmap_array\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmapper\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mna_action\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mna_action\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconvert\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconvert\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[0;32m~/anaconda3/envs/suno_env_dev/lib/python3.10/site-packages/pandas/core/algorithms.py:1743\u001b[0m, in \u001b[0;36mmap_array\u001b[0;34m(arr, mapper, na_action, convert)\u001b[0m\n\u001b[1;32m   1741\u001b[0m values \u001b[38;5;241m=\u001b[39m arr\u001b[38;5;241m.\u001b[39mastype(\u001b[38;5;28mobject\u001b[39m, copy\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m   1742\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m na_action \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 1743\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mlib\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmap_infer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvalues\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmapper\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconvert\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconvert\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   1744\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m   1745\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m lib\u001b[38;5;241m.\u001b[39mmap_infer_mask(\n\u001b[1;32m   1746\u001b[0m         values, mapper, mask\u001b[38;5;241m=\u001b[39misna(values)\u001b[38;5;241m.\u001b[39mview(np\u001b[38;5;241m.\u001b[39muint8), convert\u001b[38;5;241m=\u001b[39mconvert\n\u001b[1;32m   1747\u001b[0m     )\n",
      "File \u001b[0;32mlib.pyx:2972\u001b[0m, in \u001b[0;36mpandas._libs.lib.map_infer\u001b[0;34m()\u001b[0m\n",
      "Cell \u001b[0;32mIn[3], line 14\u001b[0m, in \u001b[0;36m<lambda>\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m     12\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_30b_slice\u001b[38;5;241m.\u001b[39mshape)\n\u001b[1;32m     13\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_30b_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[0;32m---> 14\u001b[0m df_30b_slice[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnpz_path\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m df_30b_slice[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124ms3_id\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m.\u001b[39mmap(\u001b[38;5;28;01mlambda\u001b[39;00m x: \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[43mNPZ_DIR\u001b[49m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mx\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.npz\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m     15\u001b[0m df_total \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mconcat([df_13b_slice, df_30b_slice])\n\u001b[1;32m     16\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_total\u001b[38;5;241m.\u001b[39mshape)\n",
      "\u001b[0;31mNameError\u001b[0m: name 'NPZ_DIR' is not defined"
     ]
    }
   ],
   "source": [
    "df_13b_slice = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/13b_v32/interesting_clips_v4_h_s_32_20250330_full_long_bluejay_r2.pkl\"\n",
    ")\n",
    "print(df_13b_slice.shape)\n",
    "print(df_13b_slice[\"task\"].value_counts())\n",
    "df_13b_slice[\"npz_path\"] = df_13b_slice[\"s3_id\"].map(\n",
    "    lambda x: f\"/app/suno/data/dpo/13b_s32_npz/{x}.npz\"\n",
    ")\n",
    "df_30b_slice = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250222_bluejay_r2.pkl\"\n",
    ")\n",
    "print(df_30b_slice.shape)\n",
    "print(df_30b_slice[\"task\"].value_counts())\n",
    "df_30b_slice[\"npz_path\"] = df_30b_slice[\"s3_id\"].map(lambda x: f\"{NPZ_DIR}/{x}.npz\")\n",
    "df_total = pd.concat([df_13b_slice, df_30b_slice])\n",
    "print(df_total.shape)\n",
    "print(df_total[\"task\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# from suno_utils.audio import Audio\n",
    "\n",
    "# audio = Audio.from_file(\"/app2/suno/data/dpo/audios/v4/b2d19e3b-19e1-4430-ae5c-67551f699fbe.mp3\")\n",
    "# print(audio.duration_s)\n",
    "# audio.play()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(107104, 150) (52882, 150)\n",
      "after date cut (52882, 150)\n",
      "task\n",
      "artist_consistency    23268\n",
      "cover                 16950\n",
      "infill                12538\n",
      "infill_intro            126\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "# df_30b_slice[\"created_at\"] = pd.to_datetime(df_30b_slice[\"created_at\"], utc=True)\n",
    "# # start_cutoff_date = pd.to_datetime(\"2025-01-12\", utc=True)\n",
    "# # end_cutoff_date = pd.to_datetime(\"2025-02-10\", utc=True)\n",
    "# start_cutoff_date = pd.to_datetime(\"2025-02-10\", utc=True)\n",
    "# end_cutoff_date = pd.to_datetime(\"2025-04-10\", utc=True)\n",
    "# date_mask = (df_30b_slice[\"created_at\"] < end_cutoff_date) & (\n",
    "#     df_30b_slice[\"created_at\"] >= start_cutoff_date\n",
    "# )\n",
    "# print(df_30b_slice.shape, df_30b_slice[date_mask].shape)\n",
    "# df_30b_slice = df_30b_slice[date_mask].copy()\n",
    "# print(\"after date cut\", df_30b_slice.shape)\n",
    "# print(df_30b_slice[\"task\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(449352, 159) (236210, 159)\n",
      "after date cut (236210, 159)\n",
      "task\n",
      "                 192984\n",
      "extend            27988\n",
      "upload_extend     15238\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "# df_13b_slice[\"created_at\"] = pd.to_datetime(df_13b_slice[\"created_at\"], utc=True)\n",
    "# # start_cutoff_date = pd.to_datetime(\"2025-01-12\", utc=True)\n",
    "# # end_cutoff_date = pd.to_datetime(\"2025-03-10\", utc=True)\n",
    "# start_cutoff_date = pd.to_datetime(\"2025-03-10\", utc=True)\n",
    "# end_cutoff_date = pd.to_datetime(\"2025-04-10\", utc=True)\n",
    "# date_mask = (df_13b_slice[\"created_at\"] < end_cutoff_date) & (\n",
    "#     df_13b_slice[\"created_at\"] >= start_cutoff_date\n",
    "# )\n",
    "# print(df_13b_slice.shape, df_13b_slice[date_mask].shape)\n",
    "# df_13b_slice = df_13b_slice[date_mask].copy()\n",
    "# print(\"after date cut\", df_13b_slice.shape)\n",
    "# print(df_13b_slice[\"task\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(289092, 163)\n",
      "task\n",
      "                      192984\n",
      "extend                 27988\n",
      "artist_consistency     23268\n",
      "cover                  16950\n",
      "upload_extend          15238\n",
      "infill                 12538\n",
      "infill_intro             126\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "df_total = pd.concat([df_13b_slice, df_30b_slice])\n",
    "print(df_total.shape)\n",
    "print(df_total[\"task\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Before filtering by user_id and task 289092 user_id unique: 51480\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Processing user_id and task groups: 100%|██████████| 60148/60148 [00:08<00:00, 6884.06it/s] \n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "After filtering by user_id and task 120296 user_id unique: 51480\n"
     ]
    }
   ],
   "source": [
    "print(\n",
    "    \"Before filtering by user_id and task\",\n",
    "    df_total.shape[0],\n",
    "    \"user_id unique:\",\n",
    "    df_total[\"user_id\"].nunique(),\n",
    ")\n",
    "\n",
    "# Create a copy to avoid fragmentation warning\n",
    "df_total = df_total.copy()\n",
    "\n",
    "# Calculate score for each row: reaction_play_count + 5 if preference is True, else 0\n",
    "score_values = (\n",
    "    df_total[\"reaction_play_count\"] + (5 * df_total[\"upvote_count\"].astype(int))\n",
    ") * df_total[\"preference\"].astype(int)\n",
    "\n",
    "# Use pd.concat to add the score column efficiently\n",
    "df_total = pd.concat(\n",
    "    [df_total, pd.DataFrame({\"score\": score_values}, index=df_total.index)], axis=1\n",
    ")\n",
    "\n",
    "# Group by user_id and task, then for each group find the request_id with highest score\n",
    "best_request_ids = []\n",
    "for (user_id, task), group in tqdm(\n",
    "    df_total.groupby([\"user_id\", \"task\"]), desc=\"Processing user_id and task groups\"\n",
    "):\n",
    "    # Get the request_id with the highest score in this group\n",
    "    best_request_id = group.loc[group[\"score\"].idxmax(), \"request_id\"]\n",
    "    best_request_ids.append(best_request_id)\n",
    "\n",
    "# Filter df_total to keep only the best request_ids for each user_id, task combination\n",
    "df_total = df_total[df_total[\"request_id\"].isin(best_request_ids)].copy()\n",
    "\n",
    "print(\n",
    "    \"After filtering by user_id and task\",\n",
    "    df_total.shape[0],\n",
    "    \"user_id unique:\",\n",
    "    df_total[\"user_id\"].nunique(),\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_slice = df_total.copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "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": 65,
   "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": [
      "(120296, 164)\n",
      "(120296, 164)\n",
      "(120296, 164)\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": 66,
   "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": [
      "60148\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": 67,
   "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": 68,
   "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": 69,
   "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": [
      "59546 602\n",
      "(119092, 164) (1204, 164)\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": 70,
   "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": 71,
   "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": [
      "  0%|          | 0/119092 [00:00<?, ?it/s]"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 119092/119092 [00:04<00:00, 25075.36it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5,451 hours of 119092 clips, 7.44325 nodes, 465.203125 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 / 8 / 4} iters\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "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": [
      "  0%|          | 0/1204 [00:00<?, ?it/s]"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1204/1204 [00:18<00:00, 64.70it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 1204 clips, 0 different prompts\n",
      "33 hours of False\n",
      "33 hours of True\n",
      "gen: 36.6 hours\n",
      "extend: 13.1 hours\n",
      "infill: 1.8 hours\n",
      "cover: 6.0 hours\n",
      "artist_consistency: 8.5 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": 73,
   "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": 74,
   "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": [
      "  0%|          | 0/119092 [00:00<?, ?it/s]"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  4%|▎         | 4209/119092 [00:58<23:19, 82.08it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "128114, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/8aa0e814-beba-4519-84df-42becf7787d4.npz.\n",
      "WTF --> 128115, skip, preference: True, 21cc86e1-2145-4897-8e84-52508a079701, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  9%|▉         | 10733/119092 [02:23<22:18, 80.93it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "328102, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/316ec332-9b2b-4be4-a3e8-66b26fa3beff.npz.\n",
      "WTF --> 328103, skip, preference: True, f02d5e0c-5083-4375-a989-6d9a7420e0f9, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 11%|█         | 12786/119092 [02:49<22:00, 80.48it/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": [
      " 14%|█▍        | 16907/119092 [03:42<20:31, 82.95it/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": [
      " 20%|█▉        | 23473/119092 [05:06<18:59, 83.93it/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%|██        | 25102/119092 [05:27<20:01, 78.20it/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%|██▏       | 26485/119092 [05:45<19:11, 80.41it/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": [
      " 25%|██▍       | 29231/119092 [06:21<18:14, 82.11it/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": [
      " 25%|██▌       | 30060/119092 [06:32<17:39, 84.07it/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%|██▋       | 32074/119092 [06:58<17:39, 82.12it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1005962, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/a09fde3e-02a4-4e0e-95fb-f527a6385aa9.npz.\n",
      "WTF --> 1005963, skip, preference: True, c9611be6-8ca8-4888-84f6-d3165a741dd4, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 28%|██▊       | 33056/119092 [07:11<17:16, 82.98it/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": [
      " 28%|██▊       | 33213/119092 [07:13<17:15, 82.93it/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": [
      " 29%|██▉       | 35092/119092 [07:38<16:53, 82.86it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1098154, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/dda2c0af-86cc-4de4-8bdd-bae326f0e24c.npz.\n",
      "WTF --> 1098155, skip, preference: True, 3ca9a21a-72d2-4ce3-9363-0401c881d11e, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 31%|███▏      | 37242/119092 [08:06<16:38, 81.95it/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": [
      " 32%|███▏      | 37744/119092 [08:12<16:09, 83.94it/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": [
      " 32%|███▏      | 38150/119092 [08:17<17:04, 79.00it/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%|███▏      | 38694/119092 [08:24<15:59, 83.76it/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": [
      " 33%|███▎      | 39220/119092 [08:31<16:12, 82.11it/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": [
      " 36%|███▌      | 42488/119092 [09:13<15:13, 83.86it/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": [
      " 41%|████      | 48429/119092 [10:31<14:12, 82.89it/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": [
      " 43%|████▎     | 50689/119092 [11:00<13:23, 85.13it/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": [
      " 52%|█████▏    | 61870/119092 [13:28<11:31, 82.72it/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": [
      " 52%|█████▏    | 62068/119092 [13:31<11:46, 80.76it/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": [
      " 53%|█████▎    | 63183/119092 [13:45<11:31, 80.83it/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": [
      " 55%|█████▌    | 65845/119092 [14:20<10:35, 83.75it/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": [
      " 56%|█████▌    | 66733/119092 [14:32<10:46, 81.04it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2099900, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/40abde5f-a2be-4213-9c2b-ab48dcf05682.npz.\n",
      "WTF --> 2099901, skip, preference: True, 4b899c21-1832-4f56-9d7c-f3590acdbc9a, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 59%|█████▉    | 70399/119092 [15:20<10:12, 79.50it/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": [
      " 62%|██████▏   | 73249/119092 [15:58<09:35, 79.64it/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": [
      " 63%|██████▎   | 74693/119092 [16:18<09:03, 81.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": [
      " 66%|██████▌   | 78799/119092 [17:13<09:10, 73.26it/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": [
      " 68%|██████▊   | 80452/119092 [17:38<08:53, 72.46it/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": [
      " 69%|██████▊   | 81825/119092 [17:58<09:08, 67.92it/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": [
      " 69%|██████▉   | 82319/119092 [18:06<08:46, 69.88it/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%|███████▏  | 85065/119092 [18:48<07:50, 72.25it/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": [
      " 72%|███████▏  | 85817/119092 [18:59<07:38, 72.60it/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": [
      " 74%|███████▎  | 87799/119092 [19:27<06:10, 84.43it/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": [
      " 75%|███████▌  | 89509/119092 [19:49<06:05, 80.85it/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": [
      " 76%|███████▌  | 90517/119092 [20:02<05:46, 82.48it/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%|███████▉  | 94407/119092 [20:53<05:06, 80.59it/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%|████████▎ | 99227/119092 [21:55<04:09, 79.65it/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": [
      " 85%|████████▌ | 101286/119092 [22:21<03:37, 81.92it/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": [
      " 86%|████████▌ | 102125/119092 [22:32<03:21, 84.09it/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": [
      " 87%|████████▋ | 103415/119092 [22:48<03:13, 80.95it/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": [
      " 89%|████████▊ | 105519/119092 [23:15<02:41, 84.29it/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%|████████▉ | 105903/119092 [23:20<02:38, 83.19it/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%|█████████ | 108497/119092 [23:54<02:11, 80.86it/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": [
      " 94%|█████████▍| 112299/119092 [24:42<01:22, 82.33it/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": [
      " 95%|█████████▍| 112703/119092 [24:47<01:15, 84.84it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3618520, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/1d6fb316-3320-409f-b8a6-189d385b69e6.npz.\n",
      "WTF --> 3618521, skip, preference: True, b33d9b6e-9ab7-4392-8807-fd66ef850551, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 96%|█████████▌| 114068/119092 [25:06<01:02, 80.96it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3664210, 'history_arr is not a file in the archive', upload_extend, /app/suno/data/dpo/13b_s32_npz/d1cc5647-cdc4-48c1-a8d0-79c32a4a390e.npz.\n",
      "WTF --> 3664211, skip, preference: True, 29f3b6a1-9551-4428-84dd-6b8136565310, task: upload_extend.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 96%|█████████▌| 114295/119092 [25:09<00:58, 81.41it/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%|█████████▋| 115287/119092 [25:21<00:46, 82.30it/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%|█████████▊| 117216/119092 [25:46<00:23, 81.23it/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%|█████████▉| 117695/119092 [25:52<00:17, 81.24it/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%|█████████▉| 118269/119092 [25:59<00:10, 79.86it/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%|██████████| 119092/119092 [26:10<00:00, 75.83it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 118984 clips, 7 different prompts\n",
      "3,271 hours of False\n",
      "3,194 hours of True\n",
      "infill: 213.0 hours\n",
      "cover: 651.7 hours\n",
      "gen: 3587.3 hours\n",
      "extend: 1230.3 hours\n",
      "artist_consistency: 783.2 hours\n",
      "🚨 Error upload_extend: 7\n",
      "🚨 Error infill: 26\n",
      "🚨 Error infill_intro: 21\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": 75,
   "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": 76,
   "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({None: 684, 'extend': 240, 'artist_consistency': 128, 'cover': 92, 'infill': 60})\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": 77,
   "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": 78,
   "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": 79,
   "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": 80,
   "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": 81,
   "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": 82,
   "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": [
      "602 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": 83,
   "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": 84,
   "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": 85,
   "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 118984 (119092, 164)\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": 86,
   "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 464.78125\n"
     ]
    }
   ],
   "source": [
    "print(\"1 epoch per batch 4, total\", total_iters / 8 / 4 / 8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [],
   "source": [
    "# import time\n",
    "\n",
    "# time.sleep(3)\n",
    "# print(\"done\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "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": [
    "# time.sleep(3600 * 2)\n",
    "# !cd /home/tony/Work/tony/slurm/bluejay && sbatch sbatch_ipo_bluejay"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "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_bluejay_r2_13b_v34_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": 90,
   "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": 91,
   "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": 92,
   "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": 93,
   "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": 93,
     "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
}
