ericsorides commited on
Commit
16336b5
1 Parent(s): 8720bd5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -1
README.md CHANGED
@@ -76,8 +76,9 @@ def generate_text(model_path, prompt, tokenizer, max_gen_tokens, total_sequence,
76
  inputs_dict = {}
77
  inputs_dict['input_ids'] = actual_input[:, :window].reshape(1, window).numpy()
78
  inputs_dict['attention_mask'] = first_attention
 
79
  for name in inputs_names:
80
- if name == 'input_ids' or name == 'attention_mask': continue
81
  inputs_dict[name] = np.zeros([1, n_heads, context-window, 96], dtype="float16")
82
  index = 0
83
  new_token = np.array([10])
@@ -108,6 +109,7 @@ def generate_text(model_path, prompt, tokenizer, max_gen_tokens, total_sequence,
108
  inputs_dict['input_ids']= total_input[:, j:next_index].reshape(1, window)
109
  elif name == 'attention_mask':
110
  inputs_dict['attention_mask'] = np.concatenate((np.zeros((1, total_sequence-next_index), dtype = 'int64'), np.ones((1, next_index), dtype = 'int64')), axis=1)
 
111
  else:
112
  old_name = name.replace("past_key_values", "present")
113
  inputs_dict[name] = outs_dictionary[old_name][:, :, next_index-old_j:context-window+(next_index - old_j), :]
 
76
  inputs_dict = {}
77
  inputs_dict['input_ids'] = actual_input[:, :window].reshape(1, window).numpy()
78
  inputs_dict['attention_mask'] = first_attention
79
+ inputs_dict['tree_attention'] = np.triu(-65504*np.ones(total_sequence), k= 1).astype('float16').reshape(1, 1, total_sequence, total_sequence)
80
  for name in inputs_names:
81
+ if name == 'input_ids' or name == 'attention_mask' or name == 'tree_attention': continue
82
  inputs_dict[name] = np.zeros([1, n_heads, context-window, 96], dtype="float16")
83
  index = 0
84
  new_token = np.array([10])
 
109
  inputs_dict['input_ids']= total_input[:, j:next_index].reshape(1, window)
110
  elif name == 'attention_mask':
111
  inputs_dict['attention_mask'] = np.concatenate((np.zeros((1, total_sequence-next_index), dtype = 'int64'), np.ones((1, next_index), dtype = 'int64')), axis=1)
112
+ elif name == 'tree_attention': continue
113
  else:
114
  old_name = name.replace("past_key_values", "present")
115
  inputs_dict[name] = outs_dictionary[old_name][:, :, next_index-old_j:context-window+(next_index - old_j), :]