Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GPT2_story
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhou Enhua
GPT2_story
Commits
405ac434
Commit
405ac434
authored
Mar 12, 2021
by
Zhou Enhua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
134817d3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
encoder.py
serveur/gpt-2/src/encoder.py
+1
-0
generate_unconditional_samples.py
serveur/gpt-2/src/generate_unconditional_samples.py
+4
-4
run.py
serveur/gpt-2/src/run.py
+2
-1
No files found.
serveur/gpt-2/src/encoder.py
View file @
405ac434
...
...
@@ -116,3 +116,4 @@ def get_encoder(model_name):
encoder
=
encoder
,
bpe_merges
=
bpe_merges
,
)
serveur/gpt-2/src/generate_unconditional_samples.py
View file @
405ac434
...
...
@@ -41,7 +41,7 @@ def sample_model(
"""
enc
=
encoder
.
get_encoder
(
model_name
)
hparams
=
model
.
default_hparams
()
with
open
(
os
.
path
.
join
(
'models'
,
model_name
,
'hparams.json'
))
as
f
:
with
open
(
os
.
path
.
join
(
'
../
models'
,
model_name
,
'hparams.json'
))
as
f
:
hparams
.
override_from_dict
(
json
.
load
(
f
))
if
length
is
None
:
...
...
@@ -61,7 +61,7 @@ def sample_model(
)[:,
1
:]
saver
=
tf
.
train
.
Saver
()
ckpt
=
tf
.
train
.
latest_checkpoint
(
os
.
path
.
join
(
'models'
,
model_name
))
ckpt
=
tf
.
train
.
latest_checkpoint
(
os
.
path
.
join
(
'
../
models'
,
model_name
))
saver
.
restore
(
sess
,
ckpt
)
generated
=
0
...
...
@@ -71,7 +71,7 @@ def sample_model(
generated
+=
batch_size
text
=
enc
.
decode
(
out
[
i
])
print
(
"="
*
40
+
" SAMPLE "
+
str
(
generated
)
+
" "
+
"="
*
40
)
path1
=
"/home/stu/pkq/gpt-2/samples/new_try_samples/uncon"
path1
=
'../samples/story_unconditional'
path2
=
str
(
generated
)
+
".txt"
path
=
os
.
path
.
join
(
path1
,
path2
)
...
...
@@ -82,4 +82,4 @@ def sample_model(
return
1
if
__name__
==
'__main__'
:
fire
.
Fire
(
sample_model
)
sample_model
(
model_name
=
"345MShort"
,
nsamples
=
3
)
serveur/gpt-2/src/run.py
View file @
405ac434
...
...
@@ -18,5 +18,5 @@ def run1(path1):
#run1("/home/stu/pkq/gpt-2/samples/story_start/1_start.txt")
raw_text
=
""
raw_text
=
"
"
model2
.
train
(
raw_text
,
5
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment