{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['/Users/goldpiggy/git/peel/peelml', '/Users/goldpiggy/anaconda3/envs/trl/lib/python310.zip', '/Users/goldpiggy/anaconda3/envs/trl/lib/python3.10', '/Users/goldpiggy/anaconda3/envs/trl/lib/python3.10/lib-dynload', '', '/Users/goldpiggy/anaconda3/envs/trl/lib/python3.10/site-packages', '/Users/goldpiggy/git/peel', '/var/folders/mb/7wp0k3g17jd11kk9xlv5mh3m0000gn/T/tmp6darbz0m', '/Users/goldpiggy/git/peel']\n"
     ]
    }
   ],
   "source": [
    "# Add the root folder to the module search path\n",
    "import os\n",
    "import sys\n",
    "root_folder = os.path.dirname(os.getcwd())\n",
    "sys.path.append(root_folder)\n",
    "print(sys.path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from peelml.rlhf.rlhf_trl import RLHFConfig, SFT\n",
    "# import peelml.rlhf.lingjie as lj"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ! torchrun --nnodes 1  --nproc_per_node 4 rlhf-trl/stack_llama/scripts/supervised_finetuning.py \\\n",
    "    # --model_path=rlhf-trl/llama-7b-hf-transformers-4.29 \\\n",
    "    # --streaming --no_gradient_checkpointing --learning_rate 1e-5 --max_steps 5000 --output_dir ./step1-llama-se\n",
    "\n",
    "config = RLHFConfig(\n",
    "    model_path=\"AlekseyKorshuk/vicuna-7b\",\n",
    "    dataset_name=\"lvwerra/stack-exchange-paired\",\n",
    "    streaming=True,\n",
    "    no_gradient_checkpointing=True,\n",
    "    learning_rate=1e-5,\n",
    "    max_steps=5000,\n",
    "    output_dir=\"../tests/\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NOTE: Redirects are currently not supported in Windows or MacOs.\n",
      "WARNING:torch.distributed.run:\n",
      "*****************************************\n",
      "Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. \n",
      "*****************************************\n",
      "/Users/goldpiggy/anaconda3/envs/trl/bin/python: can't open file '/Users/goldpiggy/git/peel/peelml/rlhf-trl/stack_llama/scripts/supervised_finetuning.py': [Errno 2] No such file or directory\n",
      "/Users/goldpiggy/anaconda3/envs/trl/bin/python: can't open file '/Users/goldpiggy/git/peel/peelml/rlhf-trl/stack_llama/scripts/supervised_finetuning.py': [Errno 2] No such file or directory\n",
      "/Users/goldpiggy/anaconda3/envs/trl/bin/python: can't open file '/Users/goldpiggy/git/peel/peelml/rlhf-trl/stack_llama/scripts/supervised_finetuning.py': [Errno 2] No such file or directory\n",
      "/Users/goldpiggy/anaconda3/envs/trl/bin/python: can't open file '/Users/goldpiggy/git/peel/peelml/rlhf-trl/stack_llama/scripts/supervised_finetuning.py': [Errno 2] No such file or directory\n",
      "^C\n",
      "WARNING:torch.distributed.elastic.agent.server.api:Received 2 death signal, shutting down workers\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "trl",
   "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.12"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
