CoolFace
Apppublic

wisternhunter/Custom_Youtube_Algorithm

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
hf_space2.ipynb149 linesDownload Raw Back to root
1{2 "cells": [3  {4   "cell_type": "code",5   "execution_count": 7,6   "metadata": {},7   "outputs": [8    {9     "data": {10      "application/vnd.jupyter.widget-view+json": {11       "model_id": "68716bf0c6534512aa0e010ae73e1546",12       "version_major": 2,13       "version_minor": 014      },15      "text/plain": [16       "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"17      ]18     },19     "metadata": {},20     "output_type": "display_data"21    }22   ],23   "source": [24    "from huggingface_hub import notebook_login\n",25    " \n",26    "notebook_login()"27   ]28  },29  {30   "cell_type": "code",31   "execution_count": 12,32   "metadata": {},33   "outputs": [34    {35     "data": {36      "text/plain": [37       "RepoUrl('https://huggingface.co/Soran/CLIP_LoRA_SimCSE', endpoint='https://huggingface.co', repo_type='model', repo_id='Soran/CLIP_LoRA_SimCSE')"38      ]39     },40     "execution_count": 12,41     "metadata": {},42     "output_type": "execute_result"43    }44   ],45   "source": [46    "from huggingface_hub import create_repo\n",47    " \n",48    "# Repository 생성\n",49    "REPO_NAME = 'CLIP_LoRA_SimCSE'\n",50    "create_repo('CLIP_LoRA_SimCSE')\n",51    "\n",52    "# , repo_type='model', repo_id='Soran/CLIP_LoRA_SimCSE')"53   ]54  },55  {56   "cell_type": "code",57   "execution_count": 15,58   "metadata": {},59   "outputs": [60    {61     "name": "stderr",62     "output_type": "stream",63     "text": [64      "Cloning https://huggingface.co/Soran/CLIP_LoRA_SimCSE into local empty directory.\n"65     ]66    }67   ],68   "source": [69    "from huggingface_hub import Repository\n",70    "\n",71    "repo = Repository('/Users/juniverse/Desktop/pointcloud/huggingface_space/model', clone_from='Soran/CLIP_LoRA_SimCSE')"72   ]73  },74  {75   "cell_type": "code",76   "execution_count": null,77   "metadata": {},78   "outputs": [],79   "source": [80    "!cp -r model/* /Users/juniverse/Desktop/pointcloud/huggingface_space/model"81   ]82  },83  {84   "cell_type": "code",85   "execution_count": 19,86   "metadata": {},87   "outputs": [],88   "source": [89    "\n",90    "# repo.git_add()\n",91    "# repo.git_commit('Initial commit')\n",92    "# repo.git_push()\n",93    "\n"94   ]95  },96  {97   "cell_type": "code",98   "execution_count": 22,99   "metadata": {},100   "outputs": [101    {102     "ename": "TypeError",103     "evalue": "upload_file() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given",104     "output_type": "error",105     "traceback": [106      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",107      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",108      "\u001b[1;32m/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb 셀 6\u001b[0m line \u001b[0;36m4\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mhuggingface_hub\u001b[39;00m \u001b[39mimport\u001b[39;00m upload_file, delete_file\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=1'>2</a>\u001b[0m \u001b[39m# LOCAL_FILE_PATH =  '/Users/juniverse/Downloads/CLIP_LoRA_CSE_15.pt'\u001b[39;00m\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=2'>3</a>\u001b[0m \u001b[39m# 파일을 직접 업로드\u001b[39;00m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=3'>4</a>\u001b[0m upload_file(\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=4'>5</a>\u001b[0m     \u001b[39m'\u001b[39;49m\u001b[39m/Users/juniverse/Downloads/CLIP_LoRA_CSE_15.pt\u001b[39;49m\u001b[39m'\u001b[39;49m,\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=5'>6</a>\u001b[0m     path_in_repo\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39m./model\u001b[39;49m\u001b[39m'\u001b[39;49m,\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=6'>7</a>\u001b[0m     repo_id\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39mSoran/CLIP_LoRA_SimCSE\u001b[39;49m\u001b[39m'\u001b[39;49m,\n\u001b[1;32m      <a href='vscode-notebook-cell:/Users/juniverse/Desktop/pointcloud/huggingface_space/Custom_Youtube_Algorithm/test.ipynb#W5sZmlsZQ%3D%3D?line=7'>8</a>\u001b[0m )\n",109      "File \u001b[0;32m~/opt/anaconda3/envs/veda/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py:118\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m    115\u001b[0m \u001b[39mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m    116\u001b[0m     kwargs \u001b[39m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[39m=\u001b[39mfn\u001b[39m.\u001b[39m\u001b[39m__name__\u001b[39m, has_token\u001b[39m=\u001b[39mhas_token, kwargs\u001b[39m=\u001b[39mkwargs)\n\u001b[0;32m--> 118\u001b[0m \u001b[39mreturn\u001b[39;00m fn(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n",110      "File \u001b[0;32m~/opt/anaconda3/envs/veda/lib/python3.8/site-packages/huggingface_hub/hf_api.py:849\u001b[0m, in \u001b[0;36mfuture_compatible.<locals>._inner\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m    846\u001b[0m     \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mrun_as_future(fn, \u001b[39mself\u001b[39m, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m    848\u001b[0m \u001b[39m# Otherwise, call the function normally\u001b[39;00m\n\u001b[0;32m--> 849\u001b[0m \u001b[39mreturn\u001b[39;00m fn(\u001b[39mself\u001b[39;49m, \u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n",111      "\u001b[0;31mTypeError\u001b[0m: upload_file() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given"112     ]113    }114   ],115   "source": [116    "from huggingface_hub import upload_file, delete_file\n",117    "# LOCAL_FILE_PATH =  '/Users/juniverse/Downloads/CLIP_LoRA_CSE_15.pt'\n",118    "# 파일을 직접 업로드\n",119    "upload_file(\n",120    "    '/Users/juniverse/Downloads/CLIP_LoRA_CSE_15.pt',\n",121    "    path_in_repo='./model',\n",122    "    repo_id='Soran/CLIP_LoRA_SimCSE',\n",123    ")"124   ]125  }126 ],127 "metadata": {128  "kernelspec": {129   "display_name": "veda",130   "language": "python",131   "name": "python3"132  },133  "language_info": {134   "codemirror_mode": {135    "name": "ipython",136    "version": 3137   },138   "file_extension": ".py",139   "mimetype": "text/x-python",140   "name": "python",141   "nbconvert_exporter": "python",142   "pygments_lexer": "ipython3",143   "version": "3.8.17"144  }145 },146 "nbformat": 4,147 "nbformat_minor": 2148}149