{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:21.040680Z",
     "start_time": "2024-05-16T13:58:19.777010Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:14:22.619680Z",
     "iopub.status.busy": "2025-03-20T20:14:22.619548Z",
     "iopub.status.idle": "2025-03-20T20:14:26.463647Z",
     "shell.execute_reply": "2025-03-20T20:14:26.463110Z",
     "shell.execute_reply.started": "2025-03-20T20:14:22.619666Z"
    }
   },
   "outputs": [],
   "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": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:21.082172Z",
     "start_time": "2024-05-16T13:58:21.041926Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:14:26.465664Z",
     "iopub.status.busy": "2025-03-20T20:14:26.465537Z",
     "iopub.status.idle": "2025-03-20T20:14:26.524781Z",
     "shell.execute_reply": "2025-03-20T20:14:26.524341Z",
     "shell.execute_reply.started": "2025-03-20T20:14:26.465651Z"
    }
   },
   "outputs": [],
   "source": [
    "OUT_DATA_DIR = \"/app/suno/data/dpo/30b_t6_v35\"\n",
    "os.makedirs(OUT_DATA_DIR, exist_ok=True)\n",
    "shutil.copyfile(\n",
    "    \"/app/suno/data/dpo/7v_v20_full/tokenizer_60k.json\",\n",
    "    os.path.join(OUT_DATA_DIR, \"tokenizer_60k.json\"),\n",
    ")\n",
    "NPZ_DIR = \"/app/suno/data/dpo/30b_npz\"\n",
    "# NOTE FOR 30b we increase this from 6016 up\n",
    "N_TOKENS_AUDIO = 6016"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:53.962528Z",
     "start_time": "2024-05-16T13:58:21.105919Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:14:26.526478Z",
     "iopub.status.busy": "2025-03-20T20:14:26.526352Z",
     "iopub.status.idle": "2025-03-20T20:15:20.749130Z",
     "shell.execute_reply": "2025-03-20T20:15:20.748547Z",
     "shell.execute_reply.started": "2025-03-20T20:14:26.526465Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preference data shape (1705756, 90)\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_20250301_full.pkl\"\n",
    "    \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250227_full_long.pkl\"\n",
    "    # \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250107_full.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": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pre-infill filter (1705756, 90) unique user ids 71248\n",
      "post-infill filter (131428, 90) unique user ids 16221\n"
     ]
    }
   ],
   "source": [
    "# infill only filter\n",
    "print(\"pre-infill filter\", df.shape, \"unique user ids\", df[\"user_id\"].nunique())\n",
    "df = df[df[\"task\"].isin([\"infill\", \"infill_intro\", \"infill_outro\"])].copy()\n",
    "print(\"post-infill filter\", df.shape, \"unique user ids\", df[\"user_id\"].nunique())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:15:20.751109Z",
     "iopub.status.busy": "2025-03-20T20:15:20.750979Z",
     "iopub.status.idle": "2025-03-20T20:15:21.096600Z",
     "shell.execute_reply": "2025-03-20T20:15:21.096129Z",
     "shell.execute_reply.started": "2025-03-20T20:15:20.751095Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preference data shape (1074004, 90)\n",
      "pre-infill filter (1074004, 90) unique user ids 84323\n",
      "post-infill filter (49746, 90) unique user ids 12934\n",
      "post-infill merge (181174, 90) unique user ids 26633\n"
     ]
    }
   ],
   "source": [
    "df_2 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250421_full_long.pkl\"\n",
    ")\n",
    "print(\"Preference data shape\", df_2.shape)\n",
    "# infill only filter\n",
    "print(\"pre-infill filter\", df_2.shape, \"unique user ids\", df_2[\"user_id\"].nunique())\n",
    "df_2 = df_2[df_2[\"task\"].isin([\"infill\", \"infill_intro\", \"infill_outro\"])].copy()\n",
    "print(\"post-infill filter\", df_2.shape, \"unique user ids\", df_2[\"user_id\"].nunique())\n",
    "df = pd.concat([df, df_2])\n",
    "print(\"post-infill merge\", df.shape, \"unique user ids\", df[\"user_id\"].nunique())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:15:21.126691Z",
     "iopub.status.busy": "2025-03-20T20:15:21.126566Z",
     "iopub.status.idle": "2025-03-20T20:15:31.943706Z",
     "shell.execute_reply": "2025-03-20T20:15:31.943122Z",
     "shell.execute_reply.started": "2025-03-20T20:15:21.126678Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "after dropna (181174, 85)\n"
     ]
    }
   ],
   "source": [
    "df = df.dropna(axis=1, how=\"all\")\n",
    "print(\"after dropna\", df.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.199480Z",
     "start_time": "2024-05-16T13:58:53.963687Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:15:31.944427Z",
     "iopub.status.busy": "2025-03-20T20:15:31.944276Z",
     "iopub.status.idle": "2025-03-20T20:17:51.270886Z",
     "shell.execute_reply": "2025-03-20T20:17:51.270121Z",
     "shell.execute_reply.started": "2025-03-20T20:15:31.944412Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6138759\n",
      "6138759\n",
      "pre-downloaded df (181174, 85)\n",
      "downloaded df (181174, 85)\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": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.467253Z",
     "start_time": "2024-05-16T13:58:56.207647Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:17:51.271813Z",
     "iopub.status.busy": "2025-03-20T20:17:51.271632Z",
     "iopub.status.idle": "2025-03-20T20:17:52.714796Z",
     "shell.execute_reply": "2025-03-20T20:17:52.714179Z",
     "shell.execute_reply.started": "2025-03-20T20:17:51.271796Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "is_30b\n",
      "True    181174\n",
      "Name: count, dtype: int64\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "task\n",
       "infill          181076\n",
       "infill_intro        98\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 8,
     "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": 9,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:17:52.715693Z",
     "iopub.status.busy": "2025-03-20T20:17:52.715519Z",
     "iopub.status.idle": "2025-03-20T20:17:52.732265Z",
     "shell.execute_reply": "2025-03-20T20:17:52.731701Z",
     "shell.execute_reply.started": "2025-03-20T20:17:52.715676Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(181174, 86)\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": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.592883Z",
     "start_time": "2024-05-16T13:58:56.470781Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:17:52.733063Z",
     "iopub.status.busy": "2025-03-20T20:17:52.732911Z",
     "iopub.status.idle": "2025-03-20T20:17:53.572077Z",
     "shell.execute_reply": "2025-03-20T20:17:53.571330Z",
     "shell.execute_reply.started": "2025-03-20T20:17:52.733047Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preference  model_name    \n",
      "False       chirp-v4-h-t-6    90587\n",
      "True        chirp-v4-h-t-6    90587\n",
      "Name: count, dtype: int64\n",
      "before filter on model name (181174, 86)\n",
      "after filter on model name (181174, 86)\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": 11,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:17:53.572996Z",
     "iopub.status.busy": "2025-03-20T20:17:53.572827Z",
     "iopub.status.idle": "2025-03-20T20:17:53.596310Z",
     "shell.execute_reply": "2025-03-20T20:17:53.595725Z",
     "shell.execute_reply.started": "2025-03-20T20:17:53.572977Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "is_public\n",
      "False    181100\n",
      "True         74\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": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:58:56.909539Z",
     "start_time": "2024-05-16T13:58:56.595736Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:17:53.597088Z",
     "iopub.status.busy": "2025-03-20T20:17:53.596936Z",
     "iopub.status.idle": "2025-03-20T20:17:56.247824Z",
     "shell.execute_reply": "2025-03-20T20:17:56.247019Z",
     "shell.execute_reply.started": "2025-03-20T20:17:53.597073Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "before filter on request id pairs (181174, 86)\n",
      "after filter on request id pairs (181174, 86)\n",
      "preference  model_name    \n",
      "False       chirp-v4-h-t-6    90587\n",
      "True        chirp-v4-h-t-6    90587\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": 13,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:17:56.248782Z",
     "iopub.status.busy": "2025-03-20T20:17:56.248602Z",
     "iopub.status.idle": "2025-03-20T20:23:43.102711Z",
     "shell.execute_reply": "2025-03-20T20:23:43.101954Z",
     "shell.execute_reply.started": "2025-03-20T20:17:56.248765Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "unique_requests 90587\n",
      "before removing duplicates (181174, 155)\n",
      "after removing duplicates (181174, 148)\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": 14,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:23:43.103635Z",
     "iopub.status.busy": "2025-03-20T20:23:43.103461Z",
     "iopub.status.idle": "2025-03-20T20:23:43.880658Z",
     "shell.execute_reply": "2025-03-20T20:23:43.880120Z",
     "shell.execute_reply.started": "2025-03-20T20:23:43.103618Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "task\n",
       "infill          181076\n",
       "infill_intro        98\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"task\"].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:23:43.881441Z",
     "iopub.status.busy": "2025-03-20T20:23:43.881283Z",
     "iopub.status.idle": "2025-03-20T20:23:48.072815Z",
     "shell.execute_reply": "2025-03-20T20:23:48.072197Z",
     "shell.execute_reply.started": "2025-03-20T20:23:43.881426Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pos_diff_preference\n",
       "1.0    67330\n",
       "2.0    23257\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 15,
     "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": 16,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:23:48.073685Z",
     "iopub.status.busy": "2025-03-20T20:23:48.073520Z",
     "iopub.status.idle": "2025-03-20T20:23:49.564713Z",
     "shell.execute_reply": "2025-03-20T20:23:49.564009Z",
     "shell.execute_reply.started": "2025-03-20T20:23:48.073670Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "positive param_experiment\n",
      "temp_s_70           2357\n",
      "temp_s_80           2330\n",
      "step_8              2316\n",
      "text_1              2166\n",
      "text_3              1525\n",
      "step_16             1146\n",
      "step_12             1127\n",
      "step_10              826\n",
      "temp_s_90            696\n",
      "step_16_text_1       648\n",
      "adjust_cfg_steps     440\n",
      "text_15              417\n",
      "temp_s_95            409\n",
      "min_p_002            392\n",
      "min_p_0001           378\n",
      "text_25              356\n",
      "s_10_t_12            108\n",
      "text_2                98\n",
      "s_20_t_12             94\n",
      "min_p_02              64\n",
      "min_p_01              59\n",
      "min_p_005             48\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": 17,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:23:49.568824Z",
     "iopub.status.busy": "2025-03-20T20:23:49.568511Z",
     "iopub.status.idle": "2025-03-20T20:23:49.585611Z",
     "shell.execute_reply": "2025-03-20T20:23:49.585061Z",
     "shell.execute_reply.started": "2025-03-20T20:23:49.568804Z"
    }
   },
   "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": 18,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:40.799375Z",
     "start_time": "2024-05-16T13:59:36.394236Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:23:49.586385Z",
     "iopub.status.busy": "2025-03-20T20:23:49.586234Z",
     "iopub.status.idle": "2025-03-20T20:24:08.098903Z",
     "shell.execute_reply": "2025-03-20T20:24:08.098166Z",
     "shell.execute_reply.started": "2025-03-20T20:23:49.586370Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "good_continue_at\n",
      "True    181174\n",
      "Name: count, dtype: int64\n",
      "\n",
      " Check some basics... \n",
      " preference\n",
      "False    90587\n",
      "True     90587\n",
      "Name: count, dtype: int64 is_30b\n",
      "True    181174\n",
      "Name: count, dtype: int64 model_name\n",
      "chirp-v4-h-t-6    181174\n",
      "Name: count, dtype: int64 preference  model_name    \n",
      "False       chirp-v4-h-t-6    90587\n",
      "True        chirp-v4-h-t-6    90587\n",
      "Name: count, dtype: int64\n",
      "task\n",
      "infill          181076\n",
      "infill_intro        98\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",
    "    if row[\"continue_at\"] is not None:\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": 19,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:08.099823Z",
     "iopub.status.busy": "2025-03-20T20:24:08.099657Z",
     "iopub.status.idle": "2025-03-20T20:24:08.377857Z",
     "shell.execute_reply": "2025-03-20T20:24:08.377272Z",
     "shell.execute_reply.started": "2025-03-20T20:24:08.099807Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjkAAAGdCAYAAADwjmIIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA190lEQVR4nO3de3wV9Z3/8feZXBDJhZgLFsNWGiSxQEgiPljSQ9EKahtxF2iL9cJlKahooRaNLoZLgAIi+ADEFTbSlKAUWaVWi2xXbXHpI1DBJqbBiARRYdNKEiAh4ZbkzO8PfhlzQgIJnJzLnNfz8chDz8z3zPf7yRw978x8Z8ZhmqYpAAAAmzF8PQAAAICuQMgBAAC2RMgBAAC2RMgBAAC2RMgBAAC2RMgBAAC2RMgBAAC2RMgBAAC2RMgBAAC2RMgBAAC2FOrrAfiD6uqT8sbDLRwOKTY20mv9+Qvqpm67C8aaJeqmbt+P5VIIOZJMU17dYd7uz19Qd3AJxrqDsWaJuoNNINXN6SoAAGBLhBwAAGBLhB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io6OVmVlpdUmMTHRrU1cXJy1Ljo6WlVVVdayZrGxsaqqqur0OGNjIzv9nivh7f78BXX7n5iYHl22bX+uu6sEY80SdQebQKq7y0JOQ0ODZs6cKdM0lZub21XdeER19UmZZtf343Cc/3B4qz9/Qd2+rTskxGg3zBw/Xq+mJpdH+/OXur0pGGuWqJu6fT+WS+mSkNPQ0KCf//znqqio0IYNG6yjONL5IzLHjh1za9/Y2KiamhrFx8dbbVofkWl+3Xz0pq021dXVFxzd6QjTlFd3mLf78xfU7Z+6amz+XndXCMaaJeoONoFUt8fvk9MccL744gv9+te/VkxMjNv69PR01dbWqrS01Fq2e/duuVwupaamSpLS0tK0d+9eNTQ0WG0KCwvVt29fRUdHW212797ttu3CwkKlpaV5uiQAABCAOh1y6uvrVVZWprKyMknSkSNHVFZWpoqKCjU0NGjGjBkqLS3V8uXL1dTUpMrKSlVWVurcuXOSpKSkJA0fPlxz5sxRSUmJPvzwQy1cuFBZWVnq1auXJGn06NEKCwvT008/rQMHDujtt99WQUGBJk+ebI1jwoQJ2rlzp371q1/p4MGDev7551VaWqr777/fE78XAAAQ4Dp9uqq0tFQTJkywXi9ZskSSNGbMGD366KP64x//KEn6l3/5F7f3FRQUaOjQoZKk5cuXa+HChZo4caIMw9Dtt9+unJwcq21kZKTWr1+vBQsWaOzYsYqJidH06dOty8clKSMjQ8uXL9fKlSv13HPP6frrr9cLL7yg/v37d7YkAABgQ50OOUOHDtX+/fvbXX+xdc169uypFStWXLRNSkqKNm3adNE23//+9/X973//kv0BAIDgw7OrAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRF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uzRK6+8ovXr16uhoUG1tbVuR3Oqq6sVHx8v6fwRmZKSErftNl991bJN6yuyqqqqFBER0amjOJJkmvLqDvN2f/4i2Opunvh7qbsSm2b799LxVx3Zj8G2v6XgrFmi7mATSHV7POT88z//s9566y23Zf/+7/+ub33rW5o6daq+8Y1vKCwsTLt27dIdd9whSfrss89UUVGhtLQ0SVJaWprWrl2r6upqxcbGSpIKCwsVERGhfv36WW3+93//162fwsJCaxuwB7s/dbvlDft4LhUAeJbHQ05ERIT69+/vtuzqq69Wz549reXjxo3T0qVLFR0drYiICC1atEjp6elWQHE6nerXr5+ys7P1xBNPqLKyUitXrtR9992n8PBwSdI999yjV155RcuWLdO4ceO0e/dubd++XevWrfN0SfAROz91u70b9vFcKgDwHJ/c8Xj27NkyDEMzZszQuXPn5HQ6NW/ePGt9SEiI1q5dq/nz52v8+PHq3r27xowZoxkzZlht+vTpo3Xr1mnJkiUqKCjQtddeq0WLFmn48OG+KAldwM5P3e7MvB0AwOXxSsjZuHGj2+tu3bpp3rx5bsGmteuuu055eXkX3e7QoUP1xhtveGKI8GN2PrrR0Xk7AIDOs995AAAAABFyAACATRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALRFyAACALfnkKeSwF8NwyDAcbstcLlMul+mjEaErhYQYbf47APgbQg6uiGE4FN3zaoW2+rJrbHKp5sQpgo6NxEd0U5PLVFRUd18PBQA6hJCDK2IYDoWGGJq5uUjlR+skSf0SIrTqnnQZhoOQYyNR3UMVYjjc9vUtyfF64o4UH48MANpGyIFHlB+t076KWl8PA17Qcl8nxffw8WgAoH2cUAcAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALZEyAEAALYU6usBwL5CQsjQAADfIeTA4+IjuqnJZSoqqru1rMllyjAcam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bceeP9rR1hLn5/2nShf9fa2uZv7Xp7Pual7f1u/CXMXZFG+P/l9ved1jb2zE9Mnm+tXa+Xi9sZ3ZF717w1Vdf6bvf/a42b96s9PR0a/myZcu0Z88e/dd//ZcPRwcAAHwtoE9XAQAAtCdgQ05MTIxCQkJUXV3ttry6ulpxcXE+GhUAAPAXARtywsPDNWDAAO3atcta5nK5tGvXLrfTVwAAIDgF7MRjSZo8ebKefPJJDRw4UKmpqdqwYYNOnz6tsWPH+npoAADAxwI65PzgBz/QsWPHtHr1alVWVurGG2/USy+9xOkqAAAQuFdXAQAAXEzAzskBAAC4GEIOAACwJUIOAACwJUIOAACwJUKOF73yyiv63ve+p0GDBulHP/qRSkpKfD0kj3n++eeVnJzs9nPnnXda68+ePavc3FwNHTpU6enp+tnPfqaqqiofjvjy7NmzRw899JCcTqeSk5P17rvvuq03TVOrVq2S0+lUamqqJk2apM8//9ytzYkTJzRr1ixlZGRoyJAhmj17turr671YReddqu6nnnrqgv0/ZcoUtzaBVve6des0btw4paena9iwYZo+fbo+++wztzYd+VxXVFRo2rRpGjx4sIYNG6ZnnnlGjY2N3iylUzpS9wMPPHDB/p47d65bm0Cre9OmTRo9erQyMjKUkZGh8ePH6/3337fW23FfS5euO+D3tQmv2LZtmzlgwADztddeMw8cOGDm5OSYQ4YMMauqqnw9NI9YvXq1mZWVZR49etT6qa6uttbPnTvXHDFihFlYWGj+7W9/M3/84x+b48eP9+GIL8+OHTvM5557zvyf//kfs3///uY777zjtn7dunXmTTfdZL7zzjtmWVmZ+dBDD5nf+973zDNnzlhtpkyZYt59991mcXGxuWfPHnPUqFHmL37xC2+X0imXqvvJJ580p0yZ4rb/T5w44dYm0Or+t3/7N/P11183P/30U7OsrMycOnWqecstt5j19fVWm0t9rhsbG8277rrLnDRpkvnxxx+bO3bsMIcOHWquWLHCFyV1SEfqvv/++82cnBy3/X3y5ElrfSDW/d5775k7duwwDx06ZH722Wfmc889Zw4YMMD89NNPTdO05742zUvXHej7mpDjJT/84Q/N3Nxc63VTU5PpdDrNdevW+XBUnrN69Wrz7rvvbnNdbW2tOWDAAHP79u3WsvLycrN///5mUVGRl0boea2/7F0ul/md73zHfOmll6xltbW15sCBA83f//73pml+XXdJSYnV5v333zeTk5PNf/zjH94b/BVoL+Q8/PDD7b7HDnVXV1eb/fv3Nz/44APTNDv2ud6xY4eZkpJiVlZWWm02bdpkZmRkmGfPnvXq+C9X67pN8/wX36JFi9p9jx3qNk3TvPnmm80tW7YEzb5u1ly3aQb+vuZ0lRecO3dO+/btU2ZmprXMMAxlZmaqqKjIhyPzrC+++EJOp1O33XabZs2apYqKCklSaWmpGhoa3OpPSkpS7969VVxc7KPRet6RI0dUWVnpVmdkZKQGDx5s7eeioiJFRUVp0KBBVpvMzEwZhhHwpy8/+OADDRs2THfccYfmzZun48ePW+vsUPfJkyclSdHR0ZI69rkuLi5W//793W5Q6nQ6VVdXp/Lycu8N/gq0rrvZW2+9paFDh+quu+7SihUrdPr0aWtdoNfd1NSkbdu26dSpU0pPTw+afd267maBvK8D+o7HgeL48eNqampSbGys2/LY2NgLznUHqtTUVC1ZskR9+/ZVZWWlXnjhBd1333166623VFVVpbCwMEVFRbm9JzY2VpWVlT4asec119LWfm4+d19VVaVrrrnGbX1oaKiio6MD+ncxfPhwjRo1SomJiTp8+LCee+45TZ06Va+++qpCQkICvm6Xy6XFixcrIyND/fv3l6QOfa6rqqouuAN78+tArVuS7rrrLvXu3VsJCQnav3+/li9frkOHDmnNmjWSArfu/fv365577tHZs2d19dVX64UXXlC/fv1UVlZm633dXt1S4O9rQg48YsSIEda/p6SkaPDgwbr11lu1fft2XXXVVT4cGbwhKyvL+vfmyYkjR460ju4EutzcXB04cECbNm3y9VC8qr26x48fb/17cnKy4uPjNWnSJH355Zf6p3/6J28P02P69u2rN954QydPntQf/vAHPfnkk3r55Zd9Pawu117d/fr1C/h9zekqL4iJiVFISIiqq6vdlldXV9v2OVtRUVG6/vrr9eWXXyouLk4NDQ2qra11a1NdXa34+Hgf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0baHUnJye3uXzJkiXWHycd+Vz/3//9n+bPn68PPvhA3bt315gxYzRr1iyFhvrn35iXqvvvf/+7nnjiCR04cECnTp3SN77xDY0cOVLTp09XRESE1T7Q6p49e7Z2796to0ePKjIyUsnJyZo6daq+853vSLLnvpYuXrcd9jUhBwAA2BJzcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC0RcgAAgC39P2+6JebsuwgPAAAAAElFTkSuQmCC",
      "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": 20,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.035167Z",
     "start_time": "2024-05-16T13:59:40.801098Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:08.394678Z",
     "iopub.status.busy": "2025-03-20T20:24:08.394527Z",
     "iopub.status.idle": "2025-03-20T20:24:14.019169Z",
     "shell.execute_reply": "2025-03-20T20:24:14.018389Z",
     "shell.execute_reply.started": "2025-03-20T20:24:08.394664Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "after duration 0.9737600317926414\n",
      "after infill duration 0.8913420247938446\n",
      "neg_filter_reaction_play_count 1.0\n",
      "neg_filter_upvote_count 0.9968\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.9308\n",
      "pos_filter_cer_diff_preference 1.0\n",
      "pos_filter_bad_flags 1.0\n",
      "after filter on play counts 0.8702\n",
      "after filter on higher quality 1.0\n",
      "----------------\n",
      "negative 78013 positive 63379\n",
      "----------------\n",
      "total pair requests 90587  --> selected pair requests 62247 frac 0.687\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": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.250737Z",
     "start_time": "2024-05-16T13:59:41.036434Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:14.020133Z",
     "iopub.status.busy": "2025-03-20T20:24:14.019953Z",
     "iopub.status.idle": "2025-03-20T20:24:15.729012Z",
     "shell.execute_reply": "2025-03-20T20:24:15.728301Z",
     "shell.execute_reply.started": "2025-03-20T20:24:14.020116Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30b_t6_v35 requests 62247 clips 124494 total khrs 1.090; N gpus for 1000 iters 7.781; 4 gpus for x iters 1945.219; n unique users 21873 n pro users 19541\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_v32 requests 55942 clips 111884 total khrs 4.361; N gpus for 1000 iters 6.993; 4 gpus for x iters 1748.188; n unique users 20808 n pro users 20271\n",
    "# 30b_t6_v33 requests 182096 clips 364192 total khrs 13.745; N gpus for 1000 iters 22.762; 4 gpus for x iters 5690.500; n unique users 40437 n pro users 34524\n",
    "# 30b_t6_v34 requests 182096 clips 364192 total khrs 13.745; N gpus for 1000 iters 22.762; 4 gpus for x iters 5690.500; n unique users 40437 n pro users 34524\n",
    "# 30b_t6_v35 requests 62247 clips 124494 total khrs 1.090; N gpus for 1000 iters 7.781; 4 gpus for x iters 1945.219; n unique users 21873 n pro users 19541"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.277006Z",
     "start_time": "2024-05-16T13:59:41.252105Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:15.729911Z",
     "iopub.status.busy": "2025-03-20T20:24:15.729740Z",
     "iopub.status.idle": "2025-03-20T20:24:15.903147Z",
     "shell.execute_reply": "2025-03-20T20:24:15.902501Z",
     "shell.execute_reply.started": "2025-03-20T20:24:15.729894Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "positive in playlist (10144, 154)\n",
      "task\n",
      "infill          124422\n",
      "infill_intro        72\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": 23,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:15.904002Z",
     "iopub.status.busy": "2025-03-20T20:24:15.903831Z",
     "iopub.status.idle": "2025-03-20T20:24:16.096590Z",
     "shell.execute_reply": "2025-03-20T20:24:16.096007Z",
     "shell.execute_reply.started": "2025-03-20T20:24:15.903985Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAGdCAYAAAAMm0nCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA4j0lEQVR4nO3df3RU9Z3/8dfcSQKR/CAkAUSopYkEaswP1E0TB6mulK5oz0Z2S1ZahcMRWkVyKvJjUzQEaBIQu4C6hY0sCkJTVpD6i/XU1lo8CaJuIg1FJFI1Nm3zQyAJaH7NfP/gm2smhGQmZDJzk+fjnBwy937m3s99507y4nN/2Vwul0sAAAAWYvi7AwAAAN4iwAAAAMshwAAAAMshwAAAAMshwAAAAMshwAAAAMshwAAAAMshwAAAAMshwAAAAMshwAAAAMsJ8ncHfK2+vlED+bAEm02Kjg4f8PVaDXXyDHXyDHXqHTXyDHXyjC/r1LHs3gz6AONyyS87ob/WazXU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eq6FOnhlsdfLVdgy2OvkCNfIMdfKML+vk6TL7HGBef/11NTY2KjMzU5JUV1en4OBgRUREuLWLjo5WbW2t2aZzeJFkvu6tTVNTk7788ksNHz7cq35GR4d71b6/+Gu9VkOdPDMY6hQVNcLn6xgMdfI1auQZ6uQZf9apzwFm3759uvnmmzVmzJj+7E+/q69vlGsA715us134gQ70eq2GOnkm0OtktxseB5PTp8+pvd3pk34Eep0CATXyDHXyjC/r1LHs3vQpwPzlL39RSUmJnnjiCXNaTEyMWltb1dDQ4DYKU19fr9jYWLPN0aNH3ZbVcZVS5zZdr1yqq6tTWFiY16MvkuRyyS87ob/WazXUyTODpU6+3obBUidfokaeoU6e8Wed+nQfmP379ys6Olrf/va3zWmJiYkKDg5WaWmpOe3UqVOqrq5WSkqKJCklJUUffvih6uvrzTYlJSUKCwtTfHy82ebw4cNu6yspKTGXAQAA4HWAcTqd2r9/v/75n/9ZQUFfDeCEh4dr9uzZKiws1OHDh1VRUaGcnBylpqaa4cPhcCg+Pl7Lly/XBx98oEOHDmnTpk2aO3euQkJCJElZWVmqqqrShg0b9NFHH2n37t06ePCg5s2b1y8bDAAArM/rQ0glJSWqrq7W7NmzL5qXk5MjwzC0ZMkStbS0yOFwKDc315xvt9u1detWrV69WnPmzFFoaKgyMzO1ZMkSs82ECRO0bds2FRQUaOfOnRo7dqzWrVvHPWAAAIDJ6wDjcDh04sSJbucNGzZMubm5bqGlq6uuukpFRUU9riMtLU0HDhzwtmsAAGCI4FlIAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcrwOMH//+9/18MMPKy0tTUlJSbrzzjv1xz/+0Zzvcrm0efNmORwOJS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arYpKSnRxIkTvTp8BAAABievAsy9996r999/X1u3btUnn3yil156SXv37tXdd98tSbLZbLrnnnv0i1/8Qr/97W914sQJLV++XKNHjzavSoqLi9O0adP0yCOP6OjRo3rvvfe0du1azZo1S2PGjJEk3XnnnQoODtZPf/pTnTx5Uq+++qp27typ+fPn9/PmAwAAK/LqEFJSUpKefPJJ/fznP9dTTz2l8ePHKycnR9/73vfMNvfdd5+++OILPfroo2poaND111+vp59+WsOGDTPbbNy4UWvXrtW9994rwzD0ne98R6tWrTLnh4eHa/v27VqzZo3uuusuRUVF6f777+cSagAAIMnLACNJt9xyi2655ZZLzrfZbMrOzlZ2dvYl24wcOVKPP/54j+uZPHmy9uzZ4233AADAEMCzkAAAgOUQYAAAgOUQYAAAgOV4fQ4MYAWGYZNhuN+P2ul0yenkxg4AMBgQYDDoGIZNkSOvUJDdfYCxrd2ps2fOE2IAYBAgwGDQMQybguyGsovLVFnTJEmKHx2mzVmpMgwbAQYABgECDAatypomHatu8Hc3AAA+wEm8AADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcggwAADAcrwKME888YQSEhLcvr773e+a85ubm5WXl6e0tDSlpqbqwQcfVF1dndsyqqurtXDhQiUnJys9PV3r169XW1ubW5u3335bmZmZSkxM1IwZM7R///7L2EQAADDYBHn7hmuuuUY7duwwX9vtdvP7/Px8vfnmm9q0aZPCw8O1du1aLV68WMXFxZKk9vZ2LVq0SDExMSouLlZNTY1WrFih4OBgPfTQQ5KkqqoqLVq0SFlZWdq4caNKS0u1atUqxcbGatq0aZe7vQAAYBDwOsDY7XbFxsZeNL2xsVH79u3Txo0blZ6eLulCoLn99ttVXl6ulJQUvfXWW6qsrNSOHTsUExOjKVOmKDs7Wxs3btTixYsVEhKi4uJ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AQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFgOAQYAAFjO/wOe0gq5uSNcEQAAAABJRU5ErkJggg==",
      "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": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.323409Z",
     "start_time": "2024-05-16T13:59:41.278278Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.097392Z",
     "iopub.status.busy": "2025-03-20T20:24:16.097234Z",
     "iopub.status.idle": "2025-03-20T20:24:16.112785Z",
     "shell.execute_reply": "2025-03-20T20:24:16.112275Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.097376Z"
    }
   },
   "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": 25,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.392244Z",
     "start_time": "2024-05-16T13:59:41.324472Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.113509Z",
     "iopub.status.busy": "2025-03-20T20:24:16.113362Z",
     "iopub.status.idle": "2025-03-20T20:24:16.125183Z",
     "shell.execute_reply": "2025-03-20T20:24:16.124673Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.113494Z"
    }
   },
   "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": 26,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.125907Z",
     "iopub.status.busy": "2025-03-20T20:24:16.125754Z",
     "iopub.status.idle": "2025-03-20T20:24:16.137273Z",
     "shell.execute_reply": "2025-03-20T20:24:16.136777Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.125893Z"
    }
   },
   "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": 27,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.137974Z",
     "iopub.status.busy": "2025-03-20T20:24:16.137830Z",
     "iopub.status.idle": "2025-03-20T20:24:16.149347Z",
     "shell.execute_reply": "2025-03-20T20:24:16.148849Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.137961Z"
    }
   },
   "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": 28,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.150179Z",
     "iopub.status.busy": "2025-03-20T20:24:16.149875Z",
     "iopub.status.idle": "2025-03-20T20:24:16.161328Z",
     "shell.execute_reply": "2025-03-20T20:24:16.160821Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.150163Z"
    }
   },
   "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": 29,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.162018Z",
     "iopub.status.busy": "2025-03-20T20:24:16.161874Z",
     "iopub.status.idle": "2025-03-20T20:24:16.173437Z",
     "shell.execute_reply": "2025-03-20T20:24:16.172935Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.162004Z"
    }
   },
   "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": 30,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.174378Z",
     "iopub.status.busy": "2025-03-20T20:24:16.174003Z",
     "iopub.status.idle": "2025-03-20T20:24:16.185551Z",
     "shell.execute_reply": "2025-03-20T20:24:16.185036Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.174363Z"
    }
   },
   "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": 31,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.186283Z",
     "iopub.status.busy": "2025-03-20T20:24:16.186139Z",
     "iopub.status.idle": "2025-03-20T20:24:16.197880Z",
     "shell.execute_reply": "2025-03-20T20:24:16.197373Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.186269Z"
    }
   },
   "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": 32,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.198583Z",
     "iopub.status.busy": "2025-03-20T20:24:16.198437Z",
     "iopub.status.idle": "2025-03-20T20:24:16.210321Z",
     "shell.execute_reply": "2025-03-20T20:24:16.209808Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.198570Z"
    }
   },
   "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": 33,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.211020Z",
     "iopub.status.busy": "2025-03-20T20:24:16.210880Z",
     "iopub.status.idle": "2025-03-20T20:24:16.222443Z",
     "shell.execute_reply": "2025-03-20T20:24:16.221937Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.211007Z"
    }
   },
   "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": 34,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2025-03-20T20:24:16.223115Z",
     "iopub.status.busy": "2025-03-20T20:24:16.222977Z",
     "iopub.status.idle": "2025-03-20T20:24:16.237166Z",
     "shell.execute_reply": "2025-03-20T20:24:16.236608Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.223101Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "is_public\n",
      "False    124441\n",
      "True         53\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(df_slice[\"is_public\"].value_counts())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T14:00:20.866354Z",
     "start_time": "2024-05-16T14:00:12.443344Z"
    },
    "execution": {
     "iopub.execute_input": "2025-03-20T20:27:49.687447Z",
     "iopub.status.busy": "2025-03-20T20:27:49.686995Z",
     "iopub.status.idle": "2025-03-20T20:28:04.487710Z",
     "shell.execute_reply": "2025-03-20T20:28:04.486910Z",
     "shell.execute_reply.started": "2025-03-20T20:27:49.687425Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(124494, 154)\n",
      "task\n",
      "infill          124422\n",
      "infill_intro        72\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[35], line 9\u001b[0m\n\u001b[1;32m      7\u001b[0m \u001b[38;5;28mprint\u001b[39m(df_slice\u001b[38;5;241m.\u001b[39mshape)\n\u001b[1;32m      8\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[0;32m----> 9\u001b[0m \u001b[43mBREAK\u001b[49m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'BREAK' is not defined"
     ]
    }
   ],
   "source": [
    "# df_slice.to_pickle(\n",
    "#     \"/home/tony/Data/Preference/30b_v6/interesting_clips_v4_h_t_6_20250227_full_long_slice.pkl\"\n",
    "# )\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": 36,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.932296Z",
     "start_time": "2024-05-16T13:59:41.932287Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.576185Z",
     "iopub.status.idle": "2025-03-20T20:24:16.576382Z",
     "shell.execute_reply": "2025-03-20T20:24:16.576291Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.576282Z"
    }
   },
   "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": 37,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.577057Z",
     "iopub.status.idle": "2025-03-20T20:24:16.577227Z",
     "shell.execute_reply": "2025-03-20T20:24:16.577148Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.577140Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(124494, 154)\n",
      "(124494, 154)\n",
      "(124494, 154)\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": 38,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.932966Z",
     "start_time": "2024-05-16T13:59:41.932957Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.577743Z",
     "iopub.status.idle": "2025-03-20T20:24:16.577916Z",
     "shell.execute_reply": "2025-03-20T20:24:16.577837Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.577828Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "62247\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": 39,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.933558Z",
     "start_time": "2024-05-16T13:59:41.933550Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.578560Z",
     "iopub.status.idle": "2025-03-20T20:24:16.578959Z",
     "shell.execute_reply": "2025-03-20T20:24:16.578858Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.578847Z"
    }
   },
   "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": 40,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.579328Z",
     "iopub.status.idle": "2025-03-20T20:24:16.579477Z",
     "shell.execute_reply": "2025-03-20T20:24:16.579409Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.579402Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_slice[\"continue_at\"] = -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.934277Z",
     "start_time": "2024-05-16T13:59:41.934268Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.579938Z",
     "iopub.status.idle": "2025-03-20T20:24:16.580095Z",
     "shell.execute_reply": "2025-03-20T20:24:16.580021Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.580014Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "61624 623\n",
      "(123248, 154) (1246, 154)\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": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.934954Z",
     "start_time": "2024-05-16T13:59:41.934946Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.580618Z",
     "iopub.status.idle": "2025-03-20T20:24:16.580770Z",
     "shell.execute_reply": "2025-03-20T20:24:16.580699Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.580690Z"
    }
   },
   "outputs": [],
   "source": [
    "# val_df[[\"request_id\", \"metadata\", \"updated_at\", \"user_id\", \"preference\"]].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.935620Z",
     "start_time": "2024-05-16T13:59:41.935613Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.581281Z",
     "iopub.status.idle": "2025-03-20T20:24:16.581446Z",
     "shell.execute_reply": "2025-03-20T20:24:16.581371Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.581363Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 123248/123248 [00:04<00:00, 28161.50it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1,079 hours of 123248 clips, 7.703 nodes, 1283.8333333333333 iters\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "total_duration = 0\n",
    "for i, row in tqdm(train_df.iterrows(), total=len(train_df)):\n",
    "    # we need to alternate between preference: neg, pos\n",
    "    # print(i, row)\n",
    "    try:\n",
    "        assert row[\"preference\"] == (i % 2 == 1)\n",
    "        total_duration += row[\"duration\"]\n",
    "    except Exception as E:\n",
    "        print(i, row)\n",
    "        print(E)\n",
    "        raise ValueError()\n",
    "\n",
    "print(\n",
    "    f\"{round(total_duration / 60 / 60):,} hours of {train_df.shape[0]} clips, {train_df.shape[0] / 8 / 2 / 1000} nodes, {train_df.shape[0] / 8 / 2 / 6} iters\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.936268Z",
     "start_time": "2024-05-16T13:59:41.936260Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.581914Z",
     "iopub.status.idle": "2025-03-20T20:24:16.582069Z",
     "shell.execute_reply": "2025-03-20T20:24:16.581996Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.581988Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t_data_memmap is set to: 6016\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1246/1246 [00:23<00:00, 53.47it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 1246 clips, 0 different prompts\n",
      "19 hours of False\n",
      "18 hours of True\n",
      "infill: 36.4 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": 46,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.582805Z",
     "iopub.status.idle": "2025-03-20T20:24:16.582967Z",
     "shell.execute_reply": "2025-03-20T20:24:16.582890Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.582883Z"
    }
   },
   "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": 47,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.936964Z",
     "start_time": "2024-05-16T13:59:41.936957Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.583517Z",
     "iopub.status.idle": "2025-03-20T20:24:16.583667Z",
     "shell.execute_reply": "2025-03-20T20:24:16.583598Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.583591Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t_data_memmap is set to: 6016\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  9%|▉         | 11349/123248 [03:27<29:58, 62.23it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "267042, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/e45c39ac-5e66-4f4b-8ba4-d553ffdf08d6.npz.\n",
      "WTF --> 267043, skip, preference: True, 90e6b53d-7a83-459f-8863-14dab1b7892e, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  9%|▉         | 11450/123248 [03:29<31:31, 59.10it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "269640, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/e42ccfec-693b-433c-a815-e97cfbf78b87.npz.\n",
      "WTF --> 269641, skip, preference: True, 35a5e3b0-3643-4339-a0bc-4598e079b7de, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 10%|▉         | 11958/123248 [03:38<29:33, 62.76it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "281726, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/8b282f67-0d39-4c96-9d83-ea7d1c3db7a4.npz.\n",
      "WTF --> 281727, skip, preference: True, 05bcb4e1-be23-49f9-8b2f-d496e16b0944, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 10%|█         | 12767/123248 [03:52<30:11, 61.00it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "301418, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4b8b4277-1b8d-44e5-8c07-5ed05f31786a.npz.\n",
      "WTF --> 301419, skip, preference: True, 8d2026fd-75d5-44ec-ba5a-49c4889b9664, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 11%|█         | 12955/123248 [03:55<31:44, 57.92it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "306448, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/c7a6c4cc-d4b5-459c-92ac-8350910a4200.npz.\n",
      "WTF --> 306449, skip, preference: True, 01d9944a-02f3-4789-b016-a5eaf70a2be2, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 11%|█▏        | 14115/123248 [04:16<30:18, 60.00it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "236164, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/2f176b3f-ef12-4179-aee5-556756deae58.npz.\n",
      "WTF --> 236165, skip, preference: True, 9a5c7e2c-2698-423a-9688-836fe9f78058, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 15%|█▍        | 18454/123248 [05:33<29:19, 59.55it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "434818, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/2c74927d-a411-4cf8-963a-ae1d446adcd5.npz.\n",
      "WTF --> 434819, skip, preference: True, bc8ee5e7-8a6f-4082-87d7-441a20d6920a, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 15%|█▌        | 18894/123248 [05:41<27:53, 62.37it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "446072, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/03a60051-0deb-4a9a-a890-59bf7334828a.npz.\n",
      "WTF --> 446073, skip, preference: True, c074f5d3-0875-4bf8-910d-03c715e11c2c, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 16%|█▌        | 19444/123248 [05:50<28:23, 60.95it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "460090, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/03df0f52-9ea5-44a2-b96d-d5f849bc4781.npz.\n",
      "WTF --> 460091, skip, preference: True, 7ff2d228-6c47-48e8-9d72-3de01d2a7df0, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 17%|█▋        | 20543/123248 [06:10<28:35, 59.87it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "345890, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/8dddfd98-f72b-47c5-a5b5-637e3e3f6e5a.npz.\n",
      "WTF --> 345891, skip, preference: True, 539f7741-6451-4eab-a55c-e32946a685ec, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 17%|█▋        | 20588/123248 [06:11<27:46, 61.59it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "346776, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/012190e5-f8ba-491e-a873-1af722d9d0ed.npz.\n",
      "WTF --> 346777, skip, preference: True, 8515d72b-d90a-4752-8b3f-7050219cd31c, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 17%|█▋        | 21412/123248 [06:25<26:20, 64.45it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "507616, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/0f167b33-4aa5-40d6-a29f-54605c594a6b.npz.\n",
      "WTF --> 507617, skip, preference: True, f9813bca-8804-4bcd-a1f6-88460f5a2366, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 18%|█▊        | 22718/123248 [06:47<26:44, 62.67it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "538500, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/1b348407-fe5d-428f-8080-0db5f559a14d.npz.\n",
      "WTF --> 538501, skip, preference: True, 26d5f282-db01-446b-af60-329bba4a8d38, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 20%|██        | 24765/123248 [07:23<26:10, 62.73it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "417078, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/22af1130-3df2-4798-87bf-d002d0e5bdb2.npz.\n",
      "WTF --> 417079, skip, preference: True, c25c2fac-5f9a-4a67-9f49-93dbc19c36d0, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 20%|██        | 25254/123248 [07:31<26:02, 62.72it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "600144, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/fa09c0f0-0ce4-4490-9cca-0d4902a8d879.npz.\n",
      "WTF --> 600145, skip, preference: True, 1103e243-e35c-4887-a748-04e9e1f2b8f7, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 21%|██        | 25311/123248 [07:32<26:02, 62.67it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "601146, '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 --> 601147, skip, preference: True, 56d334d0-0c43-46b0-b09b-eddab6f954e1, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 22%|██▏       | 26727/123248 [07:57<25:52, 62.16it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "633788, '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 --> 633789, skip, preference: True, eca9ad37-2945-49b3-b672-8a9073f8aef8, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 23%|██▎       | 28850/123248 [08:33<25:12, 62.41it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "485554, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/f23bf59e-143e-44ab-bb2c-749914a0015d.npz.\n",
      "WTF --> 485555, skip, preference: True, bf776438-653a-4a89-a9f4-1c230b31cc4d, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 24%|██▍       | 29469/123248 [08:44<25:18, 61.74it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "698740, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/b616162d-5ba3-4bd3-ad23-1821b0638dfb.npz.\n",
      "WTF --> 698741, skip, preference: True, e0e2e373-1c18-4fed-bd53-bff9e83bbfd9, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 25%|██▌       | 30848/123248 [09:07<24:34, 62.65it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "732012, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/ec745d69-2366-4a58-8478-ac891559dd96.npz.\n",
      "WTF --> 732013, skip, preference: True, 3f9f3465-e12a-4ac1-b700-afbcf39ea5d0, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 27%|██▋       | 33491/123248 [10:19<23:15, 64.33it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "797278, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a855b474-ff2e-496e-a794-ef240760eae4.npz.\n",
      "WTF --> 797279, skip, preference: True, b6dc68fa-f048-4432-860c-1b88d0645306, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 27%|██▋       | 33812/123248 [10:25<24:42, 60.32it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "804184, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/ded922d9-1f6a-45ac-b229-94805103470f.npz.\n",
      "WTF --> 804185, skip, preference: True, 1a0fcb2f-d8fc-40e5-8e94-4f176516aaaf, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 30%|███       | 37106/123248 [11:25<23:02, 62.32it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "880106, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/3218f11c-e7a7-4832-b2e6-253a8990b11e.npz.\n",
      "WTF --> 880107, skip, preference: True, d9e9f67e-d61b-4078-a006-f47c18bac6d1, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 30%|███       | 37260/123248 [11:28<22:33, 63.55it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "884132, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/111af734-aab3-4b4e-84eb-f8633f34ba10.npz.\n",
      "WTF --> 884133, skip, preference: True, e42fdf32-c1d0-4918-a064-93c980f8c5cc, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 31%|███       | 38244/123248 [11:46<22:40, 62.47it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "907928, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/07ccc1e4-0941-4961-9ad1-a76b1468d1cf.npz.\n",
      "WTF --> 907929, skip, preference: True, a18029dd-961b-4843-be98-4cceef863abd, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 32%|███▏      | 39049/123248 [12:05<22:08, 63.37it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "928890, '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 --> 928891, skip, preference: True, d41ba42d-e133-4b3e-8689-e6ad5eef51dd, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 32%|███▏      | 40042/123248 [12:22<22:20, 62.08it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "954156, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/62c96d47-3b0d-4df8-8a88-39b298bc6c37.npz.\n",
      "WTF --> 954157, skip, preference: True, 719354be-a261-4682-908f-5027b686d8e3, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 41%|████      | 50524/123248 [15:45<19:15, 62.95it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1208532, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4b528cdc-35f9-4771-b9a0-0fd01df03444.npz.\n",
      "WTF --> 1208533, skip, preference: True, 774d13a4-5254-43d5-82ae-366bc5c30a81, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 41%|████▏     | 51025/123248 [15:54<20:36, 58.41it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1221256, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4809e637-e5e2-432e-91c0-1f9102e4b97f.npz.\n",
      "WTF --> 1221257, skip, preference: True, e6019ae0-68d6-41f7-b8ba-e98c65d30e04, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 49%|████▉     | 60661/123248 [19:41<16:21, 63.78it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1449406, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/aff63273-3b91-4550-87d4-e03291ed90dc.npz.\n",
      "WTF --> 1449407, skip, preference: True, 849194aa-eb75-4869-85ae-c42253ee3629, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 51%|█████     | 62504/123248 [20:12<16:37, 60.89it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1495592, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/bf756fd9-5bf1-4e54-b4e9-00673f772d51.npz.\n",
      "WTF --> 1495593, skip, preference: True, 5bfb5599-f1cc-4639-9a19-0ebfe773331f, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 51%|█████     | 62682/123248 [20:15<16:12, 62.25it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1499854, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/15490ee6-f701-4d02-9904-8cf2f703349d.npz.\n",
      "WTF --> 1499855, skip, preference: True, 6bc6f973-6945-4dc6-8995-9ab5771069c7, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 54%|█████▍    | 66381/123248 [21:22<14:57, 63.38it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1589074, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/aecaca0d-24ee-40f4-be04-ac9bfcfec3bf.npz.\n",
      "WTF --> 1589075, skip, preference: True, acbca1bb-484b-4bb0-937a-8a0902095730, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 55%|█████▌    | 68099/123248 [21:51<15:01, 61.14it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1629514, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/66b09f9f-7e30-426d-8a31-d26d91f25ec0.npz.\n",
      "WTF --> 1629515, skip, preference: True, 75840620-6987-4e09-b060-79f369850298, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 56%|█████▌    | 68518/123248 [21:58<14:25, 63.20it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1639618, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/f8d2467d-3f92-4d4d-8d59-7d9517a33fcc.npz.\n",
      "WTF --> 1639619, skip, preference: True, 9dad199e-e573-4f2e-8040-2498a638297e, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 56%|█████▋    | 69608/123248 [22:17<14:23, 62.12it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1665454, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/42312d6c-fa1d-4b5c-80ed-2bbeb39c2869.npz.\n",
      "WTF --> 1665455, skip, preference: True, 9341ad47-7b08-4d61-9a28-734fc6a1a37c, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 58%|█████▊    | 71327/123248 [22:47<13:54, 62.19it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1708162, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/57f69434-ca7b-4815-b1ef-43b2c9fc13a6.npz.\n",
      "WTF --> 1708163, skip, preference: True, 26bdbd4c-b761-4474-9ef5-603ce90f3520, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 59%|█████▊    | 72311/123248 [23:04<13:12, 64.27it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1732146, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/40c4f04c-3ee8-4e52-b171-3acff70ed0bf.npz.\n",
      "WTF --> 1732147, skip, preference: True, ebac32eb-e986-43cc-9095-4d50f05748df, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 60%|█████▉    | 73544/123248 [23:25<13:27, 61.58it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1760520, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/de80ade6-a6a4-4fa3-92a7-4d64d4d41a10.npz.\n",
      "WTF --> 1760521, skip, preference: True, 4ebbf909-8190-4d92-847f-86788357b0e9, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 61%|██████    | 75030/123248 [23:52<12:52, 62.45it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1795670, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/fa3cfa42-18c6-400a-9dcc-c4f88e695072.npz.\n",
      "WTF --> 1795671, skip, preference: True, 5320f788-77ed-44c6-8618-ce060162b6e7, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 61%|██████    | 75210/123248 [23:55<12:57, 61.81it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1799908, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/bf8372dd-0d5b-4a7c-8b4b-fb793e8edb14.npz.\n",
      "WTF --> 1799909, skip, preference: True, 70c998a5-c5a5-46dd-84cd-c28081d38b9f, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 62%|██████▏   | 76304/123248 [24:14<12:35, 62.13it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1825206, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a8b14db3-0cd2-43eb-ab49-f0299538b0cb.npz.\n",
      "WTF --> 1825207, skip, preference: True, 9c36744b-bd71-4dbb-992d-60853a889544, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 63%|██████▎   | 77556/123248 [24:38<12:13, 62.25it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1853810, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/fb6a54a1-1a1f-4ab6-a2a1-5975a0ef1a66.npz.\n",
      "WTF --> 1853811, skip, preference: True, 8567a22d-33ad-4240-9b12-6b89be6ce804, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 63%|██████▎   | 77935/123248 [24:45<13:04, 57.79it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1863158, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/8baa060d-914b-4045-b826-bf96bc48493c.npz.\n",
      "WTF --> 1863159, skip, preference: True, d415ba4b-38dd-44e0-9c0e-365e81b37389, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 64%|██████▍   | 78639/123248 [24:58<37:08, 20.02it/s]  "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1881510, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4d5be30b-404c-4f1d-8ebd-5c4661ca819f.npz.\n",
      "WTF --> 1881511, skip, preference: True, f5253d4c-ef09-4215-9e03-60df4b4256c9, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 65%|██████▍   | 80062/123248 [25:23<11:18, 63.63it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1915486, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a5254c3a-9a52-4667-920c-b2da59899873.npz.\n",
      "WTF --> 1915487, skip, preference: True, 9391fef0-296e-4bbf-b355-46d1b6bbea53, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 66%|██████▋   | 81783/123248 [25:54<11:00, 62.81it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1957544, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/b3583555-fa44-46a2-83a5-7b245d8fe73e.npz.\n",
      "WTF --> 1957545, skip, preference: True, f6308203-26b2-4aed-b442-f683cbf2fe35, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 68%|██████▊   | 84030/123248 [26:34<10:55, 59.79it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2013968, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/cffae1e3-5a05-4db1-b59b-c3d4c1562e63.npz.\n",
      "WTF --> 2013969, skip, preference: True, 5f9aad87-4c21-4610-8d31-b3f3a8d68c4d, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 71%|███████   | 87151/123248 [27:27<09:42, 61.97it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1486796, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/233c39fd-7a7c-4484-9f12-e8132061a41d.npz.\n",
      "WTF --> 1486797, skip, preference: True, d984ee29-f547-44f8-837b-999308310e6b, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 71%|███████   | 87309/123248 [27:29<09:25, 63.50it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2093420, '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 --> 2093421, skip, preference: True, 834fc805-5871-460c-bda6-3e5af927f12f, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 73%|███████▎  | 89580/123248 [28:10<08:47, 63.87it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2150100, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/9008be67-a795-402f-9f31-f5cf8cfcb052.npz.\n",
      "WTF --> 2150101, skip, preference: True, b894bc6c-1086-450d-9590-04756806c325, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 82%|████████▏ | 101563/123248 [31:37<05:54, 61.18it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2434376, '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 --> 2434377, skip, preference: True, f7113fe5-afd6-4e50-a429-2bb41ea2a076, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 83%|████████▎ | 102564/123248 [31:54<05:30, 62.62it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2456824, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/4cb4a6de-e7b2-4349-9ad8-465603d23540.npz.\n",
      "WTF --> 2456825, skip, preference: True, ec028870-4395-4429-ba17-1063b0de5c7e, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 85%|████████▌ | 104764/123248 [32:31<05:03, 60.95it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2509570, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/7bacbcb7-8260-4496-b8cc-c4d4db6cc0ab.npz.\n",
      "WTF --> 2509571, skip, preference: True, c59cf741-2abd-4ccd-bad0-4e41d4b1b109, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 85%|████████▌ | 105030/123248 [32:36<04:45, 63.79it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2516078, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/179dbb0b-aaa5-4c54-a294-27973477c1ff.npz.\n",
      "WTF --> 2516079, skip, preference: True, 846a0d37-557a-473d-9b02-cddd81853ea8, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 85%|████████▌ | 105190/123248 [32:38<04:41, 64.13it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2520812, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/c8bd425a-bc76-429c-8865-7211598a54ed.npz.\n",
      "WTF --> 2520813, skip, preference: True, 42bd4e79-1852-4814-8456-ee0a79c192fa, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 85%|████████▌ | 105360/123248 [32:41<04:42, 63.24it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2525456, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/6bbec2f1-a856-42a8-add8-8dcf7d2bb4b0.npz.\n",
      "WTF --> 2525457, skip, preference: True, a87dcde8-09ff-478d-a0f4-2f2865f7a8cf, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 88%|████████▊ | 108319/123248 [33:35<03:55, 63.30it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2594272, '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 --> 2594273, skip, preference: True, 51cdbfc3-34b0-47c0-983a-0186798d6600, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 88%|████████▊ | 108729/123248 [33:42<03:45, 64.27it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2603978, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/fabd0673-c394-42c1-8518-61b3ae66145a.npz.\n",
      "WTF --> 2603979, skip, preference: True, 1b09d9dc-fe0a-494b-9c3b-f8c5049d8aa5, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 90%|████████▉ | 110922/123248 [34:19<03:14, 63.22it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2655388, 'full_arr is not a file in the archive', infill_intro, /app/suno/data/dpo/30b_npz/14847c82-4900-4516-9440-96b2815cde2d.npz.\n",
      "WTF --> 2655389, skip, preference: True, d778ef28-1f97-4a72-9d2c-438f06c98a65, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 90%|█████████ | 111502/123248 [34:28<03:06, 62.83it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2669688, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/308b4091-32b7-4bee-846f-0e4dab37f7a5.npz.\n",
      "WTF --> 2669689, skip, preference: True, bc432aa2-cc98-4168-bd65-ee77f2f072c1, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 92%|█████████▏| 113410/123248 [35:01<02:41, 60.79it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2716330, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/a434fa5e-28c7-4ea5-820b-21b7e5d752d2.npz.\n",
      "WTF --> 2716331, skip, preference: True, dd0a7265-cb21-4bf3-a0f4-977e7ab7dc5a, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 92%|█████████▏| 113710/123248 [35:06<02:35, 61.47it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2724626, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/9c66727a-7134-46b5-abaf-de360a1572e6.npz.\n",
      "WTF --> 2724627, skip, preference: True, 0801c575-8563-4975-8fad-b2f5b42631db, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 92%|█████████▏| 113805/123248 [35:07<02:36, 60.21it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2727010, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/9c7c42e6-2733-4cf3-86e2-c476043040a5.npz.\n",
      "WTF --> 2727011, skip, preference: True, 7eb6796a-3265-4f59-ace4-c8ffd5ecab50, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 93%|█████████▎| 115131/123248 [35:31<02:26, 55.45it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2757990, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/aaeea91d-5c9a-46db-9c32-6ba3f1e3c377.npz.\n",
      "WTF --> 2757991, skip, preference: True, 77f7d5fc-6b50-4994-9e6b-6311b5a2c1ef, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 94%|█████████▎| 115534/123248 [35:38<02:02, 62.82it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2766994, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/6d8920ec-8682-492e-8126-640b5d6bede1.npz.\n",
      "WTF --> 2766995, skip, preference: True, 92606537-ccbd-42d6-bd4b-bf0c49dfe523, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 96%|█████████▌| 118389/123248 [36:26<01:18, 61.66it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2831896, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/425d7085-f2f4-46bc-83a1-6b9182629c62.npz.\n",
      "WTF --> 2831897, skip, preference: True, 66c7ba7e-0fdc-4477-ad21-cfaaf97f9c36, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 96%|█████████▋| 118860/123248 [36:34<01:07, 64.58it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2843638, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/4b70a815-c60c-4446-9ee1-0f837977551a.npz.\n",
      "WTF --> 2843639, skip, preference: True, a73e3a5c-901b-4fe5-98ed-209291335d5c, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 98%|█████████▊| 121106/123248 [37:13<00:33, 64.00it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2062828, 'full_arr is not a file in the archive', infill, /app/suno/data/dpo/30b_npz/9ab4b856-e426-4ffe-96c4-b9d19b8504bc.npz.\n",
      "WTF --> 2062829, skip, preference: True, 67f1bef1-b8b7-4eca-bd9f-500761f5cbeb, task: infill.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 98%|█████████▊| 121164/123248 [37:14<00:32, 65.10it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2896722, '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 --> 2896723, skip, preference: True, 629f376f-7621-4a7f-bbc6-a2c72d564e56, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      " 99%|█████████▉| 121743/123248 [37:23<00:23, 65.37it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2910744, '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 --> 2910745, skip, preference: True, ab046f04-12f8-4374-99c7-7c5ab8c1d918, task: infill_intro.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 123248/123248 [37:52<00:00, 54.24it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 123106 clips, 0 different prompts\n",
      "1,830 hours of False\n",
      "1,751 hours of True\n",
      "infill: 3581.5 hours\n",
      "🚨 Error infill: 60\n",
      "🚨 Error infill_intro: 11\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": 48,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.937879Z",
     "start_time": "2024-05-16T13:59:41.937870Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.584153Z",
     "iopub.status.idle": "2025-03-20T20:24:16.584309Z",
     "shell.execute_reply": "2025-03-20T20:24:16.584235Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.584228Z"
    }
   },
   "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": 49,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.584819Z",
     "iopub.status.idle": "2025-03-20T20:24:16.584970Z",
     "shell.execute_reply": "2025-03-20T20:24:16.584898Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.584891Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Counter({'infill': 1246})\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": 50,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.938629Z",
     "start_time": "2024-05-16T13:59:41.938621Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.585492Z",
     "iopub.status.idle": "2025-03-20T20:24:16.585641Z",
     "shell.execute_reply": "2025-03-20T20:24:16.585573Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.585565Z"
    }
   },
   "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": 51,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.939205Z",
     "start_time": "2024-05-16T13:59:41.939198Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.586546Z",
     "iopub.status.idle": "2025-03-20T20:24:16.586724Z",
     "shell.execute_reply": "2025-03-20T20:24:16.586636Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.586628Z"
    }
   },
   "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": 52,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.939977Z",
     "start_time": "2024-05-16T13:59:41.939969Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.587036Z",
     "iopub.status.idle": "2025-03-20T20:24:16.587186Z",
     "shell.execute_reply": "2025-03-20T20:24:16.587113Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.587106Z"
    }
   },
   "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": 53,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.940610Z",
     "start_time": "2024-05-16T13:59:41.940603Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.587651Z",
     "iopub.status.idle": "2025-03-20T20:24:16.587794Z",
     "shell.execute_reply": "2025-03-20T20:24:16.587726Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.587720Z"
    }
   },
   "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": 54,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.941167Z",
     "start_time": "2024-05-16T13:59:41.941159Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.588318Z",
     "iopub.status.idle": "2025-03-20T20:24:16.588472Z",
     "shell.execute_reply": "2025-03-20T20:24:16.588401Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.588394Z"
    }
   },
   "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": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.941801Z",
     "start_time": "2024-05-16T13:59:41.941793Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.589012Z",
     "iopub.status.idle": "2025-03-20T20:24:16.589165Z",
     "shell.execute_reply": "2025-03-20T20:24:16.589095Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.589088Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "623 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": 56,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.942520Z",
     "start_time": "2024-05-16T13:59:41.942511Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.589697Z",
     "iopub.status.idle": "2025-03-20T20:24:16.589847Z",
     "shell.execute_reply": "2025-03-20T20:24:16.589779Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.589771Z"
    }
   },
   "outputs": [],
   "source": [
    "train_info = read_json(os.path.join(OUT_DATA_DIR, f\"info_tr.json\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.943072Z",
     "start_time": "2024-05-16T13:59:41.943065Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.590471Z",
     "iopub.status.idle": "2025-03-20T20:24:16.590624Z",
     "shell.execute_reply": "2025-03-20T20:24:16.590552Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.590545Z"
    }
   },
   "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": 58,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.944246Z",
     "start_time": "2024-05-16T13:59:41.944237Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.590959Z",
     "iopub.status.idle": "2025-03-20T20:24:16.591116Z",
     "shell.execute_reply": "2025-03-20T20:24:16.591041Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.591033Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total samples 123106 (123248, 154)\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": 59,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.945249Z",
     "start_time": "2024-05-16T13:59:41.945241Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.591751Z",
     "iopub.status.idle": "2025-03-20T20:24:16.591911Z",
     "shell.execute_reply": "2025-03-20T20:24:16.591838Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.591830Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 epoch per batch 4, total 1923.53125\n"
     ]
    }
   ],
   "source": [
    "print(\"1 epoch per batch 4, total\", total_iters / 8 / 2 / 4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.945972Z",
     "start_time": "2024-05-16T13:59:41.945964Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.592475Z",
     "iopub.status.idle": "2025-03-20T20:24:16.592628Z",
     "shell.execute_reply": "2025-03-20T20:24:16.592557Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.592549Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Submitted batch job 5086\n"
     ]
    }
   ],
   "source": [
    "!cd /home/tony/Work/tony/slurm/30b_dpo && sbatch sbatch_ipo_30b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.593100Z",
     "iopub.status.idle": "2025-03-20T20:24:16.593451Z",
     "shell.execute_reply": "2025-03-20T20:24:16.593371Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.593363Z"
    }
   },
   "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_13b_v4_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": 62,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T13:59:41.946562Z",
     "start_time": "2024-05-16T13:59:41.946555Z"
    },
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.594007Z",
     "iopub.status.idle": "2025-03-20T20:24:16.594168Z",
     "shell.execute_reply": "2025-03-20T20:24:16.594092Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.594085Z"
    }
   },
   "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": 63,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.594741Z",
     "iopub.status.idle": "2025-03-20T20:24:16.594898Z",
     "shell.execute_reply": "2025-03-20T20:24:16.594827Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.594820Z"
    }
   },
   "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": 64,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.595472Z",
     "iopub.status.idle": "2025-03-20T20:24:16.595620Z",
     "shell.execute_reply": "2025-03-20T20:24:16.595552Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.595545Z"
    }
   },
   "outputs": [],
   "source": [
    "# train_metas = read_jsonl(os.path.join(OUT_DATA_DIR, f\"meta_tr.jsonl\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2025-03-20T20:24:16.596229Z",
     "iopub.status.idle": "2025-03-20T20:24:16.596383Z",
     "shell.execute_reply": "2025-03-20T20:24:16.596311Z",
     "shell.execute_reply.started": "2025-03-20T20:24:16.596303Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['perference_0', 'perference_1'])"
      ]
     },
     "execution_count": 65,
     "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
}
