Alex Cabrera commited on
Commit
8894e1f
1 Parent(s): 65d6c47
.dockerignore ADDED
@@ -0,0 +1 @@
 
1
+ .git
.zeno_cache/OUTPUThuman.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4cdb204864c66d497e210a2349247ca45b498539088d27642b2d1c94f9b4b02
3
+ size 549553
.zeno_cache/POSTDISTILLbert_scorehuman.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4066a8d5da3f7e5cb0a259bc843a7ee88666ce876becdd684a68ec69c422362b
3
+ size 50680
.zeno_cache/PREDISTILLlength.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24d45a20c33742deb9f8ed76718f01a9d2b5d35b7f4f371b55b1ed6e26f70b1c
3
+ size 37806
.zeno_cache/folders.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec0a6ccf9debf1c16781445c4b9106080d00478b0559469336db7c7b7b9711c8
3
+ size 5
.zeno_cache/reports.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec0a6ccf9debf1c16781445c4b9106080d00478b0559469336db7c7b7b9711c8
3
+ size 5
.zeno_cache/view.mjs ADDED
@@ -0,0 +1,753 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function noop() { }
2
+ function run(fn) {
3
+ return fn();
4
+ }
5
+ function blank_object() {
6
+ return Object.create(null);
7
+ }
8
+ function run_all(fns) {
9
+ fns.forEach(run);
10
+ }
11
+ function is_function(thing) {
12
+ return typeof thing === 'function';
13
+ }
14
+ function safe_not_equal(a, b) {
15
+ return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
16
+ }
17
+ function is_empty(obj) {
18
+ return Object.keys(obj).length === 0;
19
+ }
20
+
21
+ // Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM
22
+ // at the end of hydration without touching the remaining nodes.
23
+ let is_hydrating = false;
24
+ function start_hydrating() {
25
+ is_hydrating = true;
26
+ }
27
+ function end_hydrating() {
28
+ is_hydrating = false;
29
+ }
30
+ function upper_bound(low, high, key, value) {
31
+ // Return first index of value larger than input value in the range [low, high)
32
+ while (low < high) {
33
+ const mid = low + ((high - low) >> 1);
34
+ if (key(mid) <= value) {
35
+ low = mid + 1;
36
+ }
37
+ else {
38
+ high = mid;
39
+ }
40
+ }
41
+ return low;
42
+ }
43
+ function init_hydrate(target) {
44
+ if (target.hydrate_init)
45
+ return;
46
+ target.hydrate_init = true;
47
+ // We know that all children have claim_order values since the unclaimed have been detached if target is not <head>
48
+ let children = target.childNodes;
49
+ // If target is <head>, there may be children without claim_order
50
+ if (target.nodeName === 'HEAD') {
51
+ const myChildren = [];
52
+ for (let i = 0; i < children.length; i++) {
53
+ const node = children[i];
54
+ if (node.claim_order !== undefined) {
55
+ myChildren.push(node);
56
+ }
57
+ }
58
+ children = myChildren;
59
+ }
60
+ /*
61
+ * Reorder claimed children optimally.
62
+ * We can reorder claimed children optimally by finding the longest subsequence of
63
+ * nodes that are already claimed in order and only moving the rest. The longest
64
+ * subsequence subsequence of nodes that are claimed in order can be found by
65
+ * computing the longest increasing subsequence of .claim_order values.
66
+ *
67
+ * This algorithm is optimal in generating the least amount of reorder operations
68
+ * possible.
69
+ *
70
+ * Proof:
71
+ * We know that, given a set of reordering operations, the nodes that do not move
72
+ * always form an increasing subsequence, since they do not move among each other
73
+ * meaning that they must be already ordered among each other. Thus, the maximal
74
+ * set of nodes that do not move form a longest increasing subsequence.
75
+ */
76
+ // Compute longest increasing subsequence
77
+ // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j
78
+ const m = new Int32Array(children.length + 1);
79
+ // Predecessor indices + 1
80
+ const p = new Int32Array(children.length);
81
+ m[0] = -1;
82
+ let longest = 0;
83
+ for (let i = 0; i < children.length; i++) {
84
+ const current = children[i].claim_order;
85
+ // Find the largest subsequence length such that it ends in a value less than our current value
86
+ // upper_bound returns first greater value, so we subtract one
87
+ // with fast path for when we are on the current longest subsequence
88
+ const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;
89
+ p[i] = m[seqLen] + 1;
90
+ const newLen = seqLen + 1;
91
+ // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.
92
+ m[newLen] = i;
93
+ longest = Math.max(newLen, longest);
94
+ }
95
+ // The longest increasing subsequence of nodes (initially reversed)
96
+ const lis = [];
97
+ // The rest of the nodes, nodes that will be moved
98
+ const toMove = [];
99
+ let last = children.length - 1;
100
+ for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {
101
+ lis.push(children[cur - 1]);
102
+ for (; last >= cur; last--) {
103
+ toMove.push(children[last]);
104
+ }
105
+ last--;
106
+ }
107
+ for (; last >= 0; last--) {
108
+ toMove.push(children[last]);
109
+ }
110
+ lis.reverse();
111
+ // We sort the nodes being moved to guarantee that their insertion order matches the claim order
112
+ toMove.sort((a, b) => a.claim_order - b.claim_order);
113
+ // Finally, we move the nodes
114
+ for (let i = 0, j = 0; i < toMove.length; i++) {
115
+ while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {
116
+ j++;
117
+ }
118
+ const anchor = j < lis.length ? lis[j] : null;
119
+ target.insertBefore(toMove[i], anchor);
120
+ }
121
+ }
122
+ function append(target, node) {
123
+ target.appendChild(node);
124
+ }
125
+ function append_styles(target, style_sheet_id, styles) {
126
+ const append_styles_to = get_root_for_style(target);
127
+ if (!append_styles_to.getElementById(style_sheet_id)) {
128
+ const style = element('style');
129
+ style.id = style_sheet_id;
130
+ style.textContent = styles;
131
+ append_stylesheet(append_styles_to, style);
132
+ }
133
+ }
134
+ function get_root_for_style(node) {
135
+ if (!node)
136
+ return document;
137
+ const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
138
+ if (root && root.host) {
139
+ return root;
140
+ }
141
+ return node.ownerDocument;
142
+ }
143
+ function append_stylesheet(node, style) {
144
+ append(node.head || node, style);
145
+ }
146
+ function append_hydration(target, node) {
147
+ if (is_hydrating) {
148
+ init_hydrate(target);
149
+ if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentElement !== target))) {
150
+ target.actual_end_child = target.firstChild;
151
+ }
152
+ // Skip nodes of undefined ordering
153
+ while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {
154
+ target.actual_end_child = target.actual_end_child.nextSibling;
155
+ }
156
+ if (node !== target.actual_end_child) {
157
+ // We only insert if the ordering of this node should be modified or the parent node is not target
158
+ if (node.claim_order !== undefined || node.parentNode !== target) {
159
+ target.insertBefore(node, target.actual_end_child);
160
+ }
161
+ }
162
+ else {
163
+ target.actual_end_child = node.nextSibling;
164
+ }
165
+ }
166
+ else if (node.parentNode !== target || node.nextSibling !== null) {
167
+ target.appendChild(node);
168
+ }
169
+ }
170
+ function insert_hydration(target, node, anchor) {
171
+ if (is_hydrating && !anchor) {
172
+ append_hydration(target, node);
173
+ }
174
+ else if (node.parentNode !== target || node.nextSibling != anchor) {
175
+ target.insertBefore(node, anchor || null);
176
+ }
177
+ }
178
+ function detach(node) {
179
+ node.parentNode.removeChild(node);
180
+ }
181
+ function element(name) {
182
+ return document.createElement(name);
183
+ }
184
+ function text(data) {
185
+ return document.createTextNode(data);
186
+ }
187
+ function space() {
188
+ return text(' ');
189
+ }
190
+ function attr(node, attribute, value) {
191
+ if (value == null)
192
+ node.removeAttribute(attribute);
193
+ else if (node.getAttribute(attribute) !== value)
194
+ node.setAttribute(attribute, value);
195
+ }
196
+ function children(element) {
197
+ return Array.from(element.childNodes);
198
+ }
199
+ function init_claim_info(nodes) {
200
+ if (nodes.claim_info === undefined) {
201
+ nodes.claim_info = { last_index: 0, total_claimed: 0 };
202
+ }
203
+ }
204
+ function claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {
205
+ // Try to find nodes in an order such that we lengthen the longest increasing subsequence
206
+ init_claim_info(nodes);
207
+ const resultNode = (() => {
208
+ // We first try to find an element after the previous one
209
+ for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {
210
+ const node = nodes[i];
211
+ if (predicate(node)) {
212
+ const replacement = processNode(node);
213
+ if (replacement === undefined) {
214
+ nodes.splice(i, 1);
215
+ }
216
+ else {
217
+ nodes[i] = replacement;
218
+ }
219
+ if (!dontUpdateLastIndex) {
220
+ nodes.claim_info.last_index = i;
221
+ }
222
+ return node;
223
+ }
224
+ }
225
+ // Otherwise, we try to find one before
226
+ // We iterate in reverse so that we don't go too far back
227
+ for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {
228
+ const node = nodes[i];
229
+ if (predicate(node)) {
230
+ const replacement = processNode(node);
231
+ if (replacement === undefined) {
232
+ nodes.splice(i, 1);
233
+ }
234
+ else {
235
+ nodes[i] = replacement;
236
+ }
237
+ if (!dontUpdateLastIndex) {
238
+ nodes.claim_info.last_index = i;
239
+ }
240
+ else if (replacement === undefined) {
241
+ // Since we spliced before the last_index, we decrease it
242
+ nodes.claim_info.last_index--;
243
+ }
244
+ return node;
245
+ }
246
+ }
247
+ // If we can't find any matching node, we create a new one
248
+ return createNode();
249
+ })();
250
+ resultNode.claim_order = nodes.claim_info.total_claimed;
251
+ nodes.claim_info.total_claimed += 1;
252
+ return resultNode;
253
+ }
254
+ function claim_element_base(nodes, name, attributes, create_element) {
255
+ return claim_node(nodes, (node) => node.nodeName === name, (node) => {
256
+ const remove = [];
257
+ for (let j = 0; j < node.attributes.length; j++) {
258
+ const attribute = node.attributes[j];
259
+ if (!attributes[attribute.name]) {
260
+ remove.push(attribute.name);
261
+ }
262
+ }
263
+ remove.forEach(v => node.removeAttribute(v));
264
+ return undefined;
265
+ }, () => create_element(name));
266
+ }
267
+ function claim_element(nodes, name, attributes) {
268
+ return claim_element_base(nodes, name, attributes, element);
269
+ }
270
+ function claim_text(nodes, data) {
271
+ return claim_node(nodes, (node) => node.nodeType === 3, (node) => {
272
+ const dataStr = '' + data;
273
+ if (node.data.startsWith(dataStr)) {
274
+ if (node.data.length !== dataStr.length) {
275
+ return node.splitText(dataStr.length);
276
+ }
277
+ }
278
+ else {
279
+ node.data = dataStr;
280
+ }
281
+ }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements
282
+ );
283
+ }
284
+ function claim_space(nodes) {
285
+ return claim_text(nodes, ' ');
286
+ }
287
+ function set_data(text, data) {
288
+ data = '' + data;
289
+ if (text.wholeText !== data)
290
+ text.data = data;
291
+ }
292
+
293
+ let current_component;
294
+ function set_current_component(component) {
295
+ current_component = component;
296
+ }
297
+
298
+ const dirty_components = [];
299
+ const binding_callbacks = [];
300
+ const render_callbacks = [];
301
+ const flush_callbacks = [];
302
+ const resolved_promise = Promise.resolve();
303
+ let update_scheduled = false;
304
+ function schedule_update() {
305
+ if (!update_scheduled) {
306
+ update_scheduled = true;
307
+ resolved_promise.then(flush);
308
+ }
309
+ }
310
+ function add_render_callback(fn) {
311
+ render_callbacks.push(fn);
312
+ }
313
+ // flush() calls callbacks in this order:
314
+ // 1. All beforeUpdate callbacks, in order: parents before children
315
+ // 2. All bind:this callbacks, in reverse order: children before parents.
316
+ // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
317
+ // for afterUpdates called during the initial onMount, which are called in
318
+ // reverse order: children before parents.
319
+ // Since callbacks might update component values, which could trigger another
320
+ // call to flush(), the following steps guard against this:
321
+ // 1. During beforeUpdate, any updated components will be added to the
322
+ // dirty_components array and will cause a reentrant call to flush(). Because
323
+ // the flush index is kept outside the function, the reentrant call will pick
324
+ // up where the earlier call left off and go through all dirty components. The
325
+ // current_component value is saved and restored so that the reentrant call will
326
+ // not interfere with the "parent" flush() call.
327
+ // 2. bind:this callbacks cannot trigger new flush() calls.
328
+ // 3. During afterUpdate, any updated components will NOT have their afterUpdate
329
+ // callback called a second time; the seen_callbacks set, outside the flush()
330
+ // function, guarantees this behavior.
331
+ const seen_callbacks = new Set();
332
+ let flushidx = 0; // Do *not* move this inside the flush() function
333
+ function flush() {
334
+ const saved_component = current_component;
335
+ do {
336
+ // first, call beforeUpdate functions
337
+ // and update components
338
+ while (flushidx < dirty_components.length) {
339
+ const component = dirty_components[flushidx];
340
+ flushidx++;
341
+ set_current_component(component);
342
+ update(component.$$);
343
+ }
344
+ set_current_component(null);
345
+ dirty_components.length = 0;
346
+ flushidx = 0;
347
+ while (binding_callbacks.length)
348
+ binding_callbacks.pop()();
349
+ // then, once components are updated, call
350
+ // afterUpdate functions. This may cause
351
+ // subsequent updates...
352
+ for (let i = 0; i < render_callbacks.length; i += 1) {
353
+ const callback = render_callbacks[i];
354
+ if (!seen_callbacks.has(callback)) {
355
+ // ...so guard against infinite loops
356
+ seen_callbacks.add(callback);
357
+ callback();
358
+ }
359
+ }
360
+ render_callbacks.length = 0;
361
+ } while (dirty_components.length);
362
+ while (flush_callbacks.length) {
363
+ flush_callbacks.pop()();
364
+ }
365
+ update_scheduled = false;
366
+ seen_callbacks.clear();
367
+ set_current_component(saved_component);
368
+ }
369
+ function update($$) {
370
+ if ($$.fragment !== null) {
371
+ $$.update();
372
+ run_all($$.before_update);
373
+ const dirty = $$.dirty;
374
+ $$.dirty = [-1];
375
+ $$.fragment && $$.fragment.p($$.ctx, dirty);
376
+ $$.after_update.forEach(add_render_callback);
377
+ }
378
+ }
379
+ const outroing = new Set();
380
+ function transition_in(block, local) {
381
+ if (block && block.i) {
382
+ outroing.delete(block);
383
+ block.i(local);
384
+ }
385
+ }
386
+ function mount_component(component, target, anchor, customElement) {
387
+ const { fragment, on_mount, on_destroy, after_update } = component.$$;
388
+ fragment && fragment.m(target, anchor);
389
+ if (!customElement) {
390
+ // onMount happens before the initial afterUpdate
391
+ add_render_callback(() => {
392
+ const new_on_destroy = on_mount.map(run).filter(is_function);
393
+ if (on_destroy) {
394
+ on_destroy.push(...new_on_destroy);
395
+ }
396
+ else {
397
+ // Edge case - component was destroyed immediately,
398
+ // most likely as a result of a binding initialising
399
+ run_all(new_on_destroy);
400
+ }
401
+ component.$$.on_mount = [];
402
+ });
403
+ }
404
+ after_update.forEach(add_render_callback);
405
+ }
406
+ function destroy_component(component, detaching) {
407
+ const $$ = component.$$;
408
+ if ($$.fragment !== null) {
409
+ run_all($$.on_destroy);
410
+ $$.fragment && $$.fragment.d(detaching);
411
+ // TODO null out other refs, including component.$$ (but need to
412
+ // preserve final state?)
413
+ $$.on_destroy = $$.fragment = null;
414
+ $$.ctx = [];
415
+ }
416
+ }
417
+ function make_dirty(component, i) {
418
+ if (component.$$.dirty[0] === -1) {
419
+ dirty_components.push(component);
420
+ schedule_update();
421
+ component.$$.dirty.fill(0);
422
+ }
423
+ component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
424
+ }
425
+ function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
426
+ const parent_component = current_component;
427
+ set_current_component(component);
428
+ const $$ = component.$$ = {
429
+ fragment: null,
430
+ ctx: null,
431
+ // state
432
+ props,
433
+ update: noop,
434
+ not_equal,
435
+ bound: blank_object(),
436
+ // lifecycle
437
+ on_mount: [],
438
+ on_destroy: [],
439
+ on_disconnect: [],
440
+ before_update: [],
441
+ after_update: [],
442
+ context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
443
+ // everything else
444
+ callbacks: blank_object(),
445
+ dirty,
446
+ skip_bound: false,
447
+ root: options.target || parent_component.$$.root
448
+ };
449
+ append_styles && append_styles($$.root);
450
+ let ready = false;
451
+ $$.ctx = instance
452
+ ? instance(component, options.props || {}, (i, ret, ...rest) => {
453
+ const value = rest.length ? rest[0] : ret;
454
+ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
455
+ if (!$$.skip_bound && $$.bound[i])
456
+ $$.bound[i](value);
457
+ if (ready)
458
+ make_dirty(component, i);
459
+ }
460
+ return ret;
461
+ })
462
+ : [];
463
+ $$.update();
464
+ ready = true;
465
+ run_all($$.before_update);
466
+ // `false` as a special case of no DOM component
467
+ $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
468
+ if (options.target) {
469
+ if (options.hydrate) {
470
+ start_hydrating();
471
+ const nodes = children(options.target);
472
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
473
+ $$.fragment && $$.fragment.l(nodes);
474
+ nodes.forEach(detach);
475
+ }
476
+ else {
477
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
478
+ $$.fragment && $$.fragment.c();
479
+ }
480
+ if (options.intro)
481
+ transition_in(component.$$.fragment);
482
+ mount_component(component, options.target, options.anchor, options.customElement);
483
+ end_hydrating();
484
+ flush();
485
+ }
486
+ set_current_component(parent_component);
487
+ }
488
+ /**
489
+ * Base class for Svelte components. Used when dev=false.
490
+ */
491
+ class SvelteComponent {
492
+ $destroy() {
493
+ destroy_component(this, 1);
494
+ this.$destroy = noop;
495
+ }
496
+ $on(type, callback) {
497
+ const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
498
+ callbacks.push(callback);
499
+ return () => {
500
+ const index = callbacks.indexOf(callback);
501
+ if (index !== -1)
502
+ callbacks.splice(index, 1);
503
+ };
504
+ }
505
+ $set($$props) {
506
+ if (this.$$set && !is_empty($$props)) {
507
+ this.$$.skip_bound = true;
508
+ this.$$set($$props);
509
+ this.$$.skip_bound = false;
510
+ }
511
+ }
512
+ }
513
+
514
+ /* src/InstanceView.svelte generated by Svelte v3.49.0 */
515
+
516
+ function add_css(target) {
517
+ append_styles(target, "svelte-ohpquu", ".label.svelte-ohpquu{font-size:12px;color:rgba(0, 0, 0, 0.5);font-variant:small-caps}.value.svelte-ohpquu{font-size:12px}.box.svelte-ohpquu{padding:10px;border:0.5px solid rgb(224, 224, 224)}");
518
+ }
519
+
520
+ // (22:2) {#if modelColumn && entry[modelColumn] !== undefined}
521
+ function create_if_block(ctx) {
522
+ let br;
523
+ let t0;
524
+ let span0;
525
+ let t1;
526
+ let t2;
527
+ let span1;
528
+ let t3_value = /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] + "";
529
+ let t3;
530
+
531
+ return {
532
+ c() {
533
+ br = element("br");
534
+ t0 = space();
535
+ span0 = element("span");
536
+ t1 = text("output:");
537
+ t2 = space();
538
+ span1 = element("span");
539
+ t3 = text(t3_value);
540
+ this.h();
541
+ },
542
+ l(nodes) {
543
+ br = claim_element(nodes, "BR", {});
544
+ t0 = claim_space(nodes);
545
+ span0 = claim_element(nodes, "SPAN", { class: true });
546
+ var span0_nodes = children(span0);
547
+ t1 = claim_text(span0_nodes, "output:");
548
+ span0_nodes.forEach(detach);
549
+ t2 = claim_space(nodes);
550
+ span1 = claim_element(nodes, "SPAN", { class: true });
551
+ var span1_nodes = children(span1);
552
+ t3 = claim_text(span1_nodes, t3_value);
553
+ span1_nodes.forEach(detach);
554
+ this.h();
555
+ },
556
+ h() {
557
+ attr(span0, "class", "label svelte-ohpquu");
558
+ attr(span1, "class", "value svelte-ohpquu");
559
+ },
560
+ m(target, anchor) {
561
+ insert_hydration(target, br, anchor);
562
+ insert_hydration(target, t0, anchor);
563
+ insert_hydration(target, span0, anchor);
564
+ append_hydration(span0, t1);
565
+ insert_hydration(target, t2, anchor);
566
+ insert_hydration(target, span1, anchor);
567
+ append_hydration(span1, t3);
568
+ },
569
+ p(ctx, dirty) {
570
+ if (dirty & /*entry, modelColumn*/ 3 && t3_value !== (t3_value = /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] + "")) set_data(t3, t3_value);
571
+ },
572
+ d(detaching) {
573
+ if (detaching) detach(br);
574
+ if (detaching) detach(t0);
575
+ if (detaching) detach(span0);
576
+ if (detaching) detach(t2);
577
+ if (detaching) detach(span1);
578
+ }
579
+ };
580
+ }
581
+
582
+ function create_fragment(ctx) {
583
+ let div;
584
+ let span0;
585
+ let t0_value = /*entry*/ ctx[0][/*dataColumn*/ ctx[3]] + "";
586
+ let t0;
587
+ let t1;
588
+ let br;
589
+ let t2;
590
+ let span1;
591
+ let t3;
592
+ let span2;
593
+ let t4_value = /*entry*/ ctx[0][/*labelColumn*/ ctx[2]] + "";
594
+ let t4;
595
+ let t5;
596
+ let if_block = /*modelColumn*/ ctx[1] && /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] !== undefined && create_if_block(ctx);
597
+
598
+ return {
599
+ c() {
600
+ div = element("div");
601
+ span0 = element("span");
602
+ t0 = text(t0_value);
603
+ t1 = space();
604
+ br = element("br");
605
+ t2 = space();
606
+ span1 = element("span");
607
+ t3 = text("label: ");
608
+ span2 = element("span");
609
+ t4 = text(t4_value);
610
+ t5 = space();
611
+ if (if_block) if_block.c();
612
+ this.h();
613
+ },
614
+ l(nodes) {
615
+ div = claim_element(nodes, "DIV", { class: true });
616
+ var div_nodes = children(div);
617
+ span0 = claim_element(div_nodes, "SPAN", {});
618
+ var span0_nodes = children(span0);
619
+ t0 = claim_text(span0_nodes, t0_value);
620
+ span0_nodes.forEach(detach);
621
+ t1 = claim_space(div_nodes);
622
+ br = claim_element(div_nodes, "BR", {});
623
+ t2 = claim_space(div_nodes);
624
+ span1 = claim_element(div_nodes, "SPAN", { class: true });
625
+ var span1_nodes = children(span1);
626
+ t3 = claim_text(span1_nodes, "label: ");
627
+ span1_nodes.forEach(detach);
628
+ span2 = claim_element(div_nodes, "SPAN", { class: true });
629
+ var span2_nodes = children(span2);
630
+ t4 = claim_text(span2_nodes, t4_value);
631
+ span2_nodes.forEach(detach);
632
+ t5 = claim_space(div_nodes);
633
+ if (if_block) if_block.l(div_nodes);
634
+ div_nodes.forEach(detach);
635
+ this.h();
636
+ },
637
+ h() {
638
+ attr(span1, "class", "label svelte-ohpquu");
639
+ attr(span2, "class", "value svelte-ohpquu");
640
+ attr(div, "class", "box svelte-ohpquu");
641
+ },
642
+ m(target, anchor) {
643
+ insert_hydration(target, div, anchor);
644
+ append_hydration(div, span0);
645
+ append_hydration(span0, t0);
646
+ append_hydration(div, t1);
647
+ append_hydration(div, br);
648
+ append_hydration(div, t2);
649
+ append_hydration(div, span1);
650
+ append_hydration(span1, t3);
651
+ append_hydration(div, span2);
652
+ append_hydration(span2, t4);
653
+ append_hydration(div, t5);
654
+ if (if_block) if_block.m(div, null);
655
+ },
656
+ p(ctx, [dirty]) {
657
+ if (dirty & /*entry, dataColumn*/ 9 && t0_value !== (t0_value = /*entry*/ ctx[0][/*dataColumn*/ ctx[3]] + "")) set_data(t0, t0_value);
658
+ if (dirty & /*entry, labelColumn*/ 5 && t4_value !== (t4_value = /*entry*/ ctx[0][/*labelColumn*/ ctx[2]] + "")) set_data(t4, t4_value);
659
+
660
+ if (/*modelColumn*/ ctx[1] && /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] !== undefined) {
661
+ if (if_block) {
662
+ if_block.p(ctx, dirty);
663
+ } else {
664
+ if_block = create_if_block(ctx);
665
+ if_block.c();
666
+ if_block.m(div, null);
667
+ }
668
+ } else if (if_block) {
669
+ if_block.d(1);
670
+ if_block = null;
671
+ }
672
+ },
673
+ i: noop,
674
+ o: noop,
675
+ d(detaching) {
676
+ if (detaching) detach(div);
677
+ if (if_block) if_block.d();
678
+ }
679
+ };
680
+ }
681
+
682
+ function instance($$self, $$props, $$invalidate) {
683
+ let { entry } = $$props;
684
+ let { options } = $$props;
685
+ let { modelColumn } = $$props;
686
+ let { labelColumn } = $$props;
687
+ let { dataColumn } = $$props;
688
+ let { dataOrigin } = $$props;
689
+ let { idColumn } = $$props;
690
+
691
+ $$self.$$set = $$props => {
692
+ if ('entry' in $$props) $$invalidate(0, entry = $$props.entry);
693
+ if ('options' in $$props) $$invalidate(4, options = $$props.options);
694
+ if ('modelColumn' in $$props) $$invalidate(1, modelColumn = $$props.modelColumn);
695
+ if ('labelColumn' in $$props) $$invalidate(2, labelColumn = $$props.labelColumn);
696
+ if ('dataColumn' in $$props) $$invalidate(3, dataColumn = $$props.dataColumn);
697
+ if ('dataOrigin' in $$props) $$invalidate(5, dataOrigin = $$props.dataOrigin);
698
+ if ('idColumn' in $$props) $$invalidate(6, idColumn = $$props.idColumn);
699
+ };
700
+
701
+ return [entry, modelColumn, labelColumn, dataColumn, options, dataOrigin, idColumn];
702
+ }
703
+
704
+ class InstanceView extends SvelteComponent {
705
+ constructor(options) {
706
+ super();
707
+
708
+ init(
709
+ this,
710
+ options,
711
+ instance,
712
+ create_fragment,
713
+ safe_not_equal,
714
+ {
715
+ entry: 0,
716
+ options: 4,
717
+ modelColumn: 1,
718
+ labelColumn: 2,
719
+ dataColumn: 3,
720
+ dataOrigin: 5,
721
+ idColumn: 6
722
+ },
723
+ add_css
724
+ );
725
+ }
726
+ }
727
+
728
+ function getInstance(
729
+ div,
730
+ options,
731
+ entry,
732
+ modelColumn,
733
+ labelColumn,
734
+ dataColumn,
735
+ dataOrigin,
736
+ idColumn
737
+ ) {
738
+ new InstanceView({
739
+ target: div,
740
+ props: {
741
+ entry: entry,
742
+ options: options,
743
+ modelColumn: modelColumn,
744
+ labelColumn: labelColumn,
745
+ dataColumn: dataColumn,
746
+ dataOrigin: dataOrigin,
747
+ idColumn: idColumn,
748
+ },
749
+ hydrate: true,
750
+ });
751
+ }
752
+
753
+ export { getInstance };
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.8
5
+
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ # Set home to the user's home directory
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:$PATH
11
+ WORKDIR $HOME/app
12
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
13
+ COPY --chown=user . $HOME/app
14
+ ADD --chown=user ./.zeno_cache $HOME/app/.zeno_cache
15
+ RUN chown user:user -R $HOME/app
16
+
17
+ COPY ./requirements.txt /code/requirements.txt
18
+
19
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
20
+
21
+
22
+ CMD ["zeno", "config.toml"]
README.md CHANGED
@@ -6,6 +6,7 @@ colorTo: indigo
6
  sdk: docker
