franz96521
commited on
Commit
·
7100bee
1
Parent(s):
0874664
test
Browse files- .gitattributes +4 -0
- AbstractGenerator.ipynb +293 -0
- AbstractGenerator.yml +14 -0
- AbstractGenerator/Tokenized_data/reduced_dataset_47MB.txt +3 -0
- AbstractGenerator/Tokenized_data/resumen.txt +3 -0
- AbstractGenerator/data/scientific_paper_full_text_translated.csv +3 -0
- AbstractGenerator/weights/run1/checkpoint +3 -0
- AbstractGenerator/weights/run1/counter +3 -0
- AbstractGenerator/weights/run1/encoder.json +3 -0
- AbstractGenerator/weights/run1/events.out.tfevents.1648099088.FRANZ96521-W11 +3 -0
- AbstractGenerator/weights/run1/hparams.json +3 -0
- AbstractGenerator/weights/run1/model-1000.data-00000-of-00001 +3 -0
- AbstractGenerator/weights/run1/model-1000.index +3 -0
- AbstractGenerator/weights/run1/model-1000.meta +3 -0
- AbstractGenerator/weights/run1/vocab.bpe +3 -0
- App.py +40 -0
- models/124M/checkpoint +3 -0
- models/124M/encoder.json +3 -0
- models/124M/hparams.json +3 -0
- models/124M/model.ckpt.data-00000-of-00001 +3 -0
- models/124M/model.ckpt.index +3 -0
- models/124M/model.ckpt.meta +3 -0
- models/124M/vocab.bpe +3 -0
.gitattributes
CHANGED
@@ -25,3 +25,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
AbstractGenerator/ filter=lfs diff=lfs merge=lfs -text
|
29 |
+
AbstractGenerator/** filter=lfs diff=lfs merge=lfs -text
|
30 |
+
models/** filter=lfs diff=lfs merge=lfs -text
|
31 |
+
models/ filter=lfs diff=lfs merge=lfs -text
|
AbstractGenerator.ipynb
ADDED
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"\n",
|
10 |
+
"import gpt_2_simple as gpt2\n",
|
11 |
+
"import os\n",
|
12 |
+
"import tensorflow as tf\n",
|
13 |
+
"import pandas as pd\n",
|
14 |
+
"import re\n",
|
15 |
+
"print(\"GPU is\", \"available\" if tf.test.is_gpu_available() else \"NOT AVAILABLE\")"
|
16 |
+
]
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"cell_type": "code",
|
20 |
+
"execution_count": null,
|
21 |
+
"metadata": {},
|
22 |
+
"outputs": [],
|
23 |
+
"source": [
|
24 |
+
"model_name = \"124M\"\n",
|
25 |
+
"if not os.path.isdir(os.path.join(\"models\", model_name)):\n",
|
26 |
+
"\tprint(f\"Downloading {model_name} model...\")\n",
|
27 |
+
"\tgpt2.download_gpt2(model_name=model_name) "
|
28 |
+
]
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"cell_type": "code",
|
32 |
+
"execution_count": null,
|
33 |
+
"metadata": {},
|
34 |
+
"outputs": [],
|
35 |
+
"source": [
|
36 |
+
"path = 'AbstractGenerator/'\n",
|
37 |
+
"checkpoint_dir =path+'weights/'\n",
|
38 |
+
"data_path = path+'Tokenized_data/'\n",
|
39 |
+
"\n",
|
40 |
+
"\n",
|
41 |
+
"file_name = 'resumen'\n",
|
42 |
+
"file_path = data_path+file_name\n",
|
43 |
+
"\n",
|
44 |
+
"prefix= '<|startoftext|>'\n",
|
45 |
+
"sufix ='<|endoftext|>'"
|
46 |
+
]
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"cell_type": "markdown",
|
50 |
+
"metadata": {},
|
51 |
+
"source": [
|
52 |
+
"# pretrained"
|
53 |
+
]
|
54 |
+
},
|
55 |
+
{
|
56 |
+
"cell_type": "code",
|
57 |
+
"execution_count": null,
|
58 |
+
"metadata": {},
|
59 |
+
"outputs": [],
|
60 |
+
"source": [
|
61 |
+
"sess = gpt2.start_tf_sess()\n",
|
62 |
+
"gpt2.load_gpt2(sess,checkpoint_dir=checkpoint_dir,run_name='run1')"
|
63 |
+
]
|
64 |
+
},
|
65 |
+
{
|
66 |
+
"cell_type": "markdown",
|
67 |
+
"metadata": {},
|
68 |
+
"source": [
|
69 |
+
"# train "
|
70 |
+
]
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"cell_type": "code",
|
74 |
+
"execution_count": null,
|
75 |
+
"metadata": {},
|
76 |
+
"outputs": [],
|
77 |
+
"source": [
|
78 |
+
"tf.compat.v1.reset_default_graph()\n",
|
79 |
+
"sess = gpt2.start_tf_sess()\n",
|
80 |
+
"\n"
|
81 |
+
]
|
82 |
+
},
|
83 |
+
{
|
84 |
+
"cell_type": "code",
|
85 |
+
"execution_count": null,
|
86 |
+
"metadata": {},
|
87 |
+
"outputs": [],
|
88 |
+
"source": [
|
89 |
+
"gpt2.finetune(sess,\n",
|
90 |
+
" file_path+'.txt',\n",
|
91 |
+
" model_name=model_name,\n",
|
92 |
+
" checkpoint_dir=checkpoint_dir, \n",
|
93 |
+
" steps=1000\n",
|
94 |
+
" ) "
|
95 |
+
]
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"cell_type": "markdown",
|
99 |
+
"metadata": {},
|
100 |
+
"source": [
|
101 |
+
"# test"
|
102 |
+
]
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"cell_type": "code",
|
106 |
+
"execution_count": null,
|
107 |
+
"metadata": {},
|
108 |
+
"outputs": [],
|
109 |
+
"source": [
|
110 |
+
"text = \"\"\"Introduction and preliminaries\n",
|
111 |
+
"The focus of this paper is decompositions of (k, `)-sparse graphs into edge-disjoint subgraphs\n",
|
112 |
+
"that certify sparsity. We use graph to mean a multigraph, possibly with loops. We say that a\n",
|
113 |
+
"graph is (k, `)-sparse if no subset of n′ vertices spans more than kn′− ` edges in the graph; a\n",
|
114 |
+
"(k, `)-sparse graph with kn′− ` edges is (k, `)-tight. We call the range k ≤ `≤ 2k−1 the upper\n",
|
115 |
+
"range of sparse graphs and 0≤ `≤ k the lower range.\n",
|
116 |
+
"In this paper, we present efficient algorithms for finding decompositions that certify sparsity\n",
|
117 |
+
"in the upper range of `. Our algorithms also apply in the lower range, which was already ad-\n",
|
118 |
+
"dressed by [3, 4, 5, 6, 19]. A decomposition certifies the sparsity of a graph if the sparse graphs\n",
|
119 |
+
"and graphs admitting the decomposition coincide.\n",
|
120 |
+
"Our algorithms are based on a new characterization of sparse graphs, which we call the\n",
|
121 |
+
"pebble game with colors. The pebble game with colors is a simple graph construction rule that\n",
|
122 |
+
"produces a sparse graph along with a sparsity-certifying decomposition.\n",
|
123 |
+
"We define and study a canonical class of pebble game constructions, which correspond to\n",
|
124 |
+
"previously studied decompositions of sparse graphs into edge disjoint trees. Our results provide\n",
|
125 |
+
"a unifying framework for all the previously known special cases, including Nash-Williams-\n",
|
126 |
+
"Tutte and [7, 24]. Indeed, in the lower range, canonical pebble game constructions capture the\n",
|
127 |
+
"properties of the augmenting paths used in matroid union and intersection algorithms[5, 6].\n",
|
128 |
+
"Since the sparse graphs in the upper range are not known to be unions or intersections of the\n",
|
129 |
+
"matroids for which there are efficient augmenting path algorithms, these do not easily apply in\n",
|
130 |
+
"∗ Research of both authors funded by the NSF under grants NSF CCF-0430990 and NSF-DARPA CARGO\n",
|
131 |
+
"CCR-0310661 to the first author.\n",
|
132 |
+
"2 Ileana Streinu, Louis Theran\n",
|
133 |
+
"Term Meaning\n",
|
134 |
+
"Sparse graph G Every non-empty subgraph on n′ vertices has ≤ kn′− ` edges\n",
|
135 |
+
"Tight graph G G = (V,E) is sparse and |V |= n, |E|= kn− `\n",
|
136 |
+
"Block H in G G is sparse, and H is a tight subgraph\n",
|
137 |
+
"Component H of G G is sparse and H is a maximal block\n",
|
138 |
+
"Map-graph Graph that admits an out-degree-exactly-one orientation\n",
|
139 |
+
"(k, `)-maps-and-trees Edge-disjoint union of ` trees and (k− `) map-grpahs\n",
|
140 |
+
"`Tk Union of ` trees, each vertex is in exactly k of them\n",
|
141 |
+
"Set of tree-pieces of an `Tk induced on V �� ⊂V Pieces of trees in the `Tk spanned by E(V ′)\n",
|
142 |
+
"Proper `Tk Every V ′ ⊂V contains ≥ ` pieces of trees from the `Tk\n",
|
143 |
+
"Table 1. Sparse graph and decomposition terminology used in this paper.\n",
|
144 |
+
"the upper range. Pebble game with colors constructions may thus be considered a strengthening\n",
|
145 |
+
"of augmenting paths to the upper range of matroidal sparse graphs.\n",
|
146 |
+
"1.1. Sparse graphs\n",
|
147 |
+
"\n",
|
148 |
+
"ABSTRACT\n",
|
149 |
+
"\"\"\""
|
150 |
+
]
|
151 |
+
},
|
152 |
+
{
|
153 |
+
"cell_type": "code",
|
154 |
+
"execution_count": 6,
|
155 |
+
"metadata": {},
|
156 |
+
"outputs": [
|
157 |
+
{
|
158 |
+
"name": "stdout",
|
159 |
+
"output_type": "stream",
|
160 |
+
"text": [
|
161 |
+
"Introduction and preliminaries\n",
|
162 |
+
"The focus of this paper is decompositions of (k, `)-sparse graphs into edge-disjoint subgraphs\n",
|
163 |
+
"that certify sparsity. We use graph to mean a multigraph, possibly with loops. We say that a\n",
|
164 |
+
"graph is (k, `)-sparse if no subset of n′ vertices spans more than kn′− ` edges in the graph; a\n",
|
165 |
+
"(k, `)-sparse graph with kn′− ` edges is (k, `)-tight. We call the range k ≤ `≤ 2k−1 the upper\n",
|
166 |
+
"range of sparse graphs and 0≤ `≤ k the lower range.\n",
|
167 |
+
"In this paper, we present efficient algorithms for finding decompositions that certify sparsity\n",
|
168 |
+
"in the upper range of `. Our algorithms also apply in the lower range, which was already ad-\n",
|
169 |
+
"dressed by [3, 4, 5, 6, 19]. A decomposition certifies the sparsity of a graph if the sparse graphs\n",
|
170 |
+
"and graphs admitting the decomposition coincide.\n",
|
171 |
+
"Our algorithms are based on a new characterization of sparse graphs, which we call the\n",
|
172 |
+
"pebble game with colors. The pebble game with colors is a simple graph construction rule that\n",
|
173 |
+
"produces a sparse graph along with a sparsity-certifying decomposition.\n",
|
174 |
+
"We define and study a canonical class of pebble game constructions, which correspond to\n",
|
175 |
+
"previously studied decompositions of sparse graphs into edge disjoint trees. Our results provide\n",
|
176 |
+
"a unifying framework for all the previously known special cases, including Nash-Williams-\n",
|
177 |
+
"Tutte and [7, 24]. Indeed, in the lower range, canonical pebble game constructions capture the\n",
|
178 |
+
"properties of the augmenting paths used in matroid union and intersection algorithms[5, 6].\n",
|
179 |
+
"Since the sparse graphs in the upper range are not known to be unions or intersections of the\n",
|
180 |
+
"matroids for which there are efficient augmenting path algorithms, these do not easily apply in\n",
|
181 |
+
"∗ Research of both authors funded by the NSF under grants NSF CCF-0430990 and NSF-DARPA CARGO\n",
|
182 |
+
"CCR-0310661 to the first author.\n",
|
183 |
+
"2 Ileana Streinu, Louis Theran\n",
|
184 |
+
"Term Meaning\n",
|
185 |
+
"Sparse graph G Every non-empty subgraph on n′ vertices has ≤ kn′− ` edges\n",
|
186 |
+
"Tight graph G G = (V,E) is sparse and |V |= n, |E|= kn− `\n",
|
187 |
+
"Block H in G G is sparse, and H is a tight subgraph\n",
|
188 |
+
"Component H of G G is sparse and H is a maximal block\n",
|
189 |
+
"Map-graph Graph that admits an out-degree-exactly-one orientation\n",
|
190 |
+
"(k, `)-maps-and-trees Edge-disjoint union of ` trees and (k− `) map-grpahs\n",
|
191 |
+
"`Tk Union of ` trees, each vertex is in exactly k of them\n",
|
192 |
+
"Set of tree-pieces of an `Tk induced on V ′ ⊂V Pieces of trees in the `Tk spanned by E(V ′)\n",
|
193 |
+
"Proper `Tk Every V ′ ⊂V contains ≥ ` pieces of trees from the `Tk\n",
|
194 |
+
"Table 1. Sparse graph and decomposition terminology used in this paper.\n",
|
195 |
+
"the upper range. Pebble game with colors constructions may thus be considered a strengthening\n",
|
196 |
+
"of augmenting paths to the upper range of matroidal sparse graphs.\n",
|
197 |
+
"1.1. Sparse graphs\n",
|
198 |
+
"\n",
|
199 |
+
"ABSTRACT\n",
|
200 |
+
" Here we show that decompositions of sparse graphs are sometimes more efficient than\n",
|
201 |
+
"combinations of adjacent trees. In this paper, we apply a combinatorial\n",
|
202 |
+
"analysis of SparseGraph.com [5, 6] to evaluate our algorithm for finding\n",
|
203 |
+
"appropriate decompositions of sparse graphs in the upper range of sparse graphs\n",
|
204 |
+
"and in the lower range of sparse graphs. We show that the decomposition\n",
|
205 |
+
"certified in SparseGraph.com is as accurate as a tree-building algorithm\n",
|
206 |
+
"in the upper range of sparse graphs. This demonstrates that for the\n",
|
207 |
+
"case of SparseGraph.com [5], it is possible to construct a suitable decomposition\n",
|
208 |
+
"class within the bounds of the graph. The algorithm we use is based on a\n",
|
209 |
+
"combination of decompositions.\n",
|
210 |
+
"\n",
|
211 |
+
"\n"
|
212 |
+
]
|
213 |
+
}
|
214 |
+
],
|
215 |
+
"source": [
|
216 |
+
"gpt2.generate(sess,prefix=text,truncate=sufix,checkpoint_dir=checkpoint_dir,nsamples=1)"
|
217 |
+
]
|
218 |
+
},
|
219 |
+
{
|
220 |
+
"cell_type": "markdown",
|
221 |
+
"metadata": {},
|
222 |
+
"source": [
|
223 |
+
"# Data Tokeniser"
|
224 |
+
]
|
225 |
+
},
|
226 |
+
{
|
227 |
+
"cell_type": "code",
|
228 |
+
"execution_count": null,
|
229 |
+
"metadata": {},
|
230 |
+
"outputs": [],
|
231 |
+
"source": [
|
232 |
+
"ds = pd.read_csv('Recipe-Creator\\data\\scientific_paper_full_text_translated.csv')"
|
233 |
+
]
|
234 |
+
},
|
235 |
+
{
|
236 |
+
"cell_type": "code",
|
237 |
+
"execution_count": null,
|
238 |
+
"metadata": {},
|
239 |
+
"outputs": [],
|
240 |
+
"source": [
|
241 |
+
"import codecs\n",
|
242 |
+
"with codecs.open(\"Recipe-Creator/Tokenized_data/resumen.txt\",'a','utf-8') as f:\n",
|
243 |
+
" for i in ds.index:\n",
|
244 |
+
" f.write(prefix+\"\\n\")\n",
|
245 |
+
" f.write(ds.iloc[i]['text_no_abstract'])\n",
|
246 |
+
" f.write(\"ABSTRACT\\n\")\n",
|
247 |
+
" f.write(ds.iloc[i]['abstract']+\"\\n\")\n",
|
248 |
+
" f.write(sufix)\n",
|
249 |
+
" "
|
250 |
+
]
|
251 |
+
},
|
252 |
+
{
|
253 |
+
"cell_type": "code",
|
254 |
+
"execution_count": null,
|
255 |
+
"metadata": {},
|
256 |
+
"outputs": [],
|
257 |
+
"source": [
|
258 |
+
"import gradio as gr\n",
|
259 |
+
"\n",
|
260 |
+
"def greet(text):\n",
|
261 |
+
" return gpt2.generate(sess,prefix=str(text),truncate=sufix,checkpoint_dir=checkpoint_dir,nsamples=1)\n",
|
262 |
+
"\n",
|
263 |
+
"iface = gr.Interface(fn=greet, inputs=\"text\", outputs=\"text\")\n",
|
264 |
+
"iface.launch(share=True,debug=True)"
|
265 |
+
]
|
266 |
+
}
|
267 |
+
],
|
268 |
+
"metadata": {
|
269 |
+
"interpreter": {
|
270 |
+
"hash": "53fbdc69e3e12c371950068c144423682c30d04ec68c2bd46937202e33e0058d"
|
271 |
+
},
|
272 |
+
"kernelspec": {
|
273 |
+
"display_name": "Python 3.7.11 ('receta')",
|
274 |
+
"language": "python",
|
275 |
+
"name": "python3"
|
276 |
+
},
|
277 |
+
"language_info": {
|
278 |
+
"codemirror_mode": {
|
279 |
+
"name": "ipython",
|
280 |
+
"version": 3
|
281 |
+
},
|
282 |
+
"file_extension": ".py",
|
283 |
+
"mimetype": "text/x-python",
|
284 |
+
"name": "python",
|
285 |
+
"nbconvert_exporter": "python",
|
286 |
+
"pygments_lexer": "ipython3",
|
287 |
+
"version": "3.7.11"
|
288 |
+
},
|
289 |
+
"orig_nbformat": 4
|
290 |
+
},
|
291 |
+
"nbformat": 4,
|
292 |
+
"nbformat_minor": 2
|
293 |
+
}
|
AbstractGenerator.yml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Recipe-Creator
|
2 |
+
|
3 |
+
dependencies:
|
4 |
+
- python>=3.7
|
5 |
+
- pip>=19.0
|
6 |
+
- jupyter
|
7 |
+
- pandas
|
8 |
+
- pip:
|
9 |
+
- gpt-2-simple
|
10 |
+
- tensorflow-estimator==1.15.1
|
11 |
+
- tensorflow-gpu==1.15
|
12 |
+
|
13 |
+
|
14 |
+
|
AbstractGenerator/Tokenized_data/reduced_dataset_47MB.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6ddebcb25fcc12a0029f83374ac9ea5e010e5dcbc58162ad6cac42360391f4f5
|
3 |
+
size 48623670
|
AbstractGenerator/Tokenized_data/resumen.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4ee5de5835a959b24bb1fba6bed5b14a6c5e7682f04483850109123d448c2853
|
3 |
+
size 62458342
|
AbstractGenerator/data/scientific_paper_full_text_translated.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:58700a294dbdc6a78ef056f207cbee864e47b81c59e0209d0f5b622276e373f0
|
3 |
+
size 227783472
|
AbstractGenerator/weights/run1/checkpoint
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cdce1a7de49e734203b3af24a79c6e7f92b12c50462e0a6ee9e5ce254e8c5a7
|
3 |
+
size 77
|
AbstractGenerator/weights/run1/counter
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3b7b041d37d1d693c3afe25d2af7d56ad2ee7b98eddb2cc1a055c1117e55542e
|
3 |
+
size 6
|
AbstractGenerator/weights/run1/encoder.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783
|
3 |
+
size 1042301
|
AbstractGenerator/weights/run1/events.out.tfevents.1648099088.FRANZ96521-W11
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8ce17a8b02dce07c39e62333105e012aad5f62825b207ccb692becbe31bdc2b2
|
3 |
+
size 42913
|
AbstractGenerator/weights/run1/hparams.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d9d56e4121c427164e0c55c6f03c08e1daf9002b9b672825112d19097b680318
|
3 |
+
size 90
|
AbstractGenerator/weights/run1/model-1000.data-00000-of-00001
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:904922cd8b9620aec00f8072edc3717b03dfb4a700b585fe88012da8af0ce67a
|
3 |
+
size 497759232
|
AbstractGenerator/weights/run1/model-1000.index
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75db8ca12b433be77ffdf420d041d20837f2698ee5ab7132773f6d25cf841637
|
3 |
+
size 5215
|
AbstractGenerator/weights/run1/model-1000.meta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0e2968f20985aa601ae18b0ddf2b29bb5625822a4e11e3a45c0c5406f032e7b7
|
3 |
+
size 3884257
|
AbstractGenerator/weights/run1/vocab.bpe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5
|
3 |
+
size 456318
|
App.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
os.system('pip install gpt-2-simple')
|
3 |
+
os.system('pip install tensorflow-estimator==1.15.1')
|
4 |
+
|
5 |
+
import gpt_2_simple as gpt2
|
6 |
+
import tensorflow as tf
|
7 |
+
import pandas as pd
|
8 |
+
import re
|
9 |
+
import gradio as gr
|
10 |
+
|
11 |
+
model_name = "124M"
|
12 |
+
|
13 |
+
path = 'AbstractGenerator/'
|
14 |
+
checkpoint_dir =path+'weights/'
|
15 |
+
data_path = path+'Tokenized_data/'
|
16 |
+
|
17 |
+
|
18 |
+
file_name = 'resumen'
|
19 |
+
file_path = data_path+file_name
|
20 |
+
|
21 |
+
prefix= '<|startoftext|>'
|
22 |
+
sufix ='<|endoftext|>'
|
23 |
+
|
24 |
+
print("GPU is", "available" if tf.test.is_gpu_available() else "NOT AVAILABLE")
|
25 |
+
|
26 |
+
sess = gpt2.start_tf_sess()
|
27 |
+
gpt2.load_gpt2(sess,checkpoint_dir=checkpoint_dir,run_name='run1')
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
def greet(text):
|
34 |
+
return gpt2.generate(sess,prefix=text,truncate=sufix,checkpoint_dir=checkpoint_dir,nsamples=1)
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
40 |
+
iface.launch(share=True)
|
models/124M/checkpoint
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dd1b025d2e155283f5e300ce95bf6d5b6bc0f7fe010db73daa6975eb896ab9cb
|
3 |
+
size 77
|
models/124M/encoder.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783
|
3 |
+
size 1042301
|
models/124M/hparams.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d9d56e4121c427164e0c55c6f03c08e1daf9002b9b672825112d19097b680318
|
3 |
+
size 90
|
models/124M/model.ckpt.data-00000-of-00001
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2060c885360cc0cf41d7a6dbc4d24b5127aae20260c8b5ae521b5a6578407118
|
3 |
+
size 497759232
|
models/124M/model.ckpt.index
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:71916f763f9746f9b2a06b12d91996cf1084ae008d0424543d39391c5f2dc687
|
3 |
+
size 5215
|
models/124M/model.ckpt.meta
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4668c448fa11531fd6700460487f73e82d3272960cea942252f8744bf225c77b
|
3 |
+
size 471155
|
models/124M/vocab.bpe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5
|
3 |
+
size 456318
|