ericsorides commited on
Commit
588ef21
·
verified ·
1 Parent(s): ed4089e

Update README.md

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