drclab commited on
Commit
e7e055a
1 Parent(s): 9369fb7
Files changed (1) hide show
  1. hugging_face.ipynb +126 -2
hugging_face.ipynb CHANGED
@@ -1,13 +1,137 @@
1
  {
2
  "cells": [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  {
4
  "cell_type": "code",
5
  "execution_count": 2,
6
  "metadata": {},
7
  "outputs": [],
8
  "source": [
9
- "from huggingface_hub import HfApi\n",
10
- "from auth import HF_TOKEN"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  ]
12
  }
13
  ],
 
1
  {
2
  "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 17,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "from huggingface_hub import HfApi, login\n",
10
+ "from auth import HFW_TOKEN"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 18,
16
+ "metadata": {},
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "Token will not been saved to git credential helper. Pass `add_to_git_credential=True` if you want to set the git credential as well.\n",
23
+ "Token is valid.\n",
24
+ "Your token has been saved to /home/dulunche/.cache/huggingface/token\n",
25
+ "Login successful\n"
26
+ ]
27
+ }
28
+ ],
29
+ "source": [
30
+ "login(token=HFW_TOKEN)"
31
+ ]
32
+ },
33
  {
34
  "cell_type": "code",
35
  "execution_count": 2,
36
  "metadata": {},
37
  "outputs": [],
38
  "source": [
39
+ "api = HfApi()"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 19,
45
+ "metadata": {},
46
+ "outputs": [
47
+ {
48
+ "data": {
49
+ "text/plain": [
50
+ "'https://huggingface.co'"
51
+ ]
52
+ },
53
+ "execution_count": 19,
54
+ "metadata": {},
55
+ "output_type": "execute_result"
56
+ }
57
+ ],
58
+ "source": [
59
+ "api.endpoint"
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "code",
64
+ "execution_count": 20,
65
+ "metadata": {},
66
+ "outputs": [
67
+ {
68
+ "data": {
69
+ "text/plain": [
70
+ "{'type': 'user',\n",
71
+ " 'id': '64289a8d6692bf33da3fbeb3',\n",
72
+ " 'name': 'drclab',\n",
73
+ " 'fullname': 'C.J. Duan',\n",
74
+ " 'email': 'Data.Scientist@dulun.com',\n",
75
+ " 'emailVerified': True,\n",
76
+ " 'plan': 'NO_PLAN',\n",
77
+ " 'canPay': False,\n",
78
+ " 'isPro': False,\n",
79
+ " 'periodEnd': None,\n",
80
+ " 'avatarUrl': '/avatars/245df30cdd130bda3ee4f7740dd5b228.svg',\n",
81
+ " 'orgs': [],\n",
82
+ " 'auth': {'type': 'access_token',\n",
83
+ " 'accessToken': {'displayName': 'LVD', 'role': 'write'}}}"
84
+ ]
85
+ },
86
+ "execution_count": 20,
87
+ "metadata": {},
88
+ "output_type": "execute_result"
89
+ }
90
+ ],
91
+ "source": [
92
+ "api.whoami()"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "code",
97
+ "execution_count": 21,
98
+ "metadata": {},
99
+ "outputs": [
100
+ {
101
+ "data": {
102
+ "text/plain": [
103
+ "'drclab/ChatDulun'"
104
+ ]
105
+ },
106
+ "execution_count": 21,
107
+ "metadata": {},
108
+ "output_type": "execute_result"
109
+ }
110
+ ],
111
+ "source": [
112
+ "api.get_full_repo_name(model_id='ChatDulun')"
113
+ ]
114
+ },
115
+ {
116
+ "cell_type": "code",
117
+ "execution_count": 22,
118
+ "metadata": {},
119
+ "outputs": [
120
+ {
121
+ "ename": "TypeError",
122
+ "evalue": "HfApi.repo_info() missing 1 required positional argument: 'repo_id'",
123
+ "output_type": "error",
124
+ "traceback": [
125
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
126
+ "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
127
+ "\u001b[1;32m/home/dulunche/GP_VAE/ChatDulun/hugging_face.ipynb Cell 7\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> <a href='vscode-notebook-cell://wsl%2Bubuntu-22.04/home/dulunche/GP_VAE/ChatDulun/hugging_face.ipynb#W5sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m api\u001b[39m.\u001b[39;49mrepo_info()\n",
128
+ "File \u001b[0;32m~/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:120\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[39mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 118\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--> 120\u001b[0m \u001b[39mreturn\u001b[39;00m fn(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n",
129
+ "\u001b[0;31mTypeError\u001b[0m: HfApi.repo_info() missing 1 required positional argument: 'repo_id'"
130
+ ]
131
+ }
132
+ ],
133
+ "source": [
134
+ "api.repo_info()"
135
  ]
136
  }
137
  ],