You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/active_learning/system_under_learning/neural_network_suls/python/connectors/lsharp_connector_transformer.py
Copy file name to clipboardExpand all lines: source/active_learning/system_under_learning/neural_network_suls/python/connectors/paul_connector_batch.py
-52Lines changed: 0 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,4 @@
1
1
"""
2
-
Like the binary state causal transformer connector, but also returns confidence of transformer as well.
3
-
4
2
Documentation of CPython-API: https://docs.python.org/3/c-api/index.html
"""Gets the attention. Make sure to keep the convention: Keys go from 1...number of attention vectors,
119
-
as 0 is reserved for the networks output.
120
-
121
-
Returns:
122
-
output (dict): 1...n_attn -> attn_vector
123
-
"""
124
-
DO_FIRST_ONLY=True
125
-
126
-
ifDO_FIRST_ONLY:
127
-
attn=torch.squeeze(output["hidden_states"][1].detach().cpu()).numpy() # (b_size, maxlen_seq, hidden_dim); b_size here will always be 1 and squeezed out!
128
-
#attn = torch.squeeze(output["attentions"][0].detach()).numpy() # (b_size, n_heads, maxlen_seq, maxlen_seq); b_size here will always be 1 and squeezed out!
129
-
#attn = np.mean(attn, axis=0) # using the attn and not the states
Copy file name to clipboardExpand all lines: source/active_learning/system_under_learning/neural_network_suls/python/connectors/todo_refactor/nn_connector_taysir_track_1.py
0 commit comments