ericsorides
commited on
Merge branch 'main' of hf.co:Esperanto/llama3-8b-Instruct-kvc-fp16-onnx into main
Browse files
README.md
CHANGED
@@ -79,8 +79,9 @@ def generate_text(model_path, prompt, tokenizer, max_gen_tokens, total_sequence,
|
|
79 |
inputs_dict = {}
|
80 |
inputs_dict['input_ids'] = actual_input[:, :window].reshape(1, window).numpy()
|
81 |
inputs_dict['attention_mask'] = first_attention
|
|
|
82 |
for name in inputs_names:
|
83 |
-
if name == 'input_ids' or name == 'attention_mask': 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,6 +113,7 @@ def generate_text(model_path, prompt, tokenizer, max_gen_tokens, total_sequence,
|
|
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 |
else:
|
116 |
old_name = name.replace("past_key_values", "present")
|
117 |
inputs_dict[name] = outs_dictionary[old_name][:, :, next_index-old_j:context-window+(next_index - old_j), :]
|
|
|
79 |
inputs_dict = {}
|
80 |
inputs_dict['input_ids'] = actual_input[:, :window].reshape(1, window).numpy()
|
81 |
inputs_dict['attention_mask'] = first_attention
|
82 |
+
inputs_dict['tree_attention'] = np.triu(-65504*np.ones(total_sequence), k= 1).astype('float16').reshape(1, 1, total_sequence, total_sequence)
|
83 |
for name in inputs_names:
|
84 |
+
if name == 'input_ids' or name == 'attention_mask' or name == 'tree_attention': 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 |
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 |
+
elif name == 'tree_attention': continue
|
117 |
else:
|
118 |
old_name = name.replace("past_key_values", "present")
|
119 |
inputs_dict[name] = outs_dictionary[old_name][:, :, next_index-old_j:context-window+(next_index - old_j), :]
|