RNN_OriginalFedAvg#
- class fl_sim.models.RNN_OriginalFedAvg(embedding_dim: int = 8, vocab_size: int = 90, hidden_size: int = 256)[source]#
Bases:
Module
,CLFMixin
,SizeMixin
,DiffMixin
Creates a RNN model using LSTM layers for Shakespeare language models (next character prediction task).
This replicates the model structure in the paper [McMahan et al.[1]]. This is also recommended model by [Reddi et al.[2]].
Modified from FedML.
- Parameters:
References
- forward(input_seq: Tensor) Tensor [source]#
Forward pass.
- Parameters:
input_seq (torch.Tensor) – Shape
(batch_size, seq_len)
, dtypetorch.long
.- Returns:
Shape
(batch_size, vocab_size, seq_len)
, dtypetorch.float32
.- Return type: