ericsorides
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -92,8 +92,9 @@ def generate_text(model_path, prompt, tokenizer, max_gen_tokens, total_sequence,
|
|
92 |
inputs_dict = {}
|
93 |
inputs_dict['input_ids'] = actual_input[:, :window].reshape(1, window).numpy()
|
94 |
inputs_dict['attention_mask'] = first_attention
|
|
|
95 |
for name in inputs_names:
|
96 |
-
if name == 'input_ids' or name == 'attention_mask': continue
|
97 |
inputs_dict[name] = np.zeros([1, n_heads, context-window, 128], dtype="float16")
|
98 |
index = 0
|
99 |
new_token = np.array([10])
|
@@ -125,6 +126,7 @@ def generate_text(model_path, prompt, tokenizer, max_gen_tokens, total_sequence,
|
|
125 |
inputs_dict['input_ids']= total_input[:, j:next_index].reshape(1, window)
|
126 |
elif name == 'attention_mask':
|
127 |
inputs_dict['attention_mask'] = np.concatenate((np.zeros((1, total_sequence-next_index), dtype = 'int64'), np.ones((1, next_index), dtype = 'int64')), axis=1)
|
|
|
128 |
else:
|
129 |
old_name = name.replace("past_key_values", "present")
|
130 |
inputs_dict[name] = outs_dictionary[old_name][:, :, next_index-old_j:context-window+(next_index - old_j), :]
|
|
|
92 |
inputs_dict = {}
|
93 |
inputs_dict['input_ids'] = actual_input[:, :window].reshape(1, window).numpy()
|
94 |
inputs_dict['attention_mask'] = first_attention
|
95 |
+
inputs_dict['tree_attention'] = np.triu(-65504*np.ones(total_sequence), k= 1).astype('float16').reshape(1, 1, total_sequence, total_sequence)
|
96 |
for name in inputs_names:
|
97 |
+
if name == 'input_ids' or name == 'attention_mask' or name == 'tree_attention': continue
|
98 |
inputs_dict[name] = np.zeros([1, n_heads, context-window, 128], dtype="float16")
|
99 |
index = 0
|
100 |
new_token = np.array([10])
|
|
|
126 |
inputs_dict['input_ids']= total_input[:, j:next_index].reshape(1, window)
|
127 |
elif name == 'attention_mask':
|
128 |
inputs_dict['attention_mask'] = np.concatenate((np.zeros((1, total_sequence-next_index), dtype = 'int64'), np.ones((1, next_index), dtype = 'int64')), axis=1)
|
129 |
+
elif name == 'tree_attention': continue
|
130 |
else:
|
131 |
old_name = name.replace("past_key_values", "present")
|
132 |
inputs_dict[name] = outs_dictionary[old_name][:, :, next_index-old_j:context-window+(next_index - old_j), :]
|