madlag commited on
Commit
4b3c5a3
1 Parent(s): cf9a3e9

Adding graph

Browse files
Files changed (2) hide show
  1. README.md +1 -2
  2. model_card/pruning_info.js +174 -0
README.md CHANGED
@@ -38,8 +38,7 @@ A side-effect of the block pruning is that some of the attention heads are compl
38
 
39
  Here is a detailed view on how the remaining heads are distributed in the network after pruning.
40
 
41
- <div class="graph">
42
- <script src="files/pruning.js" id="e734ba51-7c6e-47ce-8d79-e9b39c10842b"></script></div>
43
 
44
  ## Density plot
45
 
 
38
 
39
  Here is a detailed view on how the remaining heads are distributed in the network after pruning.
40
 
41
+ <div class="graph"><script src="/madlag/bert-base-uncased-squadv1-x1.84-f88.7-d36-hybrid-filled-v1/raw/main/model_card/pruning_info.js" id="44668ea7-5bf1-4c37-bb7f-cbd653d2535b"></script></div>
 
42
 
43
  ## Density plot
44
 
model_card/pruning_info.js ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+ var fn = function() {
3
+
4
+ (function(root) {
5
+ function now() {
6
+ return new Date();
7
+ }
8
+
9
+ var force = false;
10
+
11
+ if (typeof root._bokeh_onload_callbacks === "undefined" || force === true) {
12
+ root._bokeh_onload_callbacks = [];
13
+ root._bokeh_is_loading = undefined;
14
+ }
15
+
16
+
17
+
18
+
19
+ var element = document.getElementById("44668ea7-5bf1-4c37-bb7f-cbd653d2535b");
20
+ if (element == null) {
21
+ console.warn("Bokeh: autoload.js configured with elementid '44668ea7-5bf1-4c37-bb7f-cbd653d2535b' but no matching script tag was found.")
22
+ }
23
+
24
+
25
+ function run_callbacks() {
26
+ try {
27
+ root._bokeh_onload_callbacks.forEach(function(callback) {
28
+ if (callback != null)
29
+ callback();
30
+ });
31
+ } finally {
32
+ delete root._bokeh_onload_callbacks
33
+ }
34
+ console.debug("Bokeh: all callbacks have finished");
35
+ }
36
+
37
+ function load_libs(css_urls, js_urls, callback) {
38
+ if (css_urls == null) css_urls = [];
39
+ if (js_urls == null) js_urls = [];
40
+
41
+ root._bokeh_onload_callbacks.push(callback);
42
+ if (root._bokeh_is_loading > 0) {
43
+ console.debug("Bokeh: BokehJS is being loaded, scheduling callback at", now());
44
+ return null;
45
+ }
46
+ if (js_urls == null || js_urls.length === 0) {
47
+ run_callbacks();
48
+ return null;
49
+ }
50
+ console.debug("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
51
+ root._bokeh_is_loading = css_urls.length + js_urls.length;
52
+
53
+ function on_load() {
54
+ root._bokeh_is_loading--;
55
+ if (root._bokeh_is_loading === 0) {
56
+ console.debug("Bokeh: all BokehJS libraries/stylesheets loaded");
57
+ run_callbacks()
58
+ }
59
+ }
60
+
61
+ function on_error() {
62
+ console.error("failed to load " + url);
63
+ }
64
+
65
+ for (var i = 0; i < css_urls.length; i++) {
66
+ var url = css_urls[i];
67
+ const element = document.createElement("link");
68
+ element.onload = on_load;
69
+ element.onerror = on_error;
70
+ element.rel = "stylesheet";
71
+ element.type = "text/css";
72
+ element.href = url;
73
+ console.debug("Bokeh: injecting link tag for BokehJS stylesheet: ", url);
74
+ document.body.appendChild(element);
75
+ }
76
+
77
+ const hashes = {"https://cdn.bokeh.org/bokeh/release/bokeh-2.2.3.min.js": "T2yuo9Oe71Cz/I4X9Ac5+gpEa5a8PpJCDlqKYO0CfAuEszu1JrXLl8YugMqYe3sM", "https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.2.3.min.js": "98GDGJ0kOMCUMUePhksaQ/GYgB3+NH9h996V88sh3aOiUNX3N+fLXAtry6xctSZ6", "https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.2.3.min.js": "89bArO+nlbP3sgakeHjCo1JYxYR5wufVgA3IbUvDY+K7w4zyxJqssu7wVnfeKCq8"};
78
+
79
+ for (var i = 0; i < js_urls.length; i++) {
80
+ var url = js_urls[i];
81
+ var element = document.createElement('script');
82
+ element.onload = on_load;
83
+ element.onerror = on_error;
84
+ element.async = false;
85
+ element.src = url;
86
+ if (url in hashes) {
87
+ element.crossOrigin = "anonymous";
88
+ element.integrity = "sha384-" + hashes[url];
89
+ }
90
+ console.debug("Bokeh: injecting script tag for BokehJS library: ", url);
91
+ document.head.appendChild(element);
92
+ }
93
+ };
94
+
95
+ function inject_raw_css(css) {
96
+ const element = document.createElement("style");
97
+ element.appendChild(document.createTextNode(css));
98
+ document.body.appendChild(element);
99
+ }
100
+
101
+
102
+ var js_urls = ["https://cdn.bokeh.org/bokeh/release/bokeh-2.2.3.min.js", "https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.2.3.min.js", "https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.2.3.min.js"];
103
+ var css_urls = [];
104
+
105
+
106
+ var inline_js = [
107
+ function(Bokeh) {
108
+ Bokeh.set_log_level("info");
109
+ },
110
+
111
+ function(Bokeh) {
112
+ (function() {
113
+ var fn = function() {
114
+ Bokeh.safely(function() {
115
+ (function(root) {
116
+ function embed_document(root) {
117
+
118
+ var docs_json = '{"93ff6b04-0dd5-4fe5-a9f3-3f150e7b986b":{"roots":{"references":[{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto"},"id":"1019","type":"Toolbar"},{"attributes":{"bottom":{"expr":{"id":"1022"}},"fill_alpha":{"value":0.1},"fill_color":{"value":"#ffcccc"},"line_alpha":{"value":0.1},"line_color":{"value":"#ffcccc"},"top":{"expr":{"id":"1023"}},"width":{"value":0.9},"x":{"field":"layers"}},"id":"1042","type":"VBar"},{"attributes":{},"id":"1033","type":"CategoricalTickFormatter"},{"attributes":{"fields":["active"]},"id":"1021","type":"Stack"},{"attributes":{"data":{"active":[7,5,9,9,11,10,9,8,10,6,7,5],"layers":["0","1","2","3","4","5","6","7","8","9","10","11"],"pruned":[5,7,3,3,1,2,3,4,2,6,5,7]},"selected":{"id":"1036"},"selection_policy":{"id":"1035"}},"id":"1024","type":"ColumnDataSource"},{"attributes":{"bottom":{"expr":{"id":"1022"}},"fill_color":{"value":"#ffcccc"},"line_color":{"value":"#ffcccc"},"top":{"expr":{"id":"1023"}},"width":{"value":0.9},"x":{"field":"layers"}},"id":"1041","type":"VBar"},{"attributes":{"data_source":{"id":"1039"},"glyph":{"id":"1041"},"hover_glyph":null,"muted_glyph":null,"name":"pruned","nonselection_glyph":{"id":"1042"},"selection_glyph":null,"view":{"id":"1044"}},"id":"1043","type":"GlyphRenderer"},{"attributes":{},"id":"1008","type":"CategoricalScale"},{"attributes":{"bottom":{"expr":{"id":"1020"}},"fill_color":{"value":"#0000ff"},"line_color":{"value":"#0000ff"},"top":{"expr":{"id":"1021"}},"width":{"value":0.9},"x":{"field":"layers"}},"id":"1026","type":"VBar"},{"attributes":{"start":0},"id":"1006","type":"DataRange1d"},{"attributes":{},"id":"1052","type":"UnionRenderers"},{"attributes":{"label":{"value":"pruned"},"renderers":[{"id":"1043"}]},"id":"1054","type":"LegendItem"},{"attributes":{"data":{"active":[7,5,9,9,11,10,9,8,10,6,7,5],"layers":["0","1","2","3","4","5","6","7","8","9","10","11"],"pruned":[5,7,3,3,1,2,3,4,2,6,5,7]},"selected":{"id":"1053"},"selection_policy":{"id":"1052"}},"id":"1039","type":"ColumnDataSource"},{"attributes":{},"id":"1053","type":"Selection"},{"attributes":{"source":{"id":"1039"}},"id":"1044","type":"CDSView"},{"attributes":{"axis":{"id":"1012"},"grid_line_color":null,"ticker":null},"id":"1014","type":"Grid"},{"attributes":{"axis_label":"Layer index","formatter":{"id":"1033"},"minor_tick_line_color":null,"ticker":{"id":"1013"}},"id":"1012","type":"CategoricalAxis"},{"attributes":{},"id":"1010","type":"LinearScale"},{"attributes":{"fields":["active","pruned"]},"id":"1023","type":"Stack"},{"attributes":{},"id":"1013","type":"CategoricalTicker"},{"attributes":{"source":{"id":"1024"}},"id":"1029","type":"CDSView"},{"attributes":{"factors":["0","1","2","3","4","5","6","7","8","9","10","11"],"range_padding":0.1},"id":"1004","type":"FactorRange"},{"attributes":{"above":[{"id":"1055"}],"below":[{"id":"1012"}],"center":[{"id":"1014"},{"id":"1018"},{"id":"1037"}],"left":[{"id":"1015"}],"outline_line_color":null,"plot_height":400,"renderers":[{"id":"1028"},{"id":"1043"}],"title":{"id":"1002"},"toolbar":{"id":"1019"},"toolbar_location":null,"x_range":{"id":"1004"},"x_scale":{"id":"1008"},"y_range":{"id":"1006"},"y_scale":{"id":"1010"}},"id":"1001","subtype":"Figure","type":"Plot"},{"attributes":{"data_source":{"id":"1024"},"glyph":{"id":"1026"},"hover_glyph":null,"muted_glyph":null,"name":"active","nonselection_glyph":{"id":"1027"},"selection_glyph":null,"view":{"id":"1029"}},"id":"1028","type":"GlyphRenderer"},{"attributes":{},"id":"1016","type":"BasicTicker"},{"attributes":{"bottom":{"expr":{"id":"1020"}},"fill_alpha":{"value":0.1},"fill_color":{"value":"#0000ff"},"line_alpha":{"value":0.1},"line_color":{"value":"#0000ff"},"top":{"expr":{"id":"1021"}},"width":{"value":0.9},"x":{"field":"layers"}},"id":"1027","type":"VBar"},{"attributes":{},"id":"1035","type":"UnionRenderers"},{"attributes":{"label":{"value":"active"},"renderers":[{"id":"1028"}]},"id":"1038","type":"LegendItem"},{"attributes":{"axis_label":"Heads count","formatter":{"id":"1031"},"minor_tick_line_color":null,"ticker":{"id":"1016"}},"id":"1015","type":"LinearAxis"},{"attributes":{},"id":"1036","type":"Selection"},{"attributes":{"fields":[]},"id":"1020","type":"Stack"},{"attributes":{"label":{"value":"pruned"},"renderers":[{"id":"1043"}]},"id":"1057","type":"LegendItem"},{"attributes":{"items":[{"id":"1038"},{"id":"1054"}],"location":null},"id":"1037","type":"Legend"},{"attributes":{"axis":{"id":"1015"},"dimension":1,"ticker":null},"id":"1018","type":"Grid"},{"attributes":{"label":{"value":"active"},"renderers":[{"id":"1028"}]},"id":"1056","type":"LegendItem"},{"attributes":{"text":"Pruned Transformer Heads"},"id":"1002","type":"Title"},{"attributes":{},"id":"1031","type":"BasicTickFormatter"},{"attributes":{"fields":["active"]},"id":"1022","type":"Stack"},{"attributes":{"items":[{"id":"1056"},{"id":"1057"}],"location":[10,0],"orientation":"horizontal"},"id":"1055","type":"Legend"}],"root_ids":["1001"]},"title":"Bokeh Application","version":"2.2.3"}}';
119
+ var render_items = [{"docid":"93ff6b04-0dd5-4fe5-a9f3-3f150e7b986b","root_ids":["1001"],"roots":{"1001":"44668ea7-5bf1-4c37-bb7f-cbd653d2535b"}}];
120
+ root.Bokeh.embed.embed_items(docs_json, render_items);
121
+
122
+ }
123
+ if (root.Bokeh !== undefined) {
124
+ embed_document(root);
125
+ } else {
126
+ var attempts = 0;
127
+ var timer = setInterval(function(root) {
128
+ if (root.Bokeh !== undefined) {
129
+ clearInterval(timer);
130
+ embed_document(root);
131
+ } else {
132
+ attempts++;
133
+ if (attempts > 100) {
134
+ clearInterval(timer);
135
+ console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
136
+ }
137
+ }
138
+ }, 10, root)
139
+ }
140
+ })(window);
141
+ });
142
+ };
143
+ if (document.readyState != "loading") fn();
144
+ else document.addEventListener("DOMContentLoaded", fn);
145
+ })();
146
+ },
147
+ function(Bokeh) {
148
+
149
+
150
+ }
151
+ ];
152
+
153
+ function run_inline_js() {
154
+
155
+ for (var i = 0; i < inline_js.length; i++) {
156
+ inline_js[i].call(root, root.Bokeh);
157
+ }
158
+
159
+ }
160
+
161
+ if (root._bokeh_is_loading === 0) {
162
+ console.debug("Bokeh: BokehJS loaded, going straight to plotting");
163
+ run_inline_js();
164
+ } else {
165
+ load_libs(css_urls, js_urls, function() {
166
+ console.debug("Bokeh: BokehJS plotting callback run at", now());
167
+ run_inline_js();
168
+ });
169
+ }
170
+ }(window));
171
+ };
172
+ if (document.readyState != "loading") fn();
173
+ else document.addEventListener("DOMContentLoaded", fn);
174
+ })();