Fix: Fed training 'No Context' TFF Error

parent 3928da1c
......@@ -3,12 +3,12 @@ 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():
import tensorflow as tf
import tensorflow_federated as tff
keras_model = get_simple_LSTM_model()
return tff.learning.from_keras_model(
......@@ -18,6 +18,8 @@ def model_fn():
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.
......
......@@ -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
......@@ -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")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment