Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
8a0eacb5
Commit
8a0eacb5
authored
Oct 18, 2021
by
Bogdan Mihai (ARTICONF student)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Fed training 'No Context' TFF Error
parent
3928da1c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
10 deletions
+15
-10
log.txt
tools/federated-training/app/log.txt
+0
-0
federated_algorithm.py
...ing/app/processing/text_processing/federated_algorithm.py
+10
-8
last_model
...erated-training/app/processing/text_processing/last_model
+0
-0
ledger.csv
...erated-training/app/processing/text_processing/ledger.csv
+3
-0
developers.py
tools/federated-training/app/routes/developers.py
+2
-2
No files found.
tools/federated-training/app/log.txt
View file @
8a0eacb5
No preview for this file type
tools/federated-training/app/processing/text_processing/federated_algorithm.py
View file @
8a0eacb5
...
...
@@ -3,21 +3,23 @@ import global_hyperparams as globals
from
model
import
get_simple_LSTM_model
import
pickle
import
tensorflow
as
tf
import
tensorflow_federated
as
tff
def
model_fn
():
keras_model
=
get_simple_LSTM_model
()
import
tensorflow
as
tf
import
tensorflow_federated
as
tff
keras_model
=
get_simple_LSTM_model
()
return
tff
.
learning
.
from_keras_model
(
keras_model
,
input_spec
=
globals
.
INPUT_SPEC
,
loss
=
tf
.
keras
.
losses
.
SparseCategoricalCrossentropy
(
from_logits
=
True
),
metrics
=
[
tf
.
keras
.
metrics
.
SparseCategoricalAccuracy
()])
return
tff
.
learning
.
from_keras_model
(
keras_model
,
input_spec
=
globals
.
INPUT_SPEC
,
loss
=
tf
.
keras
.
losses
.
SparseCategoricalCrossentropy
(
from_logits
=
True
),
metrics
=
[
tf
.
keras
.
metrics
.
SparseCategoricalAccuracy
()])
def
federated_computation_new
(
train_dataset
,
test_dataset
):
import
tensorflow
as
tf
import
tensorflow_federated
as
tff
if
(
globals
.
INPUT_SPEC
==
None
):
#should never reach this place because INPUT_SPEC is instantiated inside get_preprocessed_train_test_data.
...
...
tools/federated-training/app/processing/text_processing/last_model
View file @
8a0eacb5
No preview for this file type
tools/federated-training/app/processing/text_processing/ledger.csv
View file @
8a0eacb5
...
...
@@ -21,3 +21,6 @@ Trainer_id,Model_id,Dataset_id,Accuracy,Loss
3,1633518451,1633518451,0.25,nan
4,1633525163,1633525163,0.75,nan
4,1633528455,1633528455,0.5,nan
3,1634034576,1634034576,0.75,nan
0,1634036764,1634036764,0.75,nan
0,1634553320,1634553320,0.5,nan
tools/federated-training/app/routes/developers.py
View file @
8a0eacb5
...
...
@@ -41,7 +41,7 @@ def upload_and_train(use_case: str, developer_id: int):
fake_csv_path
=
os
.
path
.
join
(
app_path
+
"/"
+
use_case_path
+
"db/"
,
"Fake.csv"
)
db_File_True
.
save
(
true_csv_path
)
db_File_Fake
.
save
(
fake_csv_path
)
time
.
sleep
(
5
)
#wait for the files to be copied before proceeding with the processing (they are copied in a separate thread, i think?)
time
.
sleep
(
10
)
#wait for the files to be copied before proceeding with the processing (they are copied in a separate thread, i think?)
#THEN start processing
last_train_metrics
=
main_proc
.
start_processing
(
use_case
,
developer_id
)
print
(
"## Last train metrics"
)
...
...
@@ -62,6 +62,6 @@ def trainMetricsToJSON(last_train_metrics : list):
metricsDict
[
"Loss"
]
=
last_train_metrics
[
4
]
return
json
.
dumps
(
metricsDict
)
#upload_and_train("text_processing",
1
)
#upload_and_train("text_processing",
3
)
#last("text_processing")
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