Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FAC69
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Lanzendörfer
FAC69
Commits
0fa5860d
Commit
0fa5860d
authored
10 months ago
by
David Lanzendörfer
Browse files
Options
Downloads
Patches
Plain Diff
Train on a complete time series
parent
56a3b9f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#92
canceled with stage
in 55 minutes and 56 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
firmware/firmware.c
+5
-5
5 additions, 5 deletions
firmware/firmware.c
firmware/include/rnn.h
+4
-4
4 additions, 4 deletions
firmware/include/rnn.h
firmware/rnn.c
+23
-15
23 additions, 15 deletions
firmware/rnn.c
src/py/tty3.py
+0
-1
0 additions, 1 deletion
src/py/tty3.py
with
32 additions
and
25 deletions
firmware/firmware.c
+
5
−
5
View file @
0fa5860d
...
@@ -88,15 +88,15 @@ void main()
...
@@ -88,15 +88,15 @@ void main()
uint32_t
current_num_neurons
;
uint32_t
current_num_neurons
;
// Write params
// Write params
uint32_t
value_write_counter
;
uint32_t
value_write_counter
=
0
;
int
new_value
;
int
new_value
;
// Training
// Training
uint32_t
new_token
;
uint32_t
new_token
;
uint32_t
token_series
[
MAX_NUM_TOKENS
];
uint32_t
token_series
[
MAX_NUM_TOKENS
];
int
token_counter
;
int
token_counter
=
0
;
uint32_t
learning_rate
;
uint32_t
learning_rate
=
0
;
uint32_t
decay_rate
;
uint32_t
decay_rate
=
0
;
while
(
true
)
{
while
(
true
)
{
...
@@ -304,7 +304,7 @@ void main()
...
@@ -304,7 +304,7 @@ void main()
case
TRAIN_RUN_EPOCHS
:
case
TRAIN_RUN_EPOCHS
:
uint32_t
num_epochs
=
atoi
(
numstr
);
uint32_t
num_epochs
=
atoi
(
numstr
);
response
=
run_training
(
response
,
num_epochs
,
learning_rate
,
decay_rate
,
token_series
[
0
]
,
token_
series
[
1
]
);
//
response = run_training(response, num_epochs, learning_rate, decay_rate, token_series, token_
counter
);
command_mode
=
START
;
command_mode
=
START
;
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
firmware/include/rnn.h
+
4
−
4
View file @
0fa5860d
...
@@ -141,14 +141,14 @@ void reset_network();
...
@@ -141,14 +141,14 @@ void reset_network();
* num_epochs: Amount of epochs
* num_epochs: Amount of epochs
* learning_rate_zero: initial learning rate
* learning_rate_zero: initial learning rate
* decay_rate: the decay rate for gradient decay
* decay_rate: the decay rate for gradient decay
* x:
input token
* x
p
:
Pointer to array of values
*
y: output token
*
xn: Amount of values in array
*/
*/
char
*
run_training
(
char
*
run_training
(
char
*
msgbuf
,
char
*
msgbuf
,
int
num_epochs
,
int
num_epochs
,
uint32_t
learning_rate_zero
,
uint32_t
learning_rate_zero
,
uint32_t
decay_rate
,
uint32_t
decay_rate
,
uint32_t
x
,
uint32_t
*
xp
,
uint32_t
y
uint32_t
xn
);
);
This diff is collapsed.
Click to expand it.
firmware/rnn.c
+
23
−
15
View file @
0fa5860d
...
@@ -393,32 +393,40 @@ void set_bias_values(int bias)
...
@@ -393,32 +393,40 @@ void set_bias_values(int bias)
* num_epochs: Amount of epochs
* num_epochs: Amount of epochs
* learning_rate_zero: initial learning rate
* learning_rate_zero: initial learning rate
* decay_rate: the decay rate for gradient decay
* decay_rate: the decay rate for gradient decay
* x:
input token
* x
p
:
Pointer to array of values
*
y: output token
*
xn: Amount of values in array
*/
*/
char
*
run_training
(
char
*
run_training
(
char
*
msgbuf
,
char
*
msgbuf
,
int
num_epochs
,
int
num_epochs
,
uint32_t
learning_rate_zero
,
uint32_t
learning_rate_zero
,
uint32_t
decay_rate
,
uint32_t
decay_rate
,
uint32_t
x
,
uint32_t
*
xp
,
uint32_t
y
uint32_t
xn
)
)
{
{
int
last_val
;
int
last_val
;
uint32_t
train_mask
;
uint32_t
train_mask
;
uint32_t
y
;
for
(
int
epoch
=
0
;
epoch
<
num_epochs
;
epoch
++
)
{
reset_network
();
for
(
uint32_t
xni
=
1
;
xni
<
xn
;
xni
++
)
{
last_val
=
predict_next_token
(
x
);
msgbuf
=
"FAIL"
;
if
(
last_val
==
y
)
{
y
=
xp
[
xni
];
return
"SUCCESS"
;
for
(
int
epoch
=
0
;
epoch
<
num_epochs
;
epoch
++
)
{
break
;
reset_network
();
for
(
int
xpi
=
0
;
xpi
<
xni
;
xpi
++
)
{
last_val
=
predict_next_token
(
xp
[
xpi
]);
}
if
(
last_val
==
y
)
{
msgbuf
=
"SUCCESS"
;
break
;
}
train_mask
=
last_val
^
y
;
set_alpha
(
learning_rate_zero
/
(
1
+
(
decay_rate
*
epoch
)));
mask_back_propgatation
(
train_mask
);
}
}
train_mask
=
last_val
^
y
;
set_alpha
(
learning_rate_zero
/
(
1
+
(
decay_rate
*
epoch
)));
mask_back_propgatation
(
train_mask
);
}
}
return
"FAIL"
;
return
msgbuf
;
}
}
This diff is collapsed.
Click to expand it.
src/py/tty3.py
+
0
−
1
View file @
0fa5860d
...
@@ -54,7 +54,6 @@ run_command(server,"DECAY_RATE")
...
@@ -54,7 +54,6 @@ run_command(server,"DECAY_RATE")
# α=(1/(1+decayRate×epochNumber))*α0
# α=(1/(1+decayRate×epochNumber))*α0
run_command
(
server
,
str
(
decay_rate
))
run_command
(
server
,
str
(
decay_rate
))
run_command
(
server
,
"
TRAIN
"
)
run_command
(
server
,
"
TRAIN
"
)
run_command
(
server
,
"
RUN_EPOCHS
"
)
run_command
(
server
,
"
RUN_EPOCHS
"
)
run_command
(
server
,
str
(
20000
))
run_command
(
server
,
str
(
20000
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment