ericsorides commited on
Commit
4c4b82f
·
verified ·
1 Parent(s): 7b7c57c

Update README.md

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