@@ -43,26 +43,36 @@ If you have <i>several datafiles</i> then you can do something like:
4343# bash example of how to use the -r flag
4444# see std_conf.h on how to change the default
4545# behaviour before building the program.
46+ #
47+ # In this example, the source code
48+ # of the project will be given as
49+ # training data for the LSTM network.
4650
47- folder="THE FOLDER WITH THE FILES"
48-
49- first=1
50- for file in $(ls -p $folder | grep -v /); do
51- if [ $first -eq 1 ]; then
52- # Train the net using new weights
53- # a file with the name lstm_net.net
54- # will appear, see std_conf.h
55- # Store every 500 iterations,
56- # train for 10000 iterations.
57- ./net $folder/$file -st 500 -it 10000
58- first=0
59- else
60- # Train the net using previously trained weights
61- # Store every 500 iterations,
62- # train for 10000 iterations.
63- ./net $folder/$file -r lstm_net.net -st 500 -it 10000
64- fi
51+ # Build
52+ make
53+ # How many cycles all source files are to be trained on
54+ CYCLES=10
55+ cycle=0
56+ # list source files
57+ files=$(ls *.h *.c)
58+
59+ while [ $cycle -lt $CYCLES ]; do
60+ echo "$(date) Starting cycle $((cycle+1))"
61+ first=1
62+ for file in $files; do
63+ echo "$(date) starting to train on file: $file"
64+ if [ $first -eq 1 ]; then
65+ ./net $file -vr 0 -it 10000 -st 5000 -N 64 -L 3
66+ first=0
67+ else
68+ ./net $file -vr 0 -r lstm_net.net -it 10000 -st 5000
69+ fi
70+ done
71+
72+ cycle=$((cycle+1))
6573done
74+
75+ echo "Finished!"
6676</pre >
6777
6878## Windows
@@ -106,10 +116,12 @@ The following flags are available:
106116 -out: number of characters to output directly, note: a network and a datafile must be provided.
107117 -L : Number of layers, may not exceed 10
108118 -N : Number of neurons in every layer
119+ -vr : Verbosity level. Set to zero and only the loss function after and not during training will be printed.
120+ -c : Don't train, only generate output. Seed given by the value. If -r is used, datafile is not considered.
109121
110122Check std_conf.h to see what default values are used, these are set during compilation.
111123
112- ./net compiled Dec 21 2019 15:55:28
124+ ./net compiled Dec 23 2019 17:13:42
113125
114126</pre >
115127
0 commit comments