File size: 7,350 Bytes
b3ecc60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "68716bf0c6534512aa0e010ae73e1546",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from huggingface_hub import notebook_login\n",
    " \n",
    "notebook_login()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RepoUrl('https://huggingface.co/Soran/CLIP_LoRA_SimCSE', endpoint='https://huggingface.co', repo_type='model', repo_id='Soran/CLIP_LoRA_SimCSE')"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from huggingface_hub import create_repo\n",
    " \n",
    "# Repository 생성\n",
    "REPO_NAME = 'CLIP_LoRA_SimCSE'\n",
    "create_repo('CLIP_LoRA_SimCSE')\n",
    "\n",
    "# , repo_type='model', repo_id='Soran/CLIP_LoRA_SimCSE')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Cloning https://huggingface.co/Soran/CLIP_LoRA_SimCSE into local empty directory.\n"
     ]
    }
   ],
   "source": [
    "from huggingface_hub import Repository\n",
    "\n",
    "repo = Repository('/Users/juniverse/Desktop/pointcloud/huggingface_space/model', clone_from='Soran/CLIP_LoRA_SimCSE')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!cp -r model/* /Users/juniverse/Desktop/pointcloud/huggingface_space/model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# repo.git_add()\n",
    "# repo.git_commit('Initial commit')\n",
    "# repo.git_push()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "upload_file() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\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",
      "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",
      "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",
      "\u001b[0;31mTypeError\u001b[0m: upload_file() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given"
     ]
    }
   ],
   "source": [
    "from huggingface_hub import upload_file, delete_file\n",
    "# LOCAL_FILE_PATH =  '/Users/juniverse/Downloads/CLIP_LoRA_CSE_15.pt'\n",
    "# νŒŒμΌμ„ 직접 μ—…λ‘œλ“œ\n",
    "upload_file(\n",
    "    '/Users/juniverse/Downloads/CLIP_LoRA_CSE_15.pt',\n",
    "    path_in_repo='./model',\n",
    "    repo_id='Soran/CLIP_LoRA_SimCSE',\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "veda",
   "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.8.17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}