7
  pinned: false
8
  license: mit
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
6
  sdk: docker
7
  pinned: false
8
  license: mit
9
+ fullWidth: true
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
config.toml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ view = "text-classification"
2
+ functions = "model.py"
3
+ models = ["human"]
4
+ metadata = "wmt20-de-en.tsv"
5
+ data_column = "text"
6
+ label_column = "label"
7
+ batch_size = 36
8
+ port = 7860
9
+ host = "0.0.0.0"
model.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from zeno import distill, model, metric, ZenoOptions
2
+ from inspiredco.critique import Critique
3
+ import os
4
+
5
+ # from sentence_transformers import SentenceTransformer
6
+
7
+ # sentence_embed = SentenceTransformer("paraphrase-multilingual-mpnet-base-v2")
8
+ client = Critique(api_key=os.environ["INSPIREDCO_API_KEY"])
9
+
10
+
11
+ @model
12
+ def pred_fns(name):
13
+ def pred(df, ops):
14
+ return df["translation"]
15
+ # , sentence_embed.encode(df[ops.label_column].tolist())
16
+
17
+ return pred
18
+
19
+
20
+ @distill
21
+ def bert_score(df, ops):
22
+ eval_dict = df[["source", ops.output_column, "label"]].to_dict("records")
23
+ for d in eval_dict:
24
+ d["references"] = [d.pop("label")]
25
+ d["target"] = d.pop(ops.output_column)
26
+
27
+ result = client.evaluate(
28
+ metric="bert_score", config={"model": "bert-base-uncased"}, dataset=eval_dict
29
+ )
30
+
31
+ return [round(r["value"], 6) for r in result["examples"]]
32
+
33
+
34
+ @metric
35
+ def avg_bert_score(df, ops: ZenoOptions):
36
+ return df[ops.distill_columns["bert_score"]].mean()
37
+
38
+
39
+ @distill
40
+ def length(df, ops):
41
+ return df[ops.data_column].str.len()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ zenoml
2
+ inspiredco
wmt20-de-en.tsv ADDED
The diff for this file is too large to render. See raw diff