class_docstr: Multi-layer BiLSTM model for language detecting. A recreation of "A reproduction of Apple's bi-directional LSTM models
  for language identification in short strings." (Toftrup et al 2021)
  
  Arxiv: https://arxiv.org/abs/2102.06282
  GitHub: https://github.com/AU-DIS/LSTM_langid
  
  This class is similar to https://github.com/AU-DIS/LSTM_langid/blob/main/src/LSTMLID.py
docstr: Build language mask if a lang subset is specified (e.g. ["en", "fr"])
  
  The mask will be added to the results to set the prediction scores of illegal languages to -inf
code: def build_lang_mask(self, device):
      """
      Build language mask if a lang subset is specified (e.g. ["en", "fr"])
  
      The mask will be added to the results to set the prediction scores of illegal languages to -inf
      """
      if self.lang_subset:
          lang_mask_list = [
              0.0 if lang in self.lang_subset else -float("inf")
              for lang in self.idx_to_tag
          ]
          self.lang_mask = torch.tensor(
              lang_mask_list, device=device, dtype=torch.float
          )
      else:
          self.lang_mask = torch.zeros(
              len(self.idx_to_tag), device=device, dtype=torch.float
          )
  
file_path: stanza/stanza/models/langid/model.py
imports: import os
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling the LangIDBiLSTM obj's underlying member method code with example usage: obj.build_lang_mask(device) without return types