Atharva192003 commited on
Commit
770d6c2
1 Parent(s): e7904d0

Delete Huggingface.ipynb

Browse files
Files changed (1) hide show
  1. Huggingface.ipynb +0 -155
Huggingface.ipynb DELETED
@@ -1,155 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": 1,
6
- "id": "3fcd5f6c",
7
- "metadata": {},
8
- "outputs": [
9
- {
10
- "name": "stdout",
11
- "output_type": "stream",
12
- "text": [
13
- "Collecting transformers\n",
14
- " Downloading transformers-4.28.1-py3-none-any.whl (7.0 MB)\n",
15
- " ---------------------------------------- 7.0/7.0 MB 722.4 kB/s eta 0:00:00\n",
16
- "Requirement already satisfied: numpy>=1.17 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (1.24.3)\n",
17
- "Collecting huggingface-hub<1.0,>=0.11.0\n",
18
- " Downloading huggingface_hub-0.14.1-py3-none-any.whl (224 kB)\n",
19
- " ------------------------------------ 224.5/224.5 kB 762.4 kB/s eta 0:00:00\n",
20
- "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (6.0)\n",
21
- "Requirement already satisfied: filelock in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (3.12.0)\n",
22
- "Requirement already satisfied: packaging>=20.0 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (21.3)\n",
23
- "Requirement already satisfied: regex!=2019.12.17 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (2022.7.9)\n",
24
- "Collecting tokenizers!=0.11.3,<0.14,>=0.11.1\n",
25
- " Downloading tokenizers-0.13.3-cp39-cp39-win_amd64.whl (3.5 MB)\n",
26
- " ---------------------------------------- 3.5/3.5 MB 738.0 kB/s eta 0:00:00\n",
27
- "Requirement already satisfied: tqdm>=4.27 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (4.64.1)\n",
28
- "Requirement already satisfied: requests in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from transformers) (2.28.1)\n",
29
- "Requirement already satisfied: fsspec in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.11.0->transformers) (2022.7.1)\n",
30
- "Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.11.0->transformers) (4.3.0)\n",
31
- "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from packaging>=20.0->transformers) (3.0.9)\n",
32
- "Requirement already satisfied: colorama in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from tqdm>=4.27->transformers) (0.4.5)\n",
33
- "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from requests->transformers) (3.3)\n",
34
- "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from requests->transformers) (2022.12.7)\n",
35
- "Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from requests->transformers) (1.26.11)\n",
36
- "Requirement already satisfied: charset-normalizer<3,>=2 in c:\\users\\atharva\\anaconda3\\lib\\site-packages (from requests->transformers) (2.0.4)\n",
37
- "Installing collected packages: tokenizers, huggingface-hub, transformers\n",
38
- "Successfully installed huggingface-hub-0.14.1 tokenizers-0.13.3 transformers-4.28.1\n"
39
- ]
40
- }
41
- ],
42
- "source": [
43
- "!pip install transformers"
44
- ]
45
- },
46
- {
47
- "cell_type": "code",
48
- "execution_count": 2,
49
- "id": "9b7e3e88",
50
- "metadata": {},
51
- "outputs": [],
52
- "source": [
53
- "from transformers import pipeline"
54
- ]
55
- },
56
- {
57
- "cell_type": "code",
58
- "execution_count": null,
59
- "id": "bf785b14",
60
- "metadata": {},
61
- "outputs": [],
62
- "source": [
63
- "##BART -LARGE-MNLI"
64
- ]
65
- },
66
- {
67
- "cell_type": "code",
68
- "execution_count": 3,
69
- "id": "ac57b4d0",
70
- "metadata": {
71
- "scrolled": true
72
- },
73
- "outputs": [],
74
- "source": [
75
- "classifier_pipeline=pipeline(\"zero-shot-classification\",model=\"facebook/bart-large-mnli\",)"
76
- ]
77
- },
78
- {
79
- "cell_type": "code",
80
- "execution_count": 4,
81
- "id": "8b1d9736",
82
- "metadata": {},
83
- "outputs": [
84
- {
85
- "data": {
86
- "text/plain": [
87
- "{'sequence': 'I love travelling',\n",
88
- " 'labels': ['travelling', 'entertainment', 'technology', 'dancing', 'cooking'],\n",
89
- " 'scores': [0.930633544921875,\n",
90
- " 0.057743728160858154,\n",
91
- " 0.004555718973278999,\n",
92
- " 0.004288351628929377,\n",
93
- " 0.0027786651626229286]}"
94
- ]
95
- },
96
- "execution_count": 4,
97
- "metadata": {},
98
- "output_type": "execute_result"
99
- }
100
- ],
101
- "source": [
102
- "input_sequences=\"I love travelling\"\n",
103
- "label_candidates=[\"travelling\",\"cooking\",\"entertainment\",\"dancing\",\"technology\"]\n",
104
- "classifier_pipeline(input_sequences,label_candidates)\n",
105
- "\n",
106
- "\n"
107
- ]
108
- },
109
- {
110
- "cell_type": "code",
111
- "execution_count": 6,
112
- "id": "80d56ec0",
113
- "metadata": {
114
- "scrolled": true
115
- },
116
- "outputs": [],
117
- "source": [
118
- "import pickle\n",
119
- "pickle_out=open(\"classfier_pipeline.pkl\",\"wb\")\n",
120
- "pickle.dump=(classifier_pipeline,pickle_out)\n",
121
- "pickle_out.close()\n",
122
- "\n"
123
- ]
124
- },
125
- {
126
- "cell_type": "code",
127
- "execution_count": null,
128
- "id": "19f74f84",
129
- "metadata": {},
130
- "outputs": [],
131
- "source": []
132
- }
133
- ],
134
- "metadata": {
135
- "kernelspec": {
136
- "display_name": "Python 3 (ipykernel)",
137
- "language": "python",
138
- "name": "python3"
139
- },
140
- "language_info": {
141
- "codemirror_mode": {
142
- "name": "ipython",
143
- "version": 3
144
- },
145
- "file_extension": ".py",
146
- "mimetype": "text/x-python",
147
- "name": "python",
148
- "nbconvert_exporter": "python",
149
- "pygments_lexer": "ipython3",
150
- "version": "3.9.13"
151
- }
152
- },
153
- "nbformat": 4,
154
- "nbformat_minor": 5
155
- }