Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
algolit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
algolit
algolit
Commits
e448e048
Commit
e448e048
authored
Nov 29, 2017
by
ana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding shtools for charrnn
parent
7797d84e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
algoliterary_encounter/charrnn/shtools/scp.sh
algoliterary_encounter/charrnn/shtools/scp.sh
+3
-0
algoliterary_encounter/charrnn/shtools/train.sh
algoliterary_encounter/charrnn/shtools/train.sh
+39
-0
algoliterary_encounter/charrnn/shtools/unzip.sh
algoliterary_encounter/charrnn/shtools/unzip.sh
+21
-0
No files found.
algoliterary_encounter/charrnn/shtools/scp.sh
0 → 100644
View file @
e448e048
#! /bin/bash
scp path/to.txt algolit@UVW:char-rnn/rawdata
algoliterary_encounter/charrnn/shtools/train.sh
0 → 100644
View file @
e448e048
#! /bin/bash
# Script to concatenate all the raw data in the rawdata folder
# and train the network
cd
/home/algolit/torch-rnn/
;
if
[
!
-d
./raw-data
]
;
then
mkdir
./raw-data
fi
name
=
"
$(
date
+%s
)
"
;
txt
=
"./raw-data/
${
1
}
.txt"
h5
=
"./data/
${
1
}
-
${
name
}
.h5"
json
=
"./data/
${
1
}
-
${
name
}
.json"
cv
=
"cvs/
${
1
}
/
${
name
}
"
mkdir
-p
"
${
cv
}
"
;
# Combine raw texts and merge into one file
#cat ./texts/*.txt > $txt;
# Make a copy of the data-set for processing outside
#cp -f $txt ./raw-data/latest.txt;
# Activate the venv and preprocess the data
source
~/venvs/torch-rnn/bin/activate
;
python scripts/preprocess.py
\
--input_txt
$txt
\
--output_h5
$h5
\
--output_json
$json
# Start the training
th train.lua
-input_h5
$h5
-input_json
$json
-num_layers
3
-rnn_size
256
-seq_length
75
-max_epochs
150
-checkpoint_name
"
${
cv
}
/checkpoint"
;
# Echo after the training
echo
"Training done. Use the following command to sample from the latest checkpoint:"
files
=
$(
ls
-t
"
${
cv
}
/checkpoint*.t7"
)
;
set
--
$files
;
echo
"th sample.lua -checkpoint
${
1
}
"
;
algoliterary_encounter/charrnn/shtools/unzip.sh
0 → 100644
View file @
e448e048
#! /bin/bash
# Script to unzip all books and put them in a folder 'merged'
#cd /home/algolit/gutenberg;
if
[
!
-d
./merged
]
;
then
mkdir
./merged
fi
for
path
in
/home/algolit/gutenberg/aleph.gutenberg.org/
*
/
*
/
*
/
*
/
*
/
*
.zip
;
do
unzip
$path
-d
./merged
;
done
;
# Remove books with -8 name, unsure why these copies are there anyhow; codec?
for
file
in
/home/algolit/gutenberg/merged/
*
-8
.txt
;
do
name
=
$(
basename
$file
)
;
num
=
"
${
name
%-8.txt
}
.txt"
;
rm
./merged/
$num
;
rm
./merged/
$name
;
done
;
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