ericsorides commited on
Commit
adaebb5
·
2 Parent(s): 30c135c dcc3d76

Merge branch 'main' of hf.co:Esperanto/gemma-7b-it-kvc-fp16-onnx into main

Browse files
Files changed (2) hide show
  1. README.md +3 -1
  2. model.onnx +2 -2
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, 256], 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, 256], 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), :]
model.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:69e0553f31da72e4fd71ee54d9449e85a977471c78bda0b7b8332edf911e466d
3
- size 1187016
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd8359e74d5fca130cbe6b033308ce416f1d97175431e57da2c93a716028d996
3
+ size 1187072