Mya-Mya commited on
Commit
35d59df
·
1 Parent(s): 5ea6a45

Create requirements, Update T5Mixer

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -0
  2. t5mixer.py +1 -2
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ transformers
t5mixer.py CHANGED
@@ -39,12 +39,11 @@ class T5Mixer(Mixer):
39
  for i in range(max_n_tokens):
40
  od = self.model.decoder.forward(
41
  input_ids=to,
42
- encoder_hidden_states=es+torch.randn_like(es)*noise_rate
43
  )
44
  sd = od.last_hidden_state
45
  l = self.model.lm_head(sd[0, -1, :])
46
  t_next = l.argmax()
47
- ttext_next = self.tokenid_to_tokentext[int(t_next)]
48
  to = torch.cat((to, t_next[None, None]), dim=-1)
49
  if t_next == self.tokenizer.eos_token_id:
50
  break
 
39
  for i in range(max_n_tokens):
40
  od = self.model.decoder.forward(
41
  input_ids=to,
42
+ encoder_hidden_states=es
43
  )
44
  sd = od.last_hidden_state
45
  l = self.model.lm_head(sd[0, -1, :])
46
  t_next = l.argmax()
 
47
  to = torch.cat((to, t_next[None, None]), dim=-1)
48
  if t_next == self.tokenizer.eos_token_id:
49
  break