please anyone help me, i am stuck at this code, I have tried to read release notes related to below version which i have installed on google colab but till not found any solution
TensorFlow version: 2.15.0
TensorFlow Federated version: 0.75.0
Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
—my code is here:
```import tensorflow as tf
import tensorflow_federated as tff
# Assuming you have preprocessed X and y from your own dataset
# Load your preprocessed data here
X, y, vocab_size, max_length = load_and_preprocess_data() # Load your preprocessed data
# Define the model architecture
def create_lstm_model():
model = tf.keras.Sequential([
tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=max_sequence_length),
tf.keras.layers.LSTM(64),
tf.keras.layers.Dense(vocab_size, activation='softmax')
])
return tff.learning.from_keras_model(
keras_model=model,
input_spec=(tf.TensorSpec(shape=(None, max_sequence_length), dtype=tf.int32), tf.TensorSpec(shape=(None,), dtype=tf.int32)),
loss=tf.keras.losses.SparseCategoricalCrossentropy(),
metrics=[tf.keras.metrics.SparseCategoricalAccuracy()]
)
# Build federated averaging process
federated_averaging_process = tff.learning.build_weighted_fed_avg(
model_fn=create_lstm_model,
client_optimizer_fn=lambda: tf.keras.optimizers.Adam(learning_rate=0.01),
server_optimizer_fn=lambda: tf.keras.optimizers.Adam(learning_rate=0.01)
)
# Initialize federated state
state = federated_averaging_process.initialize()
# Federated training loop
NUM_ROUNDS = 20
for round_num in range(NUM_ROUNDS):
state, metrics = federated_averaging_process.next(state, federated_data)
print(f'Round {round_num}: {metrics}')
**AttributeError: module 'tensorflow_federated.python.learning' has no attribute 'build_weighted_fed_avg'**