File size: 141,755 Bytes
d287b55
 
 
 
 
 
 
 
 
 
94f13eb
d287b55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f178cf4
 
 
d287b55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a51a3962-7801-4906-aeff-74fdfb805b3e",
   "metadata": {
    "tags": []
   },
   "source": [
    "<div style=\"border-left: 4px solid #00A000; background-color: #F0FFF0; padding: 10px; margin: 10px 0;\">\n",
    "    <strong>Tip:</strong> To run the default model for this notebook, it's suggested to run on 4xL4 GPUs. You can also opt for a smaller GPU, but you must swap out the used model. If you want to run on a smaller GPU, it's suggested to use the <a href=\"https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct\">meta-llama/Meta-Llama-3-8B-Instruct</a> model.\n",
    "</div>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d47bb232",
   "metadata": {},
   "source": [
    "# Creating a synthetic dataset for fine-tuning a Sentence Transformer model \n",
    "\n",
    "In the previous notebook, we prepared a dataset that we'll use to generate our synthetic dataset. We'll now focus on generating a dataset that we can use to train or fine-tune a sentence similarity model using the Sentence Transformers library. \n",
    "\n",
    "As a reminder, the type of dataset format we're working towards creating has three columns: \"anchor\", \"positive\", and \"negative\". In our case, \"anchor\" is the text from the domain we want our Sentence Transformers model to work well with. The \"positive\" text is a text which should be similar in some way to the \"anchor\" text, whilst the \"negative\" should be in some way dissimilar to our original text.\n",
    "\n",
    "As a very simple example, if our \"anchor\" text is \"Bill 179 introduces restrictions on the use of pesticides in Canada\", a \"positive\" example might be \"a law that regulating the use of pesticides\", and a \"negative\" example might be \"a bill related to education funding\". Whilst it is possible to train a Sentence Transformer model using only positive examples, the inclusion of negative examples can help the model to learn more about the space of possible sentences and improve its performance. The [Sentence Transformers documentation](https://www.sbert.net/docs/sentence_transformer/training_overview.html) goes into more detail about this.\n",
    "\n",
    "## Creating positive and negative pairs using an LLM\n",
    "\n",
    "One of the remarkable aspects of working with large language models, especially instruction-tuned models, is the significant control and flexibility they offer in text generation. This unique capability empowers us to create a synthetic dataset for training a sentence similarity model. We can leverage our input anchor text alongside a prompt to generate the positive and negative examples for similarity, giving us full control over the dataset's composition.\n",
    "\n",
    "### What do we mean by similarity? \n",
    "\n",
    "How will the model be used in practice? Since we are fine-tuning a model and have a lot of control over the dataset, we should consider what we want similarity to look like. \n",
    "\n",
    "In an RAG use case, we might default to creating a prompt that's something like \"based on this text, write a user query that would be satisfied by this text\" Whilst that could make sense, for many RAG applications, the embeddings are used to give extra context to an LLM based on a user prompt. This user prompt might take the form of a query, but it's more likely to be a question rather than the query we make to a database. Depending on the use case, we might want to generate prompts that are more like the type of questions we expect the model to use."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6eedd4ef",
   "metadata": {},
   "source": [
    "Let's start with our imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fd71339b-7d22-4c9c-958e-f7b2f2ed2991",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import json\n",
    "import random\n",
    "\n",
    "from datasets import concatenate_datasets, load_dataset\n",
    "from huggingface_hub import DatasetCard, login\n",
    "from outlines import generate, models\n",
    "from pydantic import BaseModel, conlist, constr\n",
    "from tqdm.auto import tqdm\n",
    "from vllm import LLM, SamplingParams"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f47e5f95",
   "metadata": {},
   "source": [
    "## Authenticate with the Hub\n",
    "\n",
    "You will need to authenticate with the Hub to be able to push datasets to the Hub. You can create a token by going to [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) and creating a new token. You will need a token with write access. It's suggested to create a new token for this workshop (you can always revoke it later)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5031cf30-3cfa-4bd9-ba9f-65bc52154f3f",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a5df2a83236b4aa094ed05b50c0f5cec",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "login()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6f1d618",
   "metadata": {},
   "source": [
    "We can now load the dataset we created in the previous step. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "464f5034-7e8f-4afe-8a97-3fa968782e42",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ds = load_dataset(\"davanstrien/bill_summary_us_chunks\", split=\"train\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a62413cb",
   "metadata": {},
   "source": [
    "You can see below we currently have a dataset consisting of an `id` and `section` column. In our case, the `section` column is the text we want to use as our anchor text."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "bfaa6b2e-73d5-4d61-905d-7ebc4f0c91fe",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['id', 'section'],\n",
       "    num_rows: 3446013\n",
       "})"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9164c7d8-4e5e-4920-9fa1-58bd822274f7",
   "metadata": {},
   "source": [
    "We'll create a sample of chunks from our processed dataset. We'll keep this reasonably small here, but if you use this notebook with your own dataset, you may want to increase the number of examples you work with. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e782d4aa-2516-4fae-8b08-8bc62d3cc279",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "subset_idx = random.sample(range(len(ds)), k=1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e7d2a1dc-dad5-452d-bb04-b58d4690f0be",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ds = ds.select(subset_idx)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2c70a43b-162d-4493-a450-ab6bdd0c2f58",
   "metadata": {
    "tags": []
   },
   "source": [
    "## Creating an LLM\n",
    "\n",
    "Our choice of LLM is crucial as it forms the basis for creating our negative and positive example pairs, derived from the dataset we're working with. To facilitate this, we require an LLM that can respond to formatted prompts. We've used `vLLM` to run our models (we'll delve into the reasons shortly). However, the question remains-which model should we choose? \n",
    "\n",
    "### Choosing an LLM for synthetic data generation?\n",
    "\n",
    "Since we're focusing on using an open weights LLM, we've already excluded LLMs, which we can only access via an API. However, we still need to choose an LLM. There are a few significant criteria we are considering:\n",
    "\n",
    "- The size of the LLM and the resources required to run the LLM\n",
    "- The performance of the LLM \n",
    "- The license of the LLM\n",
    "\n",
    "Whilst it may seem that you want to use the largest model possible to get the best possible data, this increases the cost and time involved in generating your dataset. Whilst you could immediately use an LLM to create responses for a batch of data when identifying a suitable LLM for generating syntehtic data, you often want to:\n",
    "\n",
    "- Test a few different LLMs\n",
    "- Experiment with the best prompt \n",
    "\n",
    "While it's possible to reuse a standard prompt, it's often more effective to modify it. For instance, when generating synthetic data for embedding datasets, we may need to capture various types of similarity through our prompts. A generic prompt may not be as effective in this scenario. Additionally, it's beneficial to iterate quickly on different LLMs to identify the ones that perform best for a range of prompts. For this initial exploration, platforms like Hugging Chat or local LLM apps like LM Studio can be used to test various LLMS and prompts. \n",
    "\n",
    "When exploring prompts and generations for this task, I found the following models all worked pretty well:\n",
    "\n",
    "| Model | Parameter Count |\n",
    "|-------|-----------------|\n",
    "| [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) | 8B parameters |\n",
    "| [01-ai/Yi-1.5-34B-Chat](https://huggingface.co/01-ai/Yi-1.5-34B-Chat) | 34B parameters |\n",
    "| [casperhansen/llama-3-70b-instruct-awq](https://huggingface.co/casperhansen/llama-3-70b-instruct-awq) | 70B parameters |\n",
    "| [Qwen/Qwen2-72B-Instruct-AWQ](https://huggingface.co/Qwen/Qwen2-72B-Instruct-AWQ) | 72B parameters |\n",
    "\n",
    "You will see that for the Llama-3-70b and Qwen2-72b models, that AWQ quantized versions are used. This is because these models will be too large to fit into the VRAM of a 4xL4 GPU.\n",
    "\n",
    "For this notebook we use the Yi-1.5-34B model as a default. This model is a good balance between performance and resource requirements. "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c186341b",
   "metadata": {},
   "source": [
    "We can now load the model and tokenizer. You may need to reduce the `gpu_memory_utilization` if you are using a smaller GPU or are hitting CUDA out of memory errors. You may also need to adjust this parameter if you have very long anchor texts.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "66df0cbc",
   "metadata": {},
   "source": [
    "<div style=\"border-left: 4px solid #00A000; background-color: #F0FFF0; padding: 10px; margin: 10px 0;\">\n",
    "    <strong>Tip:</strong> If you are running on a single GPU update the `tensor_parallel_size` below to 1. \n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "02107e5b-22e2-4bd3-85ba-aad6246ba9d9",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/user/miniconda/lib/python3.9/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n",
      "  warnings.warn(\n",
      "2024-06-19 14:03:15,692\tINFO worker.py:1753 -- Started a local Ray instance.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "INFO 06-19 14:03:16 config.py:623] Defaulting to use mp for distributed inference\n",
      "INFO 06-19 14:03:16 config.py:707] Chunked prefill is enabled (EXPERIMENTAL).\n",
      "INFO 06-19 14:03:16 llm_engine.py:161] Initializing an LLM engine (v0.5.0) with config: model='01-ai/Yi-1.5-34B-Chat', speculative_config=None, tokenizer='01-ai/Yi-1.5-34B-Chat', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, rope_scaling=None, rope_theta=None, tokenizer_revision=None, trust_remote_code=False, dtype=torch.bfloat16, max_seq_len=4096, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=4, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto, quantization_param_path=None, device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='outlines'), seed=0, served_model_name=01-ai/Yi-1.5-34B-Chat)\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:19 multiproc_worker_utils.py:215] Worker ready; awaiting tasks\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:19 multiproc_worker_utils.py:215] Worker ready; awaiting tasks\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:19 multiproc_worker_utils.py:215] Worker ready; awaiting tasks\n",
      "INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
      "INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:20 utils.py:623] Found nccl from library libnccl.so.2\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:20 pynccl.py:65] vLLM is using nccl==2.20.5\n",
      "WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m \u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n",
      "WARNING 06-19 14:03:20 custom_all_reduce.py:170] Custom allreduce is disabled because it's not supported on more than two PCIe-only GPUs. To silence this warning, specify disable_custom_all_reduce=True explicitly.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Traceback (most recent call last):\n",
      "  File \"/home/user/miniconda/lib/python3.9/multiprocessing/resource_tracker.py\", line 201, in main\n",
      "    cache[rtype].remove(name)\n",
      "KeyError: '/psm_e0bb0061'\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/user/miniconda/lib/python3.9/multiprocessing/resource_tracker.py\", line 201, in main\n",
      "    cache[rtype].remove(name)\n",
      "KeyError: '/psm_e0bb0061'\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/user/miniconda/lib/python3.9/multiprocessing/resource_tracker.py\", line 201, in main\n",
      "    cache[rtype].remove(name)\n",
      "KeyError: '/psm_e0bb0061'\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
      "INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:20 weight_utils.py:218] Using model weights format ['*.safetensors']\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
      "INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:32 model_runner.py:159] Loading model weights took 16.0451 GB\n",
      "INFO 06-19 14:03:33 distributed_gpu_executor.py:56] # GPU blocks: 3187, # CPU blocks: 4369\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
      "INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
      "INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:878] Capturing the model for CUDA graphs. This may lead to unexpected consequences if the model is not static. To run the model in eager mode, set 'enforce_eager=True' or use '--enforce-eager' in the CLI.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:03:42 model_runner.py:882] CUDA graphs can take additional 1~3 GiB memory per GPU. If you are running out of memory, consider decreasing `gpu_memory_utilization` or enforcing eager mode. You can also reduce the `max_num_seqs` as needed to decrease memory usage.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44274)\u001b[0;0m INFO 06-19 14:04:02 model_runner.py:954] Graph capturing finished in 21 secs.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44272)\u001b[0;0m INFO 06-19 14:04:02 model_runner.py:954] Graph capturing finished in 21 secs.\n",
      "\u001b[1;36m(VllmWorkerProcess pid=44273)\u001b[0;0m INFO 06-19 14:04:02 model_runner.py:954] Graph capturing finished in 21 secs.\n",
      "INFO 06-19 14:04:03 model_runner.py:954] Graph capturing finished in 21 secs.\n"
     ]
    }
   ],
   "source": [
    "llm = LLM(\n",
    "    \"01-ai/Yi-1.5-34B-Chat\",\n",
    "    tensor_parallel_size=4,\n",
    "    tokenizer=\"01-ai/Yi-1.5-34B-Chat\",\n",
    "    gpu_memory_utilization=0.9,\n",
    "    enable_chunked_prefill=True,\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a479e701",
   "metadata": {},
   "source": [
    "Below are some configs for other models you might want to experiment with. \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ef4266cf-f970-4c7a-b9db-503b9f584922",
   "metadata": {},
   "outputs": [],
   "source": [
    "# llm = LLM(\n",
    "#     \"meta-llama/Meta-Llama-3-8B-Instruct\",\n",
    "#     tensor_parallel_size=4,\n",
    "#     tokenizer=\"meta-llama/Meta-Llama-3-8B-Instruct\",\n",
    "#     gpu_memory_utilization=0.9,\n",
    "#     enable_chunked_prefill=True,\n",
    "# )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c8e9995a-dfbd-4493-8906-3556be75f145",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# llm = LLM(\n",
    "#     \"Qwen/Qwen2-72B-Instruct-AWQ\",\n",
    "#     quantization=\"AWQ\",\n",
    "#     tensor_parallel_size=4,\n",
    "#     tokenizer=\"Qwen/Qwen2-72B-Instruct-AWQ\",\n",
    "#     gpu_memory_utilization=0.8,\n",
    "#     enable_chunked_prefill=True,\n",
    "# )"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27c0774b-44d6-4828-8514-65fe8d52f906",
   "metadata": {
    "tags": []
   },
   "source": [
    "### Constrained Generation using Outlines\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f92b36eb-71ce-4301-a0d0-c7a47dce9cde",
   "metadata": {},
   "source": [
    "Now we have created an LLM and loaded our dataset, we can move to the next step of creating our dataset. As a reminder we are looking to create a dataset with three columns: \"anchor\", \"positive\", and \"negative\" using the anchor text from our dataset as a starting point.\n",
    "\n",
    "We can do something like this as a prompt:\n",
    "\n",
    "\"Given the following text, write a sentence that is similar to the text. Write a sentence that is dissimilar to the text.\"\n",
    "\n",
    "This prompt (might!) generate a sentence that is similar to the anchor text and a sentence that is dissimilar to the anchor text. However, we may want some way to have more certainty that the LLM produces the text we want (at least in terms of format). For example if we want to generate valid JSON the first token generated should be `{`. \n",
    "\n",
    "Since we want to have two types of output \"good\" and \"bad\" aka positive and negative examples, we may to produce data that looks something like:\n",
    "\n",
    "{\"good\": \"a sentence that is similar to the text\", \"bad\": \"a sentence that is dissimilar to the text\"}\n",
    "\n",
    "\n",
    "A strong LLM with a good prompt will probably already do this but we can also use a technique called guided generation to enforce this more strongly. This has a few advantages:\n",
    "\n",
    "- the outputs are what we expect i.e. valid JSON, this makes processing them in later steps easier\n",
    "- we can have some additional control over other parts of the generation process\n",
    "\n",
    "For doing guided generation we'll use a library called [Outlines](https://github.com/outlines-dev/outlines). Outlines is a library that allows you to create constraints on the generation process.\n",
    "\n",
    "> Outlinesγ€° is a Python library that allows you to use Large Language Model in a simple and robust way (with structured generation).\n",
    "\n",
    "One of the advantages of Outlines over some other libraries is that it does structured generation by directly altering the behavior of the models generation process rather than using prompting and lots of retries. The Outlines library has an integration with `vLLM` which we used to load our model."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bed24b92-287a-4b2d-8807-2c8e031aba4c",
   "metadata": {},
   "source": [
    "We can start by passing the llm we just created into the Outlines `models.VLLM` class"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4be1bb3b-e665-4d40-aa24-bf8d8acf67f4",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "model = models.VLLM(llm)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f2fff3d",
   "metadata": {},
   "source": [
    "### Defining the constraints\n",
    "\n",
    "We can now define the constraints we want to use. We can do this in various ways using the Outlines library but one nice way is to use a Pydantic Class to represent the output we want. If you are not familiar with Pydantic it is a\n",
    "\n",
    "> fast and extensible library for validating and serializing data using Python type hints.\n",
    "\n",
    "In our case we want to have two fields \"good\" and \"bad\" which are strings. We could define this as a Pydantic class like this:\n",
    "\n",
    "\n",
    "```python\n",
    "\n",
    "from pydantic import BaseModel\n",
    "\n",
    "class Example(BaseModel):\n",
    "    good: str\n",
    "    bad: str\n",
    "\n",
    "```\n",
    "\n",
    "This will ensure we get a JSON object with two fields \"good\" and \"bad\" which are strings. However, when creating data for a sentence embedding task it can be useful to have multiple generations for each anchor text. In particular for the `bad` examples we may want the LLM to produce multiple bad examples and then choose the \"hard\" negative example i.e. the one that is most similar to the anchor text. This can help the model learn more quickly and deal with more complex examples.\n",
    "\n",
    "We can define this as a Pydantic class like this:\n",
    "\n",
    "```python\n",
    "\n",
    "from pydantic import BaseModel\n",
    "from typing import List\n",
    "\n",
    "class Example(BaseModel):\n",
    "    good: str\n",
    "    bad: List[str]\n",
    "\n",
    "```\n",
    "\n",
    "You can see that we now have a list of strings for the \"bad\" field. This will allow us to generate multiple negative examples for each anchor text.\n",
    "\n",
    "In addition to controlling the structure of the JSON we can also define some additional constrains. For this example we'll create a Pydantic Class that has:\n",
    "\n",
    "- a good field which is a list of 1 string\n",
    "- a bad field which is a list of 3 strings\n",
    "- we also specify a constraint on the minimum and maximum length of the strings\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3b96eb01-d186-442d-a15d-bbe170438dc2",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "class AbstractDescriptions(BaseModel):\n",
    "    good: conlist(constr(min_length=20, max_length=200), min_length=1, max_length=1)  # type: ignore\n",
    "    bad: conlist(constr(min_length=20, max_length=200), min_length=3, max_length=3)  # type: ignore\n",
    "\n",
    "\n",
    "schema = AbstractDescriptions.model_json_schema()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "da0c6430",
   "metadata": {},
   "source": [
    "Although it can be tempting to make a Pydantic Class that has a lot of constraints, it's often better to start with a simple class and then add more constraints as needed. Whilst Outlines will help guide the model to the output you want if it's very hard for an LLM to generate the output you want you may get suboptimal results."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "720f6891-8650-4021-b992-dc98e0307075",
   "metadata": {},
   "source": [
    "## Creating our prompt\n",
    "\n",
    "Now we turn to writing a prompt that will generate the data we want. In this case we write a prompt that is focused on the specific data we are working with (US legislation). We give the LLM a few shot example to help it understand the type of response we want as well as the format. \n",
    "\n",
    "In addition we pass in the constraints we defined above as a JSON Schema. This is another reason you may want to limit the number of constrains you have as the JSON Schema will get larger and in turn the size of your prompts will grow a lot. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "7695058d-487b-4db0-97e2-3d5ef5767f45",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "def format_prompt(text: str) -> str:\n",
    "    return f\"\"\"Write one good and three bad abstract descriptions of the following text. Output the descriptions in a JSON file with keys β€˜good’ and β€˜bad’.\n",
    "Example:\n",
    "Text: Community Energy Savings Program Act of 2019\\n\\nThis bill directs the Department of Energy to establish a grant program for states and Indian tribes to provide loans to consumers and communities that want to implement cost-effective energy efficiency measures.\n",
    "Good description: A legislative proposal to promote energy efficiency through financial incentives\n",
    "Bad description: A federal reform relating to the process for submitting planning applications related to oil pipelines\n",
    "\n",
    "Note: Descriptions can vary in abstraction, detail, and focus. Both good and bad descriptions should be short (max 20 words)\n",
    "\n",
    "Text to describe: {text}\n",
    "Return a JSON object with the keys 'good' and 'bad' using this schema: {schema}.\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df05525c",
   "metadata": {},
   "source": [
    "We not add a new column to our dataset called `prompt` which contains the prompt we want to use."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "206fbcfd-3cea-4540-8dd0-7ab0fba08254",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "2d609b2a30d0402b8d162f4a4f2723f0",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Map:   0%|          | 0/1000 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds = ds.map(lambda x: {\"prompt\": format_prompt(x['section'])})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "450376a7-ee63-4c00-84a8-f79b28376a2e",
   "metadata": {},
   "source": [
    "We now create a `generator` object using Outlines. We pass our model and the `AbstractDescriptions` Pydantic model we created to Outlines `generate.json`. Outlines will then \"compile\" our Pydantic model into a [finite state machine](https://en.wikipedia.org/wiki/Finite-state_machine) (FSM) representation of our Schema. Outlines constrains the possible tokens that the LLM can generate at different steps during the generation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "ba34b313-8e89-4ac5-8739-2dd17d3989d1",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Compiling FSM index for all state transitions: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4845/4845 [01:44<00:00, 46.55it/s]\n"
     ]
    }
   ],
   "source": [
    "generator = generate.json(model, AbstractDescriptions)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6bd7b877-dca2-47f8-97a2-c67fde2a34f7",
   "metadata": {},
   "source": [
    "We now have a `generator` to which we can pass our prompts. Although we created this via Outlines, under the hood the generation is being done by `vLLM`. `vLLM` supports [offline batched inference](https://docs.vllm.ai/en/latest/getting_started/quickstart.html#offline-batched-inference). Many LLM serving engines are primarily optimized for deployment via an API where a variable number of requests will be sent to the model. In our case, we have a batch of prompts for which we want to generate responses. The vLLM `LLM` Class:\n",
    "\n",
    "> includes a tokenizer, a language model (possibly distributed across multiple GPUs), and GPU memory space allocated for intermediate states (aka KV cache). Given a batch of prompts and sampling parameters, this Class generates texts from the model using an intelligent batching mechanism and efficient memory management.\n",
    "\n",
    "While we could still work to optimize throughput further, this Class represents a good starting point for synthetic data generation. "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54810b5c-b7e2-43b6-ad2c-0c4bd4adb29c",
   "metadata": {},
   "source": [
    "### Generating our dataset\n",
    "\n",
    "We are now ready to generate our dataset. We'll use the `generator` object to generate our data. We'll run our dataset as batches to allow us to retry generating data that fails. \n",
    "\n",
    "In the below `process_batch` function, we roughly do the following:\n",
    "- Split our dataset into an initial batch size\n",
    "- Try and generate a response for the batch\n",
    "- If we have errors for the batch, we split the batch that failed into a smaller subset and retryß\n",
    "- We go through this process with a maximum number of retries and a minimum batch size\n",
    "\n",
    "There are ways we could further optimize this, but this works quite well for not skipping a whole batch whilst not wasting too much compute/time retrying tiny batches to generate a bit of extra data. \n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3c63a0bc",
   "metadata": {},
   "source": [
    "We can specify some generation parameters that will be passed to vLLM when generating the data. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3a3cfec0-96f4-4a35-acc4-6b932238599e",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "params = SamplingParams(n=1, max_tokens=800, best_of=2, temperature=0.7)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "299b08f1",
   "metadata": {},
   "source": [
    "We can now generate our data. Feel free to adjust the `batch_size`, `max_retries`, and `min_batch_size` to suit your needs."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "b277db6b-29f6-467c-8512-2675076b1309",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "9534747f9c0c4ef89eefac53b47039b3",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "  0%|          | 0/10 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:39<1:05:13, 39.53s/it, Generation Speed: 1.64 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:42<29:49, 18.26s/it, Generation Speed: 2.89 toks/s]  \u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:43<16:39, 10.31s/it, Generation Speed: 4.41 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:44<07:27,  4.71s/it, Generation Speed: 7.16 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:45<05:37,  3.59s/it, Generation Speed: 8.50 toks/s]\u001b[A\n",
      "Processed prompts:   8%|β–Š         | 8/100 [00:46<03:33,  2.32s/it, Generation Speed: 10.96 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:47<02:58,  1.96s/it, Generation Speed: 12.26 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:52<03:17,  2.22s/it, Generation Speed: 13.56 toks/s]\u001b[A\n",
      "Processed prompts:  12%|β–ˆβ–        | 12/100 [00:55<03:23,  2.31s/it, Generation Speed: 14.28 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:56<02:15,  1.58s/it, Generation Speed: 16.30 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:57<02:00,  1.42s/it, Generation Speed: 17.24 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [00:58<01:26,  1.04s/it, Generation Speed: 19.16 toks/s]\u001b[A\n",
      "Processed prompts:  18%|β–ˆβ–Š        | 18/100 [00:59<01:21,  1.00it/s, Generation Speed: 20.39 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [01:00<01:14,  1.07it/s, Generation Speed: 21.95 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:01<00:58,  1.32it/s, Generation Speed: 24.13 toks/s]\u001b[A\n",
      "Processed prompts:  23%|β–ˆβ–ˆβ–Ž       | 23/100 [01:02<01:07,  1.13it/s, Generation Speed: 24.77 toks/s]\u001b[A\n",
      "Processed prompts:  25%|β–ˆβ–ˆβ–Œ       | 25/100 [01:04<00:58,  1.27it/s, Generation Speed: 26.28 toks/s]\u001b[A\n",
      "Processed prompts:  26%|β–ˆβ–ˆβ–Œ       | 26/100 [01:04<00:55,  1.32it/s, Generation Speed: 27.24 toks/s]\u001b[A\n",
      "Processed prompts:  28%|β–ˆβ–ˆβ–Š       | 28/100 [01:06<00:50,  1.43it/s, Generation Speed: 29.21 toks/s]\u001b[A\n",
      "Processed prompts:  29%|β–ˆβ–ˆβ–‰       | 29/100 [01:06<00:47,  1.49it/s, Generation Speed: 30.10 toks/s]\u001b[A\n",
      "Processed prompts:  31%|β–ˆβ–ˆβ–ˆ       | 31/100 [01:07<00:36,  1.89it/s, Generation Speed: 31.88 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:07<00:36,  1.86it/s, Generation Speed: 32.73 toks/s]\u001b[A\n",
      "Processed prompts:  34%|β–ˆβ–ˆβ–ˆβ–      | 34/100 [01:08<00:29,  2.27it/s, Generation Speed: 34.54 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:08<00:30,  2.16it/s, Generation Speed: 35.54 toks/s]\u001b[A\n",
      "Processed prompts:  38%|β–ˆβ–ˆβ–ˆβ–Š      | 38/100 [01:10<00:35,  1.73it/s, Generation Speed: 37.09 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:11<00:34,  1.75it/s, Generation Speed: 37.78 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:12<00:33,  1.77it/s, Generation Speed: 38.72 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:12<00:32,  1.81it/s, Generation Speed: 39.20 toks/s]\u001b[A\n",
      "Processed prompts:  43%|β–ˆβ–ˆβ–ˆβ–ˆβ–Ž     | 43/100 [01:13<00:24,  2.33it/s, Generation Speed: 40.66 toks/s]\u001b[A\n",
      "Processed prompts:  44%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 44/100 [01:13<00:24,  2.32it/s, Generation Speed: 41.31 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:13<00:18,  2.87it/s, Generation Speed: 43.16 toks/s]\u001b[A\n",
      "Processed prompts:  47%|β–ˆβ–ˆβ–ˆβ–ˆβ–‹     | 47/100 [01:14<00:19,  2.72it/s, Generation Speed: 44.28 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:14<00:19,  2.64it/s, Generation Speed: 44.97 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:16<00:23,  2.09it/s, Generation Speed: 45.83 toks/s]\u001b[A\n",
      "Processed prompts:  51%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 51/100 [01:16<00:22,  2.15it/s, Generation Speed: 46.61 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:16<00:21,  2.22it/s, Generation Speed: 47.68 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:17<00:13,  3.45it/s, Generation Speed: 50.81 toks/s]\u001b[A\n",
      "Processed prompts:  57%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹    | 57/100 [01:17<00:11,  3.88it/s, Generation Speed: 52.53 toks/s]\u001b[A\n",
      "Processed prompts:  59%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 59/100 [01:18<00:09,  4.22it/s, Generation Speed: 53.90 toks/s]\u001b[A\n",
      "Processed prompts:  60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 60/100 [01:18<00:10,  3.78it/s, Generation Speed: 54.81 toks/s]\u001b[A\n",
      "Processed prompts:  64%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 64/100 [01:19<00:09,  3.74it/s, Generation Speed: 57.35 toks/s]\u001b[A\n",
      "Processed prompts:  65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 65/100 [01:20<00:11,  3.04it/s, Generation Speed: 57.74 toks/s]\u001b[A\n",
      "Processed prompts:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹   | 67/100 [01:20<00:09,  3.58it/s, Generation Speed: 59.30 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:20<00:09,  3.47it/s, Generation Speed: 60.17 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:21<00:09,  3.36it/s, Generation Speed: 60.85 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:21<00:08,  3.35it/s, Generation Speed: 61.41 toks/s]\u001b[A\n",
      "Processed prompts:  71%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 71/100 [01:22<00:10,  2.73it/s, Generation Speed: 61.80 toks/s]\u001b[A\n",
      "Processed prompts:  73%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž  | 73/100 [01:22<00:07,  3.65it/s, Generation Speed: 63.56 toks/s]\u001b[A\n",
      "Processed prompts:  74%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 74/100 [01:22<00:07,  3.66it/s, Generation Speed: 64.14 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:23<00:08,  2.90it/s, Generation Speed: 64.67 toks/s]\u001b[A\n",
      "Processed prompts:  77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹  | 77/100 [01:24<00:09,  2.44it/s, Generation Speed: 65.80 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:24<00:06,  3.29it/s, Generation Speed: 67.29 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:24<00:05,  3.45it/s, Generation Speed: 68.21 toks/s]\u001b[A\n",
      "Processed prompts:  82%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 82/100 [01:25<00:04,  3.76it/s, Generation Speed: 69.75 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:25<00:03,  4.81it/s, Generation Speed: 71.36 toks/s]\u001b[A\n",
      "Processed prompts:  86%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 86/100 [01:25<00:02,  5.12it/s, Generation Speed: 72.79 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:25<00:02,  4.59it/s, Generation Speed: 73.24 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:26<00:02,  4.88it/s, Generation Speed: 73.89 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:26<00:02,  5.16it/s, Generation Speed: 74.57 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:26<00:01,  6.79it/s, Generation Speed: 76.28 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:26<00:01,  6.75it/s, Generation Speed: 76.99 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:26<00:01,  4.68it/s, Generation Speed: 77.61 toks/s]\u001b[A\n",
      "Processed prompts:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 94/100 [01:27<00:01,  4.55it/s, Generation Speed: 78.26 toks/s]\u001b[A\n",
      "Processed prompts:  95%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 95/100 [01:27<00:00,  5.18it/s, Generation Speed: 79.00 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:27<00:01,  3.48it/s, Generation Speed: 79.41 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:28<00:00,  5.25it/s, Generation Speed: 81.99 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:28<00:00,  1.13it/s, Generation Speed: 82.88 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "607fe2197abf4f91a3556c3dcae0b0cb",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:34<57:02, 34.57s/it, Generation Speed: 1.42 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:37<25:36, 15.68s/it, Generation Speed: 2.86 toks/s]\u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:37<14:22,  8.90s/it, Generation Speed: 4.49 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:38<09:08,  5.71s/it, Generation Speed: 6.02 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:42<08:06,  5.12s/it, Generation Speed: 6.97 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:46<07:03,  4.50s/it, Generation Speed: 7.71 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:46<05:08,  3.31s/it, Generation Speed: 9.02 toks/s]\u001b[A\n",
      "Processed prompts:   8%|β–Š         | 8/100 [00:47<03:53,  2.53s/it, Generation Speed: 10.30 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:49<03:28,  2.29s/it, Generation Speed: 11.48 toks/s]\u001b[A\n",
      "Processed prompts:  10%|β–ˆ         | 10/100 [00:51<03:11,  2.12s/it, Generation Speed: 12.38 toks/s]\u001b[A\n",
      "Processed prompts:  12%|β–ˆβ–        | 12/100 [00:54<02:49,  1.93s/it, Generation Speed: 14.02 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:55<02:23,  1.65s/it, Generation Speed: 15.17 toks/s]\u001b[A\n",
      "Processed prompts:  16%|β–ˆβ–Œ        | 16/100 [00:56<01:19,  1.06it/s, Generation Speed: 18.84 toks/s]\u001b[A\n",
      "Processed prompts:  18%|β–ˆβ–Š        | 18/100 [00:58<01:15,  1.09it/s, Generation Speed: 21.06 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [00:58<01:13,  1.10it/s, Generation Speed: 22.02 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [00:59<01:11,  1.12it/s, Generation Speed: 22.91 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [01:01<01:24,  1.07s/it, Generation Speed: 23.22 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:02<01:18,  1.01s/it, Generation Speed: 24.14 toks/s]\u001b[A\n",
      "Processed prompts:  24%|β–ˆβ–ˆβ–       | 24/100 [01:03<01:02,  1.21it/s, Generation Speed: 25.91 toks/s]\u001b[A\n",
      "Processed prompts:  25%|β–ˆβ–ˆβ–Œ       | 25/100 [01:06<01:40,  1.34s/it, Generation Speed: 26.10 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:07<00:40,  1.72it/s, Generation Speed: 31.65 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:07<00:34,  1.97it/s, Generation Speed: 33.68 toks/s]\u001b[A\n",
      "Processed prompts:  34%|β–ˆβ–ˆβ–ˆβ–      | 34/100 [01:08<00:34,  1.92it/s, Generation Speed: 34.78 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:09<00:34,  1.89it/s, Generation Speed: 35.62 toks/s]\u001b[A\n",
      "Processed prompts:  37%|β–ˆβ–ˆβ–ˆβ–‹      | 37/100 [01:09<00:28,  2.22it/s, Generation Speed: 37.23 toks/s]\u001b[A\n",
      "Processed prompts:  38%|β–ˆβ–ˆβ–ˆβ–Š      | 38/100 [01:10<00:28,  2.15it/s, Generation Speed: 37.79 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:10<00:28,  2.12it/s, Generation Speed: 38.65 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:11<00:28,  2.06it/s, Generation Speed: 40.00 toks/s]\u001b[A\n",
      "Processed prompts:  42%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 42/100 [01:12<00:33,  1.74it/s, Generation Speed: 40.50 toks/s]\u001b[A\n",
      "Processed prompts:  43%|β–ˆβ–ˆβ–ˆβ–ˆβ–Ž     | 43/100 [01:13<00:30,  1.84it/s, Generation Speed: 41.24 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:14<00:26,  2.02it/s, Generation Speed: 43.26 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:15<00:21,  2.47it/s, Generation Speed: 44.97 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:15<00:17,  2.88it/s, Generation Speed: 46.67 toks/s]\u001b[A\n",
      "Processed prompts:  51%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 51/100 [01:15<00:17,  2.76it/s, Generation Speed: 47.47 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:16<00:18,  2.53it/s, Generation Speed: 48.68 toks/s]\u001b[A\n",
      "Processed prompts:  54%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 54/100 [01:17<00:18,  2.47it/s, Generation Speed: 49.01 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:19<00:34,  1.32it/s, Generation Speed: 48.79 toks/s]\u001b[A\n",
      "Processed prompts:  57%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹    | 57/100 [01:19<00:23,  1.84it/s, Generation Speed: 50.69 toks/s]\u001b[A\n",
      "Processed prompts:  61%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 61/100 [01:20<00:13,  2.79it/s, Generation Speed: 53.86 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:21<00:15,  2.41it/s, Generation Speed: 54.60 toks/s]\u001b[A\n",
      "Processed prompts:  65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 65/100 [01:21<00:10,  3.42it/s, Generation Speed: 57.09 toks/s]\u001b[A\n",
      "Processed prompts:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹   | 67/100 [01:22<00:09,  3.38it/s, Generation Speed: 58.41 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:22<00:07,  3.94it/s, Generation Speed: 59.90 toks/s]\u001b[A\n",
      "Processed prompts:  71%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 71/100 [01:22<00:06,  4.49it/s, Generation Speed: 61.33 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:23<00:06,  4.27it/s, Generation Speed: 61.85 toks/s]\u001b[A\n",
      "Processed prompts:  73%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž  | 73/100 [01:23<00:06,  4.12it/s, Generation Speed: 62.67 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:23<00:06,  4.00it/s, Generation Speed: 64.01 toks/s]\u001b[A\n",
      "Processed prompts:  77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹  | 77/100 [01:24<00:05,  3.98it/s, Generation Speed: 65.73 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:24<00:03,  5.65it/s, Generation Speed: 68.55 toks/s]\u001b[A\n",
      "Processed prompts:  82%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 82/100 [01:25<00:03,  5.24it/s, Generation Speed: 69.84 toks/s]\u001b[A\n",
      "Processed prompts:  83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 83/100 [01:25<00:04,  3.80it/s, Generation Speed: 70.23 toks/s]\u001b[A\n",
      "Processed prompts:  85%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 85/100 [01:25<00:03,  4.86it/s, Generation Speed: 71.57 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:26<00:02,  5.12it/s, Generation Speed: 72.82 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:26<00:02,  5.22it/s, Generation Speed: 73.85 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:26<00:02,  4.44it/s, Generation Speed: 74.84 toks/s]\u001b[A\n",
      "Processed prompts:  90%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 90/100 [01:27<00:02,  3.60it/s, Generation Speed: 75.32 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:27<00:02,  3.59it/s, Generation Speed: 75.89 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:27<00:01,  4.09it/s, Generation Speed: 76.57 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:28<00:02,  2.74it/s, Generation Speed: 76.82 toks/s]\u001b[A\n",
      "Processed prompts:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 94/100 [01:28<00:01,  3.35it/s, Generation Speed: 77.74 toks/s]\u001b[A\n",
      "Processed prompts:  95%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 95/100 [01:28<00:01,  4.01it/s, Generation Speed: 78.62 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:28<00:01,  3.73it/s, Generation Speed: 79.27 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:29<00:00,  4.36it/s, Generation Speed: 80.90 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:29<00:00,  4.69it/s, Generation Speed: 81.80 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:30<00:00,  1.11it/s, Generation Speed: 81.92 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "cdf5b30d647d4bf3b83bfd86ce88133e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:37<1:01:59, 37.57s/it, Generation Speed: 1.70 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:40<28:28, 17.43s/it, Generation Speed: 3.06 toks/s]  \u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:43<11:40,  7.30s/it, Generation Speed: 5.62 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:45<08:51,  5.59s/it, Generation Speed: 6.96 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:46<06:29,  4.15s/it, Generation Speed: 8.33 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:47<05:15,  3.39s/it, Generation Speed: 9.61 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:48<02:01,  1.37s/it, Generation Speed: 14.61 toks/s]\u001b[A\n",
      "Processed prompts:  12%|β–ˆβ–        | 12/100 [00:50<02:04,  1.42s/it, Generation Speed: 15.61 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:52<02:10,  1.50s/it, Generation Speed: 16.43 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:52<01:33,  1.10s/it, Generation Speed: 18.71 toks/s]\u001b[A\n",
      "Processed prompts:  16%|β–ˆβ–Œ        | 16/100 [00:53<01:28,  1.05s/it, Generation Speed: 19.72 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [00:55<01:40,  1.22s/it, Generation Speed: 20.55 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [00:57<01:27,  1.08s/it, Generation Speed: 22.34 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [00:59<01:30,  1.14s/it, Generation Speed: 23.70 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:00<01:23,  1.07s/it, Generation Speed: 24.71 toks/s]\u001b[A\n",
      "Processed prompts:  24%|β–ˆβ–ˆβ–       | 24/100 [01:01<01:02,  1.21it/s, Generation Speed: 26.56 toks/s]\u001b[A\n",
      "Processed prompts:  27%|β–ˆβ–ˆβ–‹       | 27/100 [01:03<00:59,  1.23it/s, Generation Speed: 28.66 toks/s]\u001b[A\n",
      "Processed prompts:  29%|β–ˆβ–ˆβ–‰       | 29/100 [01:04<00:46,  1.53it/s, Generation Speed: 30.60 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:04<00:45,  1.55it/s, Generation Speed: 31.18 toks/s]\u001b[A\n",
      "Processed prompts:  31%|β–ˆβ–ˆβ–ˆ       | 31/100 [01:06<00:51,  1.35it/s, Generation Speed: 31.72 toks/s]\u001b[A\n",
      "Processed prompts:  33%|β–ˆβ–ˆβ–ˆβ–Ž      | 33/100 [01:06<00:38,  1.74it/s, Generation Speed: 33.54 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:07<00:30,  2.11it/s, Generation Speed: 35.11 toks/s]\u001b[A\n",
      "Processed prompts:  36%|β–ˆβ–ˆβ–ˆβ–Œ      | 36/100 [01:07<00:31,  2.04it/s, Generation Speed: 35.96 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:08<00:21,  2.89it/s, Generation Speed: 39.08 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:09<00:23,  2.56it/s, Generation Speed: 40.53 toks/s]\u001b[A\n",
      "Processed prompts:  42%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 42/100 [01:10<00:28,  2.02it/s, Generation Speed: 41.16 toks/s]\u001b[A\n",
      "Processed prompts:  45%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 45/100 [01:11<00:22,  2.40it/s, Generation Speed: 43.52 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:11<00:22,  2.35it/s, Generation Speed: 44.19 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:12<00:22,  2.35it/s, Generation Speed: 45.45 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:14<00:27,  1.82it/s, Generation Speed: 46.21 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:14<00:24,  1.97it/s, Generation Speed: 48.03 toks/s]\u001b[A\n",
      "Processed prompts:  54%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 54/100 [01:15<00:19,  2.41it/s, Generation Speed: 49.46 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:17<00:28,  1.57it/s, Generation Speed: 49.42 toks/s]\u001b[A\n",
      "Processed prompts:  58%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š    | 58/100 [01:17<00:17,  2.38it/s, Generation Speed: 52.09 toks/s]\u001b[A\n",
      "Processed prompts:  60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 60/100 [01:17<00:14,  2.84it/s, Generation Speed: 53.85 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:18<00:13,  2.83it/s, Generation Speed: 54.97 toks/s]\u001b[A\n",
      "Processed prompts:  64%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 64/100 [01:18<00:10,  3.30it/s, Generation Speed: 56.66 toks/s]\u001b[A\n",
      "Processed prompts:  66%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 66/100 [01:19<00:09,  3.77it/s, Generation Speed: 58.55 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:19<00:06,  4.90it/s, Generation Speed: 60.83 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:19<00:06,  4.63it/s, Generation Speed: 61.46 toks/s]\u001b[A\n",
      "Processed prompts:  71%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 71/100 [01:20<00:08,  3.58it/s, Generation Speed: 61.87 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:20<00:09,  2.98it/s, Generation Speed: 62.50 toks/s]\u001b[A\n",
      "Processed prompts:  76%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 76/100 [01:21<00:05,  4.50it/s, Generation Speed: 65.45 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:21<00:05,  4.33it/s, Generation Speed: 66.77 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:22<00:05,  3.64it/s, Generation Speed: 67.60 toks/s]\u001b[A\n",
      "Processed prompts:  81%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 81/100 [01:22<00:04,  4.49it/s, Generation Speed: 69.11 toks/s]\u001b[A\n",
      "Processed prompts:  83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 83/100 [01:23<00:03,  4.51it/s, Generation Speed: 70.13 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:23<00:05,  3.02it/s, Generation Speed: 70.49 toks/s]\u001b[A\n",
      "Processed prompts:  86%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 86/100 [01:24<00:03,  4.02it/s, Generation Speed: 71.95 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:24<00:03,  3.75it/s, Generation Speed: 72.53 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:24<00:02,  4.15it/s, Generation Speed: 73.36 toks/s]\u001b[A\n",
      "Processed prompts:  90%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 90/100 [01:24<00:01,  5.60it/s, Generation Speed: 74.95 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:25<00:00,  7.22it/s, Generation Speed: 77.16 toks/s]\u001b[A\n",
      "Processed prompts:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 94/100 [01:25<00:01,  4.46it/s, Generation Speed: 77.49 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:25<00:00,  5.97it/s, Generation Speed: 79.17 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:26<00:00,  5.86it/s, Generation Speed: 80.74 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:26<00:00,  5.86it/s, Generation Speed: 81.62 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:27<00:00,  1.14it/s, Generation Speed: 81.40 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "d793af1620b642bbb444c4aec8cf05f8",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:36<59:31, 36.08s/it, Generation Speed: 1.36 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:36<25:01, 15.32s/it, Generation Speed: 2.90 toks/s]\u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:37<14:02,  8.69s/it, Generation Speed: 4.43 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:38<08:54,  5.57s/it, Generation Speed: 6.03 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:40<07:02,  4.45s/it, Generation Speed: 7.21 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:43<05:52,  3.75s/it, Generation Speed: 8.41 toks/s]\u001b[A\n",
      "Processed prompts:   8%|β–Š         | 8/100 [00:44<03:14,  2.11s/it, Generation Speed: 11.12 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:46<03:23,  2.23s/it, Generation Speed: 11.96 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:48<02:24,  1.63s/it, Generation Speed: 14.52 toks/s]\u001b[A\n",
      "Processed prompts:  12%|β–ˆβ–        | 12/100 [00:50<02:41,  1.83s/it, Generation Speed: 15.14 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:51<02:18,  1.59s/it, Generation Speed: 16.18 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:52<01:58,  1.38s/it, Generation Speed: 17.29 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:53<01:43,  1.22s/it, Generation Speed: 18.27 toks/s]\u001b[A\n",
      "Processed prompts:  16%|β–ˆβ–Œ        | 16/100 [00:54<01:33,  1.11s/it, Generation Speed: 19.48 toks/s]\u001b[A\n",
      "Processed prompts:  18%|β–ˆβ–Š        | 18/100 [00:56<01:37,  1.19s/it, Generation Speed: 21.04 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [00:57<01:11,  1.12it/s, Generation Speed: 23.13 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [00:59<01:24,  1.07s/it, Generation Speed: 23.72 toks/s]\u001b[A\n",
      "Processed prompts:  23%|β–ˆβ–ˆβ–Ž       | 23/100 [01:01<01:16,  1.01it/s, Generation Speed: 25.33 toks/s]\u001b[A\n",
      "Processed prompts:  24%|β–ˆβ–ˆβ–       | 24/100 [01:02<01:24,  1.11s/it, Generation Speed: 26.07 toks/s]\u001b[A\n",
      "Processed prompts:  26%|β–ˆβ–ˆβ–Œ       | 26/100 [01:03<00:59,  1.24it/s, Generation Speed: 27.88 toks/s]\u001b[A\n",
      "Processed prompts:  27%|β–ˆβ–ˆβ–‹       | 27/100 [01:04<01:04,  1.14it/s, Generation Speed: 28.60 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:05<00:44,  1.57it/s, Generation Speed: 31.20 toks/s]\u001b[A\n",
      "Processed prompts:  33%|β–ˆβ–ˆβ–ˆβ–Ž      | 33/100 [01:06<00:30,  2.21it/s, Generation Speed: 34.05 toks/s]\u001b[A\n",
      "Processed prompts:  34%|β–ˆβ–ˆβ–ˆβ–      | 34/100 [01:07<00:36,  1.80it/s, Generation Speed: 34.46 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:08<00:43,  1.51it/s, Generation Speed: 35.18 toks/s]\u001b[A\n",
      "Processed prompts:  38%|β–ˆβ–ˆβ–ˆβ–Š      | 38/100 [01:09<00:37,  1.67it/s, Generation Speed: 37.56 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:10<00:34,  1.75it/s, Generation Speed: 39.11 toks/s]\u001b[A\n",
      "Processed prompts:  42%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 42/100 [01:11<00:27,  2.13it/s, Generation Speed: 40.77 toks/s]\u001b[A\n",
      "Processed prompts:  43%|β–ˆβ–ˆβ–ˆβ–ˆβ–Ž     | 43/100 [01:11<00:26,  2.15it/s, Generation Speed: 41.34 toks/s]\u001b[A\n",
      "Processed prompts:  44%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 44/100 [01:12<00:26,  2.12it/s, Generation Speed: 42.01 toks/s]\u001b[A\n",
      "Processed prompts:  45%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 45/100 [01:13<00:32,  1.71it/s, Generation Speed: 42.43 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:14<00:36,  1.50it/s, Generation Speed: 43.14 toks/s]\u001b[A\n",
      "Processed prompts:  47%|β–ˆβ–ˆβ–ˆβ–ˆβ–‹     | 47/100 [01:14<00:32,  1.64it/s, Generation Speed: 43.91 toks/s]\u001b[A\n",
      "Processed prompts:  49%|β–ˆβ–ˆβ–ˆβ–ˆβ–‰     | 49/100 [01:15<00:22,  2.24it/s, Generation Speed: 45.85 toks/s]\u001b[A\n",
      "Processed prompts:  51%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 51/100 [01:15<00:17,  2.79it/s, Generation Speed: 47.62 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:16<00:17,  2.69it/s, Generation Speed: 49.28 toks/s]\u001b[A\n",
      "Processed prompts:  54%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 54/100 [01:17<00:21,  2.14it/s, Generation Speed: 49.59 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:17<00:20,  2.16it/s, Generation Speed: 50.27 toks/s]\u001b[A\n",
      "Processed prompts:  56%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 56/100 [01:17<00:20,  2.20it/s, Generation Speed: 50.88 toks/s]\u001b[A\n",
      "Processed prompts:  57%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹    | 57/100 [01:18<00:23,  1.82it/s, Generation Speed: 51.36 toks/s]\u001b[A\n",
      "Processed prompts:  59%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 59/100 [01:19<00:16,  2.55it/s, Generation Speed: 52.78 toks/s]\u001b[A\n",
      "Processed prompts:  60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 60/100 [01:19<00:15,  2.60it/s, Generation Speed: 53.56 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:19<00:11,  3.32it/s, Generation Speed: 55.04 toks/s]\u001b[A\n",
      "Processed prompts:  63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 63/100 [01:20<00:11,  3.21it/s, Generation Speed: 55.92 toks/s]\u001b[A\n",
      "Processed prompts:  66%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 66/100 [01:20<00:07,  4.68it/s, Generation Speed: 57.84 toks/s]\u001b[A\n",
      "Processed prompts:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹   | 67/100 [01:20<00:07,  4.27it/s, Generation Speed: 58.51 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:08,  3.95it/s, Generation Speed: 58.99 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:21<00:10,  3.04it/s, Generation Speed: 59.41 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:22<00:09,  3.10it/s, Generation Speed: 60.14 toks/s]\u001b[A\n",
      "Processed prompts:  71%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 71/100 [01:22<00:09,  3.16it/s, Generation Speed: 60.95 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:22<00:08,  3.22it/s, Generation Speed: 61.80 toks/s]\u001b[A\n",
      "Processed prompts:  74%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 74/100 [01:23<00:07,  3.37it/s, Generation Speed: 63.18 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:23<00:08,  2.84it/s, Generation Speed: 63.79 toks/s]\u001b[A\n",
      "Processed prompts:  76%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 76/100 [01:24<00:11,  2.12it/s, Generation Speed: 64.08 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:24<00:07,  3.04it/s, Generation Speed: 65.61 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:25<00:06,  3.19it/s, Generation Speed: 66.31 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:25<00:08,  2.47it/s, Generation Speed: 66.96 toks/s]\u001b[A\n",
      "Processed prompts:  82%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 82/100 [01:25<00:05,  3.55it/s, Generation Speed: 68.51 toks/s]\u001b[A\n",
      "Processed prompts:  83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 83/100 [01:26<00:04,  3.75it/s, Generation Speed: 69.13 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:26<00:03,  4.01it/s, Generation Speed: 69.76 toks/s]\u001b[A\n",
      "Processed prompts:  85%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 85/100 [01:26<00:04,  3.58it/s, Generation Speed: 70.46 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:26<00:01,  6.14it/s, Generation Speed: 72.80 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:27<00:01,  6.07it/s, Generation Speed: 73.56 toks/s]\u001b[A\n",
      "Processed prompts:  90%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 90/100 [01:27<00:01,  6.07it/s, Generation Speed: 74.55 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:27<00:02,  4.27it/s, Generation Speed: 75.26 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:28<00:01,  4.03it/s, Generation Speed: 76.63 toks/s]\u001b[A\n",
      "Processed prompts:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 94/100 [01:28<00:01,  3.70it/s, Generation Speed: 77.32 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:28<00:00,  4.39it/s, Generation Speed: 78.95 toks/s]\u001b[A\n",
      "Processed prompts:  97%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹| 97/100 [01:29<00:01,  2.66it/s, Generation Speed: 79.20 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:30<00:00,  2.85it/s, Generation Speed: 79.98 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:30<00:00,  3.06it/s, Generation Speed: 80.96 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:31<00:00,  1.10it/s, Generation Speed: 81.48 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "6e1cdb7dcf4048cb83b09cfad22ac04f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:40<1:06:31, 40.31s/it, Generation Speed: 1.49 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:43<30:30, 18.67s/it, Generation Speed: 2.92 toks/s]  \u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:47<18:53, 11.69s/it, Generation Speed: 4.09 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:48<11:51,  7.41s/it, Generation Speed: 5.26 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:48<07:59,  5.05s/it, Generation Speed: 6.62 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:49<05:40,  3.62s/it, Generation Speed: 7.79 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:50<04:12,  2.72s/it, Generation Speed: 9.04 toks/s]\u001b[A\n",
      "Processed prompts:   8%|β–Š         | 8/100 [00:52<03:43,  2.43s/it, Generation Speed: 10.16 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:54<03:22,  2.22s/it, Generation Speed: 11.36 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:55<02:03,  1.39s/it, Generation Speed: 13.79 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:56<01:27,  1.01s/it, Generation Speed: 15.83 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:56<01:24,  1.02it/s, Generation Speed: 16.90 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:59<01:54,  1.35s/it, Generation Speed: 17.61 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [01:00<01:21,  1.02it/s, Generation Speed: 19.77 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [01:02<01:15,  1.07it/s, Generation Speed: 21.56 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [01:02<01:00,  1.31it/s, Generation Speed: 23.24 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:03<00:58,  1.34it/s, Generation Speed: 24.15 toks/s]\u001b[A\n",
      "Processed prompts:  23%|β–ˆβ–ˆβ–Ž       | 23/100 [01:07<01:47,  1.40s/it, Generation Speed: 24.03 toks/s]\u001b[A\n",
      "Processed prompts:  26%|β–ˆβ–ˆβ–Œ       | 26/100 [01:07<01:00,  1.22it/s, Generation Speed: 26.78 toks/s]\u001b[A\n",
      "Processed prompts:  28%|β–ˆβ–ˆβ–Š       | 28/100 [01:08<00:47,  1.52it/s, Generation Speed: 28.92 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:09<00:28,  2.41it/s, Generation Speed: 32.96 toks/s]\u001b[A\n",
      "Processed prompts:  33%|β–ˆβ–ˆβ–ˆβ–Ž      | 33/100 [01:10<00:36,  1.85it/s, Generation Speed: 33.68 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:11<00:35,  1.82it/s, Generation Speed: 35.52 toks/s]\u001b[A\n",
      "Processed prompts:  38%|β–ˆβ–ˆβ–ˆβ–Š      | 38/100 [01:12<00:25,  2.47it/s, Generation Speed: 37.97 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:12<00:25,  2.39it/s, Generation Speed: 38.70 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:13<00:26,  2.31it/s, Generation Speed: 39.29 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:13<00:26,  2.26it/s, Generation Speed: 40.08 toks/s]\u001b[A\n",
      "Processed prompts:  42%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 42/100 [01:13<00:25,  2.26it/s, Generation Speed: 40.93 toks/s]\u001b[A\n",
      "Processed prompts:  44%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 44/100 [01:14<00:19,  2.85it/s, Generation Speed: 42.84 toks/s]\u001b[A\n",
      "Processed prompts:  47%|β–ˆβ–ˆβ–ˆβ–ˆβ–‹     | 47/100 [01:14<00:13,  3.94it/s, Generation Speed: 45.52 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:16<00:26,  1.96it/s, Generation Speed: 45.83 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:16<00:20,  2.42it/s, Generation Speed: 47.76 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:17<00:16,  2.88it/s, Generation Speed: 49.17 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:17<00:16,  2.77it/s, Generation Speed: 49.79 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:18<00:14,  3.21it/s, Generation Speed: 51.24 toks/s]\u001b[A\n",
      "Processed prompts:  56%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 56/100 [01:18<00:14,  2.98it/s, Generation Speed: 52.00 toks/s]\u001b[A\n",
      "Processed prompts:  57%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹    | 57/100 [01:19<00:14,  2.88it/s, Generation Speed: 52.53 toks/s]\u001b[A\n",
      "Processed prompts:  58%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š    | 58/100 [01:19<00:14,  2.87it/s, Generation Speed: 53.32 toks/s]\u001b[A\n",
      "Processed prompts:  61%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 61/100 [01:19<00:08,  4.33it/s, Generation Speed: 55.57 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:20<00:09,  3.92it/s, Generation Speed: 56.29 toks/s]\u001b[A\n",
      "Processed prompts:  65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 65/100 [01:21<00:10,  3.36it/s, Generation Speed: 57.91 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:07,  4.44it/s, Generation Speed: 60.14 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:22<00:10,  2.98it/s, Generation Speed: 61.03 toks/s]\u001b[A\n",
      "Processed prompts:  71%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 71/100 [01:23<00:09,  3.04it/s, Generation Speed: 61.75 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:23<00:10,  2.68it/s, Generation Speed: 62.09 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:24<00:08,  3.09it/s, Generation Speed: 63.86 toks/s]\u001b[A\n",
      "Processed prompts:  76%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 76/100 [01:24<00:07,  3.16it/s, Generation Speed: 64.51 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:25<00:06,  3.34it/s, Generation Speed: 65.70 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:25<00:07,  2.63it/s, Generation Speed: 66.56 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:26<00:06,  2.87it/s, Generation Speed: 67.29 toks/s]\u001b[A\n",
      "Processed prompts:  81%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 81/100 [01:26<00:06,  2.72it/s, Generation Speed: 68.03 toks/s]\u001b[A\n",
      "Processed prompts:  82%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 82/100 [01:26<00:05,  3.06it/s, Generation Speed: 68.75 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:26<00:03,  4.28it/s, Generation Speed: 70.08 toks/s]\u001b[A\n",
      "Processed prompts:  86%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 86/100 [01:27<00:02,  4.80it/s, Generation Speed: 71.51 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:27<00:02,  5.01it/s, Generation Speed: 72.28 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:27<00:01,  6.43it/s, Generation Speed: 73.68 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:28<00:01,  4.86it/s, Generation Speed: 75.70 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:28<00:01,  6.36it/s, Generation Speed: 77.28 toks/s]\u001b[A\n",
      "Processed prompts:  95%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 95/100 [01:28<00:00,  6.97it/s, Generation Speed: 78.81 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:28<00:00,  6.34it/s, Generation Speed: 79.92 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:29<00:00,  6.75it/s, Generation Speed: 81.49 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:29<00:00,  1.12it/s, Generation Speed: 83.23 toks/s][A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "313dedca02184a419c132d0c400507d7",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:35<58:52, 35.68s/it, Generation Speed: 1.71 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:39<12:31,  7.83s/it, Generation Speed: 5.95 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:42<09:59,  6.31s/it, Generation Speed: 7.04 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:44<08:06,  5.18s/it, Generation Speed: 8.20 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:45<06:04,  3.92s/it, Generation Speed: 9.38 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:46<03:50,  2.53s/it, Generation Speed: 11.75 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:47<02:31,  1.71s/it, Generation Speed: 14.45 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:48<01:48,  1.25s/it, Generation Speed: 16.79 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:49<01:40,  1.17s/it, Generation Speed: 17.76 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:52<02:06,  1.49s/it, Generation Speed: 18.32 toks/s]\u001b[A\n",
      "Processed prompts:  16%|β–ˆβ–Œ        | 16/100 [00:52<01:51,  1.33s/it, Generation Speed: 19.28 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [00:59<03:35,  2.60s/it, Generation Speed: 18.58 toks/s]\u001b[A\n",
      "Processed prompts:  18%|β–ˆβ–Š        | 18/100 [01:00<02:55,  2.14s/it, Generation Speed: 19.45 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [01:01<02:46,  2.05s/it, Generation Speed: 20.17 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [01:02<02:12,  1.66s/it, Generation Speed: 21.22 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [01:03<02:01,  1.53s/it, Generation Speed: 22.18 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:04<01:37,  1.25s/it, Generation Speed: 23.18 toks/s]\u001b[A\n",
      "Processed prompts:  25%|β–ˆβ–ˆβ–Œ       | 25/100 [01:04<00:49,  1.51it/s, Generation Speed: 26.12 toks/s]\u001b[A\n",
      "Processed prompts:  27%|β–ˆβ–ˆβ–‹       | 27/100 [01:05<00:38,  1.89it/s, Generation Speed: 28.47 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:06<00:26,  2.60it/s, Generation Speed: 31.55 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:06<00:24,  2.80it/s, Generation Speed: 33.30 toks/s]\u001b[A\n",
      "Processed prompts:  33%|β–ˆβ–ˆβ–ˆβ–Ž      | 33/100 [01:07<00:33,  2.01it/s, Generation Speed: 33.79 toks/s]\u001b[A\n",
      "Processed prompts:  34%|β–ˆβ–ˆβ–ˆβ–      | 34/100 [01:08<00:33,  1.96it/s, Generation Speed: 34.59 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:08<00:33,  1.92it/s, Generation Speed: 35.25 toks/s]\u001b[A\n",
      "Processed prompts:  36%|β–ˆβ–ˆβ–ˆβ–Œ      | 36/100 [01:09<00:33,  1.89it/s, Generation Speed: 36.20 toks/s]\u001b[A\n",
      "Processed prompts:  37%|β–ˆβ–ˆβ–ˆβ–‹      | 37/100 [01:09<00:33,  1.89it/s, Generation Speed: 36.91 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:10<00:25,  2.40it/s, Generation Speed: 38.30 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:10<00:25,  2.31it/s, Generation Speed: 39.23 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:11<00:33,  1.76it/s, Generation Speed: 39.84 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:12<00:14,  3.77it/s, Generation Speed: 44.35 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:12<00:13,  3.90it/s, Generation Speed: 45.77 toks/s]\u001b[A\n",
      "Processed prompts:  49%|β–ˆβ–ˆβ–ˆβ–ˆβ–‰     | 49/100 [01:13<00:14,  3.48it/s, Generation Speed: 46.78 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:13<00:15,  3.21it/s, Generation Speed: 47.50 toks/s]\u001b[A\n",
      "Processed prompts:  51%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 51/100 [01:14<00:16,  3.01it/s, Generation Speed: 48.16 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:14<00:21,  2.27it/s, Generation Speed: 48.56 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:15<00:24,  1.90it/s, Generation Speed: 49.10 toks/s]\u001b[A\n",
      "Processed prompts:  54%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 54/100 [01:16<00:22,  2.03it/s, Generation Speed: 49.65 toks/s]\u001b[A\n",
      "Processed prompts:  56%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 56/100 [01:16<00:16,  2.74it/s, Generation Speed: 51.29 toks/s]\u001b[A\n",
      "Processed prompts:  58%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š    | 58/100 [01:17<00:15,  2.65it/s, Generation Speed: 52.81 toks/s]\u001b[A\n",
      "Processed prompts:  59%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 59/100 [01:17<00:15,  2.63it/s, Generation Speed: 53.41 toks/s]\u001b[A\n",
      "Processed prompts:  60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 60/100 [01:18<00:18,  2.13it/s, Generation Speed: 53.86 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:19<00:16,  2.35it/s, Generation Speed: 55.26 toks/s]\u001b[A\n",
      "Processed prompts:  63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 63/100 [01:19<00:15,  2.45it/s, Generation Speed: 55.90 toks/s]\u001b[A\n",
      "Processed prompts:  64%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 64/100 [01:19<00:14,  2.54it/s, Generation Speed: 56.52 toks/s]\u001b[A\n",
      "Processed prompts:  65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 65/100 [01:20<00:13,  2.62it/s, Generation Speed: 57.04 toks/s]\u001b[A\n",
      "Processed prompts:  66%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 66/100 [01:20<00:12,  2.68it/s, Generation Speed: 58.05 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:11,  2.81it/s, Generation Speed: 59.16 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:21<00:10,  2.91it/s, Generation Speed: 59.68 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:21<00:09,  3.04it/s, Generation Speed: 60.50 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:22<00:06,  4.03it/s, Generation Speed: 62.17 toks/s]\u001b[A\n",
      "Processed prompts:  74%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 74/100 [01:22<00:06,  3.75it/s, Generation Speed: 63.42 toks/s]\u001b[A\n",
      "Processed prompts:  76%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 76/100 [01:23<00:07,  3.24it/s, Generation Speed: 64.56 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:23<00:05,  4.12it/s, Generation Speed: 66.59 toks/s]\u001b[A\n",
      "Processed prompts:  81%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 81/100 [01:24<00:03,  4.94it/s, Generation Speed: 68.17 toks/s]\u001b[A\n",
      "Processed prompts:  83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 83/100 [01:24<00:02,  5.87it/s, Generation Speed: 69.77 toks/s]\u001b[A\n",
      "Processed prompts:  85%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 85/100 [01:24<00:02,  6.75it/s, Generation Speed: 71.43 toks/s]\u001b[A\n",
      "Processed prompts:  86%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 86/100 [01:25<00:03,  3.89it/s, Generation Speed: 71.70 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:25<00:03,  3.56it/s, Generation Speed: 72.29 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:26<00:03,  3.06it/s, Generation Speed: 72.75 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:26<00:01,  5.15it/s, Generation Speed: 75.68 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:26<00:01,  4.75it/s, Generation Speed: 76.21 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:26<00:01,  5.18it/s, Generation Speed: 77.29 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:27<00:00,  6.97it/s, Generation Speed: 79.64 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:31<00:00,  1.09it/s, Generation Speed: 79.51 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a74c464d5b044bf8829e5685c0f5f9a5",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:35<58:17, 35.33s/it, Generation Speed: 1.73 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:38<26:49, 16.43s/it, Generation Speed: 3.14 toks/s]\u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:40<16:14, 10.04s/it, Generation Speed: 4.56 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:44<11:48,  7.38s/it, Generation Speed: 5.78 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:46<05:05,  3.28s/it, Generation Speed: 9.58 toks/s]\u001b[A\n",
      "Processed prompts:   8%|β–Š         | 8/100 [00:49<04:47,  3.12s/it, Generation Speed: 10.58 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:50<03:53,  2.56s/it, Generation Speed: 11.83 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:51<01:53,  1.31s/it, Generation Speed: 16.08 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:52<01:45,  1.23s/it, Generation Speed: 16.97 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:54<01:53,  1.33s/it, Generation Speed: 17.77 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [00:55<01:22,  1.00it/s, Generation Speed: 19.93 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [00:56<01:04,  1.26it/s, Generation Speed: 22.15 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [00:57<01:17,  1.04it/s, Generation Speed: 22.94 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [00:58<01:14,  1.07it/s, Generation Speed: 23.81 toks/s]\u001b[A\n",
      "Processed prompts:  23%|β–ˆβ–ˆβ–Ž       | 23/100 [00:59<00:56,  1.35it/s, Generation Speed: 25.74 toks/s]\u001b[A\n",
      "Processed prompts:  24%|β–ˆβ–ˆβ–       | 24/100 [01:01<01:11,  1.06it/s, Generation Speed: 26.17 toks/s]\u001b[A\n",
      "Processed prompts:  25%|β–ˆβ–ˆβ–Œ       | 25/100 [01:01<01:07,  1.11it/s, Generation Speed: 27.17 toks/s]\u001b[A\n",
      "Processed prompts:  26%|β–ˆβ–ˆβ–Œ       | 26/100 [01:02<01:01,  1.21it/s, Generation Speed: 27.87 toks/s]\u001b[A\n",
      "Processed prompts:  27%|β–ˆβ–ˆβ–‹       | 27/100 [01:03<01:07,  1.08it/s, Generation Speed: 28.18 toks/s]\u001b[A\n",
      "Processed prompts:  28%|β–ˆβ–ˆβ–Š       | 28/100 [01:04<01:00,  1.19it/s, Generation Speed: 29.02 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:05<00:51,  1.35it/s, Generation Speed: 30.59 toks/s]\u001b[A\n",
      "Processed prompts:  31%|β–ˆβ–ˆβ–ˆ       | 31/100 [01:06<00:48,  1.42it/s, Generation Speed: 31.39 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:07<01:05,  1.04it/s, Generation Speed: 31.90 toks/s]\u001b[A\n",
      "Processed prompts:  34%|β–ˆβ–ˆβ–ˆβ–      | 34/100 [01:08<00:44,  1.48it/s, Generation Speed: 33.70 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:09<00:49,  1.31it/s, Generation Speed: 34.21 toks/s]\u001b[A\n",
      "Processed prompts:  37%|β–ˆβ–ˆβ–ˆβ–‹      | 37/100 [01:10<00:35,  1.77it/s, Generation Speed: 35.81 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:11<00:32,  1.86it/s, Generation Speed: 37.42 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:11<00:25,  2.31it/s, Generation Speed: 39.38 toks/s]\u001b[A\n",
      "Processed prompts:  47%|β–ˆβ–ˆβ–ˆβ–ˆβ–‹     | 47/100 [01:12<00:13,  3.84it/s, Generation Speed: 44.66 toks/s]\u001b[A\n",
      "Processed prompts:  49%|β–ˆβ–ˆβ–ˆβ–ˆβ–‰     | 49/100 [01:13<00:15,  3.36it/s, Generation Speed: 46.15 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:14<00:18,  2.70it/s, Generation Speed: 46.66 toks/s]\u001b[A\n",
      "Processed prompts:  51%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 51/100 [01:14<00:18,  2.64it/s, Generation Speed: 47.37 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:15<00:26,  1.79it/s, Generation Speed: 47.73 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:16<00:29,  1.61it/s, Generation Speed: 48.33 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:17<00:27,  1.61it/s, Generation Speed: 49.34 toks/s]\u001b[A\n",
      "Processed prompts:  56%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 56/100 [01:18<00:25,  1.72it/s, Generation Speed: 50.16 toks/s]\u001b[A\n",
      "Processed prompts:  59%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 59/100 [01:19<00:20,  2.03it/s, Generation Speed: 52.09 toks/s]\u001b[A\n",
      "Processed prompts:  60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 60/100 [01:19<00:18,  2.12it/s, Generation Speed: 53.35 toks/s]\u001b[A\n",
      "Processed prompts:  63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 63/100 [01:20<00:11,  3.15it/s, Generation Speed: 55.82 toks/s]\u001b[A\n",
      "Processed prompts:  65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 65/100 [01:21<00:13,  2.67it/s, Generation Speed: 56.91 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:08,  3.71it/s, Generation Speed: 59.13 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:22<00:08,  3.61it/s, Generation Speed: 60.37 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:22<00:07,  3.62it/s, Generation Speed: 61.96 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:23<00:05,  4.82it/s, Generation Speed: 64.40 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:23<00:04,  5.27it/s, Generation Speed: 66.59 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:23<00:04,  5.07it/s, Generation Speed: 67.34 toks/s]\u001b[A\n",
      "Processed prompts:  81%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 81/100 [01:24<00:03,  4.86it/s, Generation Speed: 68.93 toks/s]\u001b[A\n",
      "Processed prompts:  83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 83/100 [01:24<00:02,  5.72it/s, Generation Speed: 70.29 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:24<00:02,  5.62it/s, Generation Speed: 70.96 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:24<00:01,  6.51it/s, Generation Speed: 73.07 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:25<00:02,  4.66it/s, Generation Speed: 74.03 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:25<00:02,  4.30it/s, Generation Speed: 74.75 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:25<00:01,  5.77it/s, Generation Speed: 76.40 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:26<00:01,  6.05it/s, Generation Speed: 77.10 toks/s]\u001b[A\n",
      "Processed prompts:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 94/100 [01:26<00:00,  7.81it/s, Generation Speed: 78.52 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:26<00:00,  4.46it/s, Generation Speed: 79.58 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:27<00:00,  5.58it/s, Generation Speed: 81.25 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:27<00:00,  4.42it/s, Generation Speed: 81.90 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:27<00:00,  1.14it/s, Generation Speed: 82.70 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e423bb10bcaa4d88a259a4d3f0e63564",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:34<56:53, 34.48s/it, Generation Speed: 1.62 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:36<24:45, 15.15s/it, Generation Speed: 3.27 toks/s]\u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:41<17:31, 10.84s/it, Generation Speed: 4.33 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:42<07:48,  4.93s/it, Generation Speed: 7.04 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:43<05:52,  3.74s/it, Generation Speed: 8.29 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:44<04:29,  2.89s/it, Generation Speed: 9.42 toks/s]\u001b[A\n",
      "Processed prompts:   8%|β–Š         | 8/100 [00:45<03:30,  2.29s/it, Generation Speed: 10.31 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:48<03:55,  2.59s/it, Generation Speed: 11.10 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:49<02:21,  1.59s/it, Generation Speed: 13.85 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:50<01:38,  1.13s/it, Generation Speed: 16.08 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:50<01:31,  1.06s/it, Generation Speed: 17.35 toks/s]\u001b[A\n",
      "Processed prompts:  16%|β–ˆβ–Œ        | 16/100 [00:51<01:07,  1.24it/s, Generation Speed: 19.59 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [00:53<01:23,  1.00s/it, Generation Speed: 20.22 toks/s]\u001b[A\n",
      "Processed prompts:  18%|β–ˆβ–Š        | 18/100 [00:56<01:53,  1.39s/it, Generation Speed: 20.56 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [00:56<01:42,  1.26s/it, Generation Speed: 21.22 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [00:57<01:33,  1.16s/it, Generation Speed: 21.89 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [00:58<01:26,  1.09s/it, Generation Speed: 22.46 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:00<01:38,  1.26s/it, Generation Speed: 23.33 toks/s]\u001b[A\n",
      "Processed prompts:  24%|β–ˆβ–ˆβ–       | 24/100 [01:01<01:06,  1.14it/s, Generation Speed: 25.46 toks/s]\u001b[A\n",
      "Processed prompts:  25%|β–ˆβ–ˆβ–Œ       | 25/100 [01:02<01:04,  1.17it/s, Generation Speed: 26.51 toks/s]\u001b[A\n",
      "Processed prompts:  28%|β–ˆβ–ˆβ–Š       | 28/100 [01:02<00:37,  1.94it/s, Generation Speed: 29.67 toks/s]\u001b[A\n",
      "Processed prompts:  29%|β–ˆβ–ˆβ–‰       | 29/100 [01:04<00:52,  1.34it/s, Generation Speed: 29.87 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:04<00:49,  1.42it/s, Generation Speed: 30.75 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:05<00:36,  1.87it/s, Generation Speed: 32.95 toks/s]\u001b[A\n",
      "Processed prompts:  37%|β–ˆβ–ˆβ–ˆβ–‹      | 37/100 [01:06<00:25,  2.47it/s, Generation Speed: 37.30 toks/s]\u001b[A\n",
      "Processed prompts:  38%|β–ˆβ–ˆβ–ˆβ–Š      | 38/100 [01:07<00:26,  2.37it/s, Generation Speed: 38.21 toks/s]\u001b[A\n",
      "Processed prompts:  39%|β–ˆβ–ˆβ–ˆβ–‰      | 39/100 [01:07<00:26,  2.27it/s, Generation Speed: 38.83 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:08<00:27,  2.20it/s, Generation Speed: 39.32 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:08<00:27,  2.18it/s, Generation Speed: 40.11 toks/s]\u001b[A\n",
      "Processed prompts:  43%|β–ˆβ–ˆβ–ˆβ–ˆβ–Ž     | 43/100 [01:09<00:21,  2.68it/s, Generation Speed: 41.99 toks/s]\u001b[A\n",
      "Processed prompts:  44%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 44/100 [01:09<00:22,  2.50it/s, Generation Speed: 42.85 toks/s]\u001b[A\n",
      "Processed prompts:  45%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 45/100 [01:10<00:22,  2.41it/s, Generation Speed: 43.72 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:10<00:22,  2.35it/s, Generation Speed: 44.42 toks/s]\u001b[A\n",
      "Processed prompts:  47%|β–ˆβ–ˆβ–ˆβ–ˆβ–‹     | 47/100 [01:11<00:22,  2.31it/s, Generation Speed: 45.05 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:12<00:35,  1.47it/s, Generation Speed: 45.14 toks/s]\u001b[A\n",
      "Processed prompts:  49%|β–ˆβ–ˆβ–ˆβ–ˆβ–‰     | 49/100 [01:13<00:31,  1.64it/s, Generation Speed: 46.21 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:13<00:27,  1.80it/s, Generation Speed: 46.94 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:14<00:23,  2.04it/s, Generation Speed: 48.45 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:15<00:26,  1.74it/s, Generation Speed: 48.99 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:15<00:23,  1.95it/s, Generation Speed: 50.24 toks/s]\u001b[A\n",
      "Processed prompts:  56%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 56/100 [01:16<00:21,  2.04it/s, Generation Speed: 50.89 toks/s]\u001b[A\n",
      "Processed prompts:  57%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹    | 57/100 [01:16<00:20,  2.13it/s, Generation Speed: 51.76 toks/s]\u001b[A\n",
      "Processed prompts:  58%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š    | 58/100 [01:17<00:23,  1.80it/s, Generation Speed: 52.02 toks/s]\u001b[A\n",
      "Processed prompts:  59%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰    | 59/100 [01:17<00:20,  1.96it/s, Generation Speed: 52.84 toks/s]\u001b[A\n",
      "Processed prompts:  61%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 61/100 [01:18<00:17,  2.22it/s, Generation Speed: 54.06 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:19<00:16,  2.33it/s, Generation Speed: 54.64 toks/s]\u001b[A\n",
      "Processed prompts:  63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 63/100 [01:19<00:15,  2.41it/s, Generation Speed: 55.33 toks/s]\u001b[A\n",
      "Processed prompts:  64%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 64/100 [01:20<00:18,  1.99it/s, Generation Speed: 55.72 toks/s]\u001b[A\n",
      "Processed prompts:  66%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 66/100 [01:20<00:12,  2.79it/s, Generation Speed: 57.21 toks/s]\u001b[A\n",
      "Processed prompts:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹   | 67/100 [01:20<00:11,  2.89it/s, Generation Speed: 57.63 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:10,  3.00it/s, Generation Speed: 58.23 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:21<00:07,  3.96it/s, Generation Speed: 59.78 toks/s]\u001b[A\n",
      "Processed prompts:  73%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž  | 73/100 [01:21<00:04,  5.50it/s, Generation Speed: 61.97 toks/s]\u001b[A\n",
      "Processed prompts:  74%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 74/100 [01:22<00:05,  4.98it/s, Generation Speed: 62.71 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:22<00:05,  4.69it/s, Generation Speed: 63.60 toks/s]\u001b[A\n",
      "Processed prompts:  77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹  | 77/100 [01:22<00:05,  4.39it/s, Generation Speed: 64.91 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:23<00:05,  4.34it/s, Generation Speed: 65.62 toks/s]\u001b[A\n",
      "Processed prompts:  79%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰  | 79/100 [01:23<00:06,  3.44it/s, Generation Speed: 66.22 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:23<00:06,  2.98it/s, Generation Speed: 66.92 toks/s]\u001b[A\n",
      "Processed prompts:  82%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 82/100 [01:24<00:05,  3.50it/s, Generation Speed: 68.65 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:24<00:04,  3.95it/s, Generation Speed: 70.35 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:24<00:01,  6.89it/s, Generation Speed: 73.40 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:25<00:01,  5.75it/s, Generation Speed: 73.88 toks/s]\u001b[A\n",
      "Processed prompts:  90%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 90/100 [01:25<00:02,  4.98it/s, Generation Speed: 74.43 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:25<00:01,  4.70it/s, Generation Speed: 74.99 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:26<00:01,  5.23it/s, Generation Speed: 75.88 toks/s]\u001b[A\n",
      "Processed prompts:  95%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 95/100 [01:26<00:00,  7.43it/s, Generation Speed: 78.29 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:26<00:00,  5.83it/s, Generation Speed: 78.96 toks/s]\u001b[A\n",
      "Processed prompts:  97%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹| 97/100 [01:26<00:00,  6.36it/s, Generation Speed: 80.01 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:27<00:00,  4.03it/s, Generation Speed: 80.47 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:27<00:00,  3.19it/s, Generation Speed: 81.10 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:27<00:00,  1.14it/s, Generation Speed: 81.90 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "333c59bbe9a34c8c8f167978b055b16e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:33<56:03, 33.98s/it, Generation Speed: 1.65 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:38<27:26, 16.80s/it, Generation Speed: 3.12 toks/s]\u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:43<18:31, 11.45s/it, Generation Speed: 4.29 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:47<13:20,  8.34s/it, Generation Speed: 5.44 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:49<09:27,  5.97s/it, Generation Speed: 6.51 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:50<07:06,  4.53s/it, Generation Speed: 7.52 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:52<05:37,  3.63s/it, Generation Speed: 8.48 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:53<03:10,  2.09s/it, Generation Speed: 10.82 toks/s]\u001b[A\n",
      "Processed prompts:  10%|β–ˆ         | 10/100 [00:55<03:00,  2.01s/it, Generation Speed: 11.51 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:56<02:32,  1.71s/it, Generation Speed: 12.66 toks/s]\u001b[A\n",
      "Processed prompts:  12%|β–ˆβ–        | 12/100 [00:57<02:11,  1.49s/it, Generation Speed: 13.84 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:58<01:55,  1.32s/it, Generation Speed: 15.02 toks/s]\u001b[A\n",
      "Processed prompts:  14%|β–ˆβ–        | 14/100 [00:58<01:43,  1.20s/it, Generation Speed: 15.88 toks/s]\u001b[A\n",
      "Processed prompts:  16%|β–ˆβ–Œ        | 16/100 [00:59<01:11,  1.17it/s, Generation Speed: 17.98 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [01:01<01:29,  1.08s/it, Generation Speed: 18.75 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [01:03<01:16,  1.06it/s, Generation Speed: 20.85 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:03<00:46,  1.68it/s, Generation Speed: 24.00 toks/s]\u001b[A\n",
      "Processed prompts:  23%|β–ˆβ–ˆβ–Ž       | 23/100 [01:04<00:46,  1.67it/s, Generation Speed: 25.23 toks/s]\u001b[A\n",
      "Processed prompts:  26%|β–ˆβ–ˆβ–Œ       | 26/100 [01:05<00:37,  1.99it/s, Generation Speed: 28.01 toks/s]\u001b[A\n",
      "Processed prompts:  29%|β–ˆβ–ˆβ–‰       | 29/100 [01:06<00:26,  2.64it/s, Generation Speed: 31.07 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:06<00:21,  3.21it/s, Generation Speed: 34.49 toks/s]\u001b[A\n",
      "Processed prompts:  33%|β–ˆβ–ˆβ–ˆβ–Ž      | 33/100 [01:07<00:23,  2.84it/s, Generation Speed: 35.12 toks/s]\u001b[A\n",
      "Processed prompts:  35%|β–ˆβ–ˆβ–ˆβ–Œ      | 35/100 [01:07<00:21,  3.00it/s, Generation Speed: 36.88 toks/s]\u001b[A\n",
      "Processed prompts:  37%|β–ˆβ–ˆβ–ˆβ–‹      | 37/100 [01:08<00:20,  3.14it/s, Generation Speed: 38.66 toks/s]\u001b[A\n",
      "Processed prompts:  38%|β–ˆβ–ˆβ–ˆβ–Š      | 38/100 [01:08<00:21,  2.82it/s, Generation Speed: 39.50 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:09<00:19,  3.07it/s, Generation Speed: 41.04 toks/s]\u001b[A\n",
      "Processed prompts:  41%|β–ˆβ–ˆβ–ˆβ–ˆ      | 41/100 [01:09<00:21,  2.75it/s, Generation Speed: 41.86 toks/s]\u001b[A\n",
      "Processed prompts:  42%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 42/100 [01:10<00:28,  2.03it/s, Generation Speed: 42.62 toks/s]\u001b[A\n",
      "Processed prompts:  43%|β–ˆβ–ˆβ–ˆβ–ˆβ–Ž     | 43/100 [01:11<00:27,  2.09it/s, Generation Speed: 43.49 toks/s]\u001b[A\n",
      "Processed prompts:  45%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 45/100 [01:11<00:20,  2.68it/s, Generation Speed: 45.21 toks/s]\u001b[A\n",
      "Processed prompts:  46%|β–ˆβ–ˆβ–ˆβ–ˆβ–Œ     | 46/100 [01:12<00:20,  2.62it/s, Generation Speed: 46.16 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:12<00:15,  3.26it/s, Generation Speed: 47.83 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:13<00:20,  2.41it/s, Generation Speed: 48.81 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:16<00:35,  1.37it/s, Generation Speed: 48.66 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:17<00:35,  1.32it/s, Generation Speed: 49.01 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:18<00:27,  1.63it/s, Generation Speed: 50.43 toks/s]\u001b[A\n",
      "Processed prompts:  57%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹    | 57/100 [01:18<00:20,  2.13it/s, Generation Speed: 51.95 toks/s]\u001b[A\n",
      "Processed prompts:  61%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 61/100 [01:19<00:12,  3.00it/s, Generation Speed: 55.09 toks/s]\u001b[A\n",
      "Processed prompts:  62%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 62/100 [01:19<00:12,  2.98it/s, Generation Speed: 56.03 toks/s]\u001b[A\n",
      "Processed prompts:  63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 63/100 [01:19<00:12,  2.95it/s, Generation Speed: 56.65 toks/s]\u001b[A\n",
      "Processed prompts:  65%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 65/100 [01:20<00:10,  3.49it/s, Generation Speed: 57.79 toks/s]\u001b[A\n",
      "Processed prompts:  66%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 66/100 [01:20<00:10,  3.35it/s, Generation Speed: 58.32 toks/s]\u001b[A\n",
      "Processed prompts:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹   | 67/100 [01:21<00:12,  2.67it/s, Generation Speed: 58.78 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:11,  2.75it/s, Generation Speed: 59.43 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:21<00:10,  2.86it/s, Generation Speed: 60.33 toks/s]\u001b[A\n",
      "Processed prompts:  70%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 70/100 [01:22<00:10,  2.96it/s, Generation Speed: 60.77 toks/s]\u001b[A\n",
      "Processed prompts:  71%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 71/100 [01:22<00:09,  3.07it/s, Generation Speed: 61.37 toks/s]\u001b[A\n",
      "Processed prompts:  72%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–  | 72/100 [01:22<00:08,  3.16it/s, Generation Speed: 62.29 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:23<00:04,  5.11it/s, Generation Speed: 64.48 toks/s]\u001b[A\n",
      "Processed prompts:  77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹  | 77/100 [01:23<00:06,  3.79it/s, Generation Speed: 65.36 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:24<00:05,  3.80it/s, Generation Speed: 66.04 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:24<00:05,  3.99it/s, Generation Speed: 67.40 toks/s]\u001b[A\n",
      "Processed prompts:  81%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 81/100 [01:24<00:05,  3.49it/s, Generation Speed: 68.12 toks/s]\u001b[A\n",
      "Processed prompts:  83%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž | 83/100 [01:25<00:03,  4.50it/s, Generation Speed: 69.84 toks/s]\u001b[A\n",
      "Processed prompts:  85%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 85/100 [01:25<00:03,  4.77it/s, Generation Speed: 71.08 toks/s]\u001b[A\n",
      "Processed prompts:  86%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 86/100 [01:25<00:02,  4.86it/s, Generation Speed: 71.78 toks/s]\u001b[A\n",
      "Processed prompts:  87%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹ | 87/100 [01:25<00:02,  4.99it/s, Generation Speed: 72.56 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:26<00:03,  3.64it/s, Generation Speed: 73.08 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:26<00:03,  3.46it/s, Generation Speed: 73.96 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:26<00:01,  5.12it/s, Generation Speed: 75.58 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:27<00:01,  4.73it/s, Generation Speed: 76.30 toks/s]\u001b[A\n",
      "Processed prompts:  95%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 95/100 [01:27<00:00,  6.06it/s, Generation Speed: 78.64 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:27<00:00,  5.80it/s, Generation Speed: 79.32 toks/s]\u001b[A\n",
      "Processed prompts:  97%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹| 97/100 [01:28<00:00,  3.48it/s, Generation Speed: 79.91 toks/s]\u001b[A\n",
      "Processed prompts:  99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰| 99/100 [01:29<00:00,  2.14it/s, Generation Speed: 80.91 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:30<00:00,  1.10it/s, Generation Speed: 81.45 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "bf7c43131bac4c8aa22c0cd1988e6368",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "Processed prompts:   0%|          | 0/100 [00:00<?, ?it/s, Generation Speed: 0.00 toks/s]\u001b[A\n",
      "Processed prompts:   1%|          | 1/100 [00:27<45:52, 27.80s/it, Generation Speed: 1.83 toks/s]\u001b[A\n",
      "Processed prompts:   2%|▏         | 2/100 [00:36<27:23, 16.77s/it, Generation Speed: 2.88 toks/s]\u001b[A\n",
      "Processed prompts:   3%|β–Ž         | 3/100 [00:40<17:39, 10.92s/it, Generation Speed: 4.14 toks/s]\u001b[A\n",
      "Processed prompts:   4%|▍         | 4/100 [00:42<11:38,  7.27s/it, Generation Speed: 5.37 toks/s]\u001b[A\n",
      "Processed prompts:   5%|β–Œ         | 5/100 [00:43<07:50,  4.95s/it, Generation Speed: 6.74 toks/s]\u001b[A\n",
      "Processed prompts:   6%|β–Œ         | 6/100 [00:45<06:02,  3.86s/it, Generation Speed: 7.90 toks/s]\u001b[A\n",
      "Processed prompts:   7%|β–‹         | 7/100 [00:48<05:45,  3.72s/it, Generation Speed: 8.89 toks/s]\u001b[A\n",
      "Processed prompts:   9%|β–‰         | 9/100 [00:49<03:13,  2.12s/it, Generation Speed: 11.46 toks/s]\u001b[A\n",
      "Processed prompts:  10%|β–ˆ         | 10/100 [00:50<02:41,  1.80s/it, Generation Speed: 12.59 toks/s]\u001b[A\n",
      "Processed prompts:  11%|β–ˆ         | 11/100 [00:51<02:17,  1.54s/it, Generation Speed: 13.89 toks/s]\u001b[A\n",
      "Processed prompts:  12%|β–ˆβ–        | 12/100 [00:52<02:19,  1.59s/it, Generation Speed: 14.77 toks/s]\u001b[A\n",
      "Processed prompts:  13%|β–ˆβ–Ž        | 13/100 [00:53<01:59,  1.38s/it, Generation Speed: 16.01 toks/s]\u001b[A\n",
      "Processed prompts:  15%|β–ˆβ–Œ        | 15/100 [00:55<01:36,  1.14s/it, Generation Speed: 18.23 toks/s]\u001b[A\n",
      "Processed prompts:  17%|β–ˆβ–‹        | 17/100 [00:56<01:11,  1.17it/s, Generation Speed: 20.34 toks/s]\u001b[A\n",
      "Processed prompts:  19%|β–ˆβ–‰        | 19/100 [00:57<01:09,  1.17it/s, Generation Speed: 22.22 toks/s]\u001b[A\n",
      "Processed prompts:  20%|β–ˆβ–ˆ        | 20/100 [00:58<01:08,  1.17it/s, Generation Speed: 23.31 toks/s]\u001b[A\n",
      "Processed prompts:  21%|β–ˆβ–ˆ        | 21/100 [01:00<01:22,  1.04s/it, Generation Speed: 23.86 toks/s]\u001b[A\n",
      "Processed prompts:  22%|β–ˆβ–ˆβ–       | 22/100 [01:01<01:17,  1.00it/s, Generation Speed: 24.77 toks/s]\u001b[A\n",
      "Processed prompts:  25%|β–ˆβ–ˆβ–Œ       | 25/100 [01:02<00:46,  1.60it/s, Generation Speed: 27.93 toks/s]\u001b[A\n",
      "Processed prompts:  26%|β–ˆβ–ˆβ–Œ       | 26/100 [01:02<00:45,  1.62it/s, Generation Speed: 28.97 toks/s]\u001b[A\n",
      "Processed prompts:  27%|β–ˆβ–ˆβ–‹       | 27/100 [01:03<00:44,  1.62it/s, Generation Speed: 29.88 toks/s]\u001b[A\n",
      "Processed prompts:  28%|β–ˆβ–ˆβ–Š       | 28/100 [01:04<00:54,  1.32it/s, Generation Speed: 30.07 toks/s]\u001b[A\n",
      "Processed prompts:  29%|β–ˆβ–ˆβ–‰       | 29/100 [01:05<00:51,  1.39it/s, Generation Speed: 30.77 toks/s]\u001b[A\n",
      "Processed prompts:  30%|β–ˆβ–ˆβ–ˆ       | 30/100 [01:06<00:59,  1.17it/s, Generation Speed: 31.36 toks/s]\u001b[A\n",
      "Processed prompts:  31%|β–ˆβ–ˆβ–ˆ       | 31/100 [01:08<01:16,  1.11s/it, Generation Speed: 31.65 toks/s]\u001b[A\n",
      "Processed prompts:  32%|β–ˆβ–ˆβ–ˆβ–      | 32/100 [01:09<01:13,  1.08s/it, Generation Speed: 32.33 toks/s]\u001b[A\n",
      "Processed prompts:  37%|β–ˆβ–ˆβ–ˆβ–‹      | 37/100 [01:09<00:26,  2.36it/s, Generation Speed: 36.98 toks/s]\u001b[A\n",
      "Processed prompts:  40%|β–ˆβ–ˆβ–ˆβ–ˆ      | 40/100 [01:09<00:19,  3.06it/s, Generation Speed: 39.68 toks/s]\u001b[A\n",
      "Processed prompts:  42%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 42/100 [01:10<00:21,  2.72it/s, Generation Speed: 41.15 toks/s]\u001b[A\n",
      "Processed prompts:  44%|β–ˆβ–ˆβ–ˆβ–ˆβ–     | 44/100 [01:12<00:24,  2.24it/s, Generation Speed: 42.28 toks/s]\u001b[A\n",
      "Processed prompts:  48%|β–ˆβ–ˆβ–ˆβ–ˆβ–Š     | 48/100 [01:12<00:15,  3.33it/s, Generation Speed: 46.17 toks/s]\u001b[A\n",
      "Processed prompts:  49%|β–ˆβ–ˆβ–ˆβ–ˆβ–‰     | 49/100 [01:13<00:19,  2.68it/s, Generation Speed: 46.53 toks/s]\u001b[A\n",
      "Processed prompts:  50%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ     | 50/100 [01:13<00:19,  2.63it/s, Generation Speed: 47.32 toks/s]\u001b[A\n",
      "Processed prompts:  52%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 52/100 [01:14<00:15,  3.04it/s, Generation Speed: 49.06 toks/s]\u001b[A\n",
      "Processed prompts:  53%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž    | 53/100 [01:14<00:16,  2.90it/s, Generation Speed: 49.59 toks/s]\u001b[A\n",
      "Processed prompts:  54%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–    | 54/100 [01:15<00:16,  2.74it/s, Generation Speed: 50.06 toks/s]\u001b[A\n",
      "Processed prompts:  55%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 55/100 [01:16<00:21,  2.10it/s, Generation Speed: 50.28 toks/s]\u001b[A\n",
      "Processed prompts:  56%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ    | 56/100 [01:17<00:28,  1.53it/s, Generation Speed: 50.64 toks/s]\u001b[A\n",
      "Processed prompts:  60%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 60/100 [01:18<00:15,  2.62it/s, Generation Speed: 53.87 toks/s]\u001b[A\n",
      "Processed prompts:  61%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ    | 61/100 [01:18<00:17,  2.24it/s, Generation Speed: 54.15 toks/s]\u001b[A\n",
      "Processed prompts:  63%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž   | 63/100 [01:19<00:13,  2.76it/s, Generation Speed: 55.39 toks/s]\u001b[A\n",
      "Processed prompts:  64%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–   | 64/100 [01:19<00:15,  2.34it/s, Generation Speed: 55.90 toks/s]\u001b[A\n",
      "Processed prompts:  66%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ   | 66/100 [01:21<00:17,  1.94it/s, Generation Speed: 56.73 toks/s]\u001b[A\n",
      "Processed prompts:  67%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹   | 67/100 [01:21<00:15,  2.13it/s, Generation Speed: 57.66 toks/s]\u001b[A\n",
      "Processed prompts:  68%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š   | 68/100 [01:21<00:13,  2.32it/s, Generation Speed: 58.13 toks/s]\u001b[A\n",
      "Processed prompts:  69%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰   | 69/100 [01:22<00:12,  2.51it/s, Generation Speed: 59.04 toks/s]\u001b[A\n",
      "Processed prompts:  73%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž  | 73/100 [01:23<00:09,  2.98it/s, Generation Speed: 62.34 toks/s]\u001b[A\n",
      "Processed prompts:  75%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ  | 75/100 [01:23<00:06,  3.65it/s, Generation Speed: 64.16 toks/s]\u001b[A\n",
      "Processed prompts:  77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹  | 77/100 [01:23<00:05,  4.32it/s, Generation Speed: 65.71 toks/s]\u001b[A\n",
      "Processed prompts:  78%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 78/100 [01:24<00:05,  4.24it/s, Generation Speed: 66.38 toks/s]\u001b[A\n",
      "Processed prompts:  80%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  | 80/100 [01:24<00:05,  3.69it/s, Generation Speed: 67.56 toks/s]\u001b[A\n",
      "Processed prompts:  82%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 82/100 [01:24<00:03,  4.61it/s, Generation Speed: 69.18 toks/s]\u001b[A\n",
      "Processed prompts:  84%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 84/100 [01:25<00:02,  5.55it/s, Generation Speed: 70.69 toks/s]\u001b[A\n",
      "Processed prompts:  86%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 86/100 [01:25<00:02,  6.50it/s, Generation Speed: 72.19 toks/s]\u001b[A\n",
      "Processed prompts:  88%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š | 88/100 [01:25<00:01,  7.50it/s, Generation Speed: 73.84 toks/s]\u001b[A\n",
      "Processed prompts:  89%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‰ | 89/100 [01:25<00:01,  7.25it/s, Generation Speed: 74.64 toks/s]\u001b[A\n",
      "Processed prompts:  90%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 90/100 [01:25<00:01,  7.13it/s, Generation Speed: 75.24 toks/s]\u001b[A\n",
      "Processed prompts:  91%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 91/100 [01:26<00:01,  6.94it/s, Generation Speed: 76.05 toks/s]\u001b[A\n",
      "Processed prompts:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 92/100 [01:26<00:01,  5.75it/s, Generation Speed: 76.62 toks/s]\u001b[A\n",
      "Processed prompts:  93%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Ž| 93/100 [01:26<00:01,  6.17it/s, Generation Speed: 77.30 toks/s]\u001b[A\n",
      "Processed prompts:  94%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–| 94/100 [01:26<00:01,  4.53it/s, Generation Speed: 77.83 toks/s]\u001b[A\n",
      "Processed prompts:  95%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 95/100 [01:27<00:01,  3.85it/s, Generation Speed: 78.53 toks/s]\u001b[A\n",
      "Processed prompts:  96%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ| 96/100 [01:27<00:00,  4.58it/s, Generation Speed: 79.37 toks/s]\u001b[A\n",
      "Processed prompts:  97%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹| 97/100 [01:27<00:00,  3.04it/s, Generation Speed: 79.74 toks/s]\u001b[A\n",
      "Processed prompts:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š| 98/100 [01:28<00:00,  3.49it/s, Generation Speed: 80.63 toks/s]\u001b[A\n",
      "Processed prompts: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 100/100 [01:29<00:00,  1.12it/s, Generation Speed: 81.78 toks/s]\u001b[A\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "0aa4ac3c1c3a4ccd9d27972d0cb776c9",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Flattening the indices:   0%|          | 0/100 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def process_batch(batch, batch_size, retry_count=0, max_retries=3, min_batch_size=25):\n",
    "    if len(batch) == 0:\n",
    "        return []\n",
    "\n",
    "    batch_prompts = batch[\"prompt\"]\n",
    "\n",
    "    try:\n",
    "        batch_results = generator(batch_prompts, sampling_params=params)\n",
    "        return batch.add_column(\n",
    "            \"generations\",\n",
    "            [result.model_dump_json() for result in batch_results],\n",
    "        )\n",
    "    except Exception as e:\n",
    "        print(f\"Error in generation for batch (size {len(batch)}): {e}\")\n",
    "\n",
    "        if retry_count >= max_retries or batch_size <= min_batch_size:\n",
    "            print(\"Max retries reached or batch size too small. Skipping batch.\")\n",
    "            return []\n",
    "\n",
    "        print(f\"Splitting batch and retrying (retry count: {retry_count + 1})\")\n",
    "        num_sub_batches = 2 ** (retry_count + 1)\n",
    "        sub_batch_size = max(batch_size // num_sub_batches, min_batch_size)\n",
    "        sub_batches = [\n",
    "            batch.shard(num_shards=num_sub_batches, index=i)\n",
    "            for i in range(num_sub_batches)\n",
    "        ]\n",
    "        print(f\"Sub batch size {sub_batch_size}\")\n",
    "        updated_sub_batches = []\n",
    "        for sub_batch in sub_batches:\n",
    "            updated_sub_batch = process_batch(\n",
    "                sub_batch, sub_batch_size, retry_count + 1, max_retries, min_batch_size\n",
    "            )\n",
    "            if len(updated_sub_batch) > 0:\n",
    "                updated_sub_batches.append(updated_sub_batch)\n",
    "\n",
    "        return concatenate_datasets(updated_sub_batches) if updated_sub_batches else []\n",
    "\n",
    "\n",
    "initial_batch_size = 100\n",
    "num_batches = len(ds) // initial_batch_size + (len(ds) % initial_batch_size != 0)\n",
    "dataset_parts = [ds.shard(num_shards=num_batches, index=i) for i in range(num_batches)]\n",
    "\n",
    "updated_parts = []\n",
    "for part in tqdm(dataset_parts):\n",
    "    updated_part = process_batch(part, initial_batch_size)\n",
    "    if len(updated_part) > 0:\n",
    "        updated_parts.append(updated_part)\n",
    "\n",
    "if updated_parts:\n",
    "    ds = concatenate_datasets(updated_parts)\n",
    "else:\n",
    "    print(\"No successfully updated parts. The dataset remains unchanged.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6f7768ac",
   "metadata": {},
   "source": [
    "If we look at our dataset we can see that we have a new column called `generations` which contains the generated data."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "490bf0b4-469b-4594-94a9-98916a47441e",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Dataset({\n",
       "    features: ['id', 'section', 'prompt', 'generations'],\n",
       "    num_rows: 1000\n",
       "})"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "457cc887-7931-43dc-a261-74e27fba2f28",
   "metadata": {},
   "source": [
    "Let's look at an example row"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "66b0a713-b2f6-4668-ad37-72073bbd8397",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'id': '116s4049rs',\n",
       " 'section': 'rear admiral in the Navy, or an equivalent grade in the Space Force is under investigation for alleged misconduct or pending the disposition of an adverse personnel action at the time of retirement, the Secretary of the military department concerned mayβ€” (A) conditionally determine the highest permanent grade of satisfactory service on active duty of the officer pending completion of the investigation or resolution of the personnel action, as applicable; and (B) retire the officer in that conditional grade, subject to subsection (e).',\n",
       " 'prompt': \"Write one good and three bad abstract descriptions of the following text. Output the descriptions in a JSON file with keys β€˜good’ and β€˜bad’.\\nExample:\\nText: Community Energy Savings Program Act of 2019\\n\\nThis bill directs the Department of Energy to establish a grant program for states and Indian tribes to provide loans to consumers and communities that want to implement cost-effective energy efficiency measures.\\nGood description: A legislative proposal to promote energy efficiency through financial incentives\\nBad description: A federal reform relating to the process for submitting planning applications related to oil pipelines\\n\\nNote: Descriptions can vary in abstraction, detail, and focus. Both good and bad descriptions should be short (max 20 words)\\n\\nText to describe: rear admiral in the Navy, or an equivalent grade in the Space Force is under investigation for alleged misconduct or pending the disposition of an adverse personnel action at the time of retirement, the Secretary of the military department concerned mayβ€” (A) conditionally determine the highest permanent grade of satisfactory service on active duty of the officer pending completion of the investigation or resolution of the personnel action, as applicable; and (B) retire the officer in that conditional grade, subject to subsection (e).\\nReturn a JSON object with the keys 'good' and 'bad' using this schema: {'properties': {'good': {'items': {'maxLength': 200, 'minLength': 20, 'type': 'string'}, 'maxItems': 1, 'minItems': 1, 'title': 'Good', 'type': 'array'}, 'bad': {'items': {'maxLength': 200, 'minLength': 20, 'type': 'string'}, 'maxItems': 3, 'minItems': 3, 'title': 'Bad', 'type': 'array'}}, 'required': ['good', 'bad'], 'title': 'AbstractDescriptions', 'type': 'object'}.\",\n",
       " 'generations': '{\"good\":[\"Retirement of rear admiral under investigation for misconduct may be conditional on the outcome of the investigation and resolution of personnel actions.\"],\"bad\":[\"A proposal to change the retirement benefits for military personnel based on their years of service.\",\"Legislation to implement new training programs for naval officers.\",\"Investigation process for harassment complaints in the military.\"]}'}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d048ff2-49bc-44fd-947b-facdc3977c85",
   "metadata": {},
   "source": [
    "We'll do some more work to format the dataset in a format that is compatible with Sentence Transformers training APIs but let's already push to the raw dataset to the Hub. We can push this to a config called `raw`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ee860819-fb00-4795-a75f-63d5b7961dee",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ec47fd798c884451b528398b7a2de379",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Uploading the dataset shards:   0%|          | 0/1 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ed56cf35793749ee862cc3ad6b42db6f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Creating parquet from Arrow format:   0%|          | 0/1 [00:00<?, ?ba/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "1e1348c5bf9947c8bbf1741004acb3e8",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "README.md:   0%|          | 0.00/798 [00:00<?, ?B/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "CommitInfo(commit_url='https://huggingface.co/datasets/davanstrien/bill_summary_us_chunks-similarity-yi/commit/026cf1d1555ec6fece47b57fe54dc0d01f793221', commit_message='Upload dataset', commit_description='', oid='026cf1d1555ec6fece47b57fe54dc0d01f793221', pr_url=None, pr_revision=None, pr_num=None)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ds.push_to_hub('bill_summary_us_chunks-similarity', \"raw\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7e441ea9",
   "metadata": {},
   "source": [
    "We can also see that we can load an example from the `generations` column as valid JSON."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "f02932d7-aac7-41de-af0f-7072ff3c1a79",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'good': ['Retirement of rear admiral under investigation for misconduct may be conditional on the outcome of the investigation and resolution of personnel actions.'],\n",
       " 'bad': ['A proposal to change the retirement benefits for military personnel based on their years of service.',\n",
       "  'Legislation to implement new training programs for naval officers.',\n",
       "  'Investigation process for harassment complaints in the military.']}"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "json.loads(ds[0]['generations'])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d842519-b64d-4e39-817c-112af8bc5013",
   "metadata": {},
   "source": [
    "### Formatting the dataset for Sentence Transformers\n",
    "\n",
    "Sentence Transformers requires a dataset with three columns: \"anchor\", \"positive\", and \"negative\". We can now format our dataset in this way.\n",
    "\n",
    "For now we'll just randomly select a positive and negative example from the generations we created. A later notebook will look at how we can select the best positive and negative examples for each anchor text in other ways."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "f4f03c81-0687-4842-8d35-366430502884",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "def format_for_st(row):\n",
    "    anchor = row[\"section\"]\n",
    "    generations = json.loads(row[\"generations\"])\n",
    "    good = generations.get(\"good\")\n",
    "    bad = generations.get(\"bad\")\n",
    "    positive = random.choice(good)\n",
    "    negative = random.choice(bad)\n",
    "    return {\"anchor\": anchor, \"positive\": positive, \"negative\": negative}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "e14b7b6b-d818-4bd3-a673-a1c005b99832",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'anchor': 'rear admiral in the Navy, or an equivalent grade in the Space Force is under investigation for alleged misconduct or pending the disposition of an adverse personnel action at the time of retirement, the Secretary of the military department concerned mayβ€” (A) conditionally determine the highest permanent grade of satisfactory service on active duty of the officer pending completion of the investigation or resolution of the personnel action, as applicable; and (B) retire the officer in that conditional grade, subject to subsection (e).',\n",
       " 'positive': 'Retirement of rear admiral under investigation for misconduct may be conditional on the outcome of the investigation and resolution of personnel actions.',\n",
       " 'negative': 'Legislation to implement new training programs for naval officers.'}"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "format_for_st(ds[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "187730e1-ba8c-4477-84c7-52f93a0cc2a3",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c9c7c837a8ba4731920494575f5a5773",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Map:   0%|          | 0/1000 [00:00<?, ? examples/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ds = ds.map(format_for_st)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86a62b23",
   "metadata": {},
   "source": [
    "We remove all the unnecessary columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "9d44960e-c4f8-46ac-bee0-393416508912",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "ds = ds.remove_columns([c for c in ds.column_names if c not in { 'anchor', 'positive', 'negative'}])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61229f25",
   "metadata": {},
   "source": [
    "We now push to the Hub, this time we don't specify a config so it will be pushed to the default config."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "c47e5f2c-eebe-46c8-93c3-dfab78318007",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7ed7ee9174bd4995b5342733ae766658",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Uploading the dataset shards:   0%|          | 0/1 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "b2815fe9ee2d413d900d8e335e4034e3",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Creating parquet from Arrow format:   0%|          | 0/1 [00:00<?, ?ba/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "2f709f07095441b8a38cce34d8eaca5a",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "README.md:   0%|          | 0.00/732 [00:00<?, ?B/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "info = ds.push_to_hub('bill_summary_us_chunks-similarity')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0fcba1cc",
   "metadata": {},
   "source": [
    "### Add some metadata to the Dataset Card\n",
    "\n",
    "We can now add some metadata to the dataset card. This will help us keep track of the dataset and understand how it was created."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "d6afcc00-1512-4ded-a36d-5e5d866112d9",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "card = DatasetCard.load(\"davanstrien/bill-summary-us-similarity\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "a92bea99-1e80-4711-9d6a-e1ea4afb56ab",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "card.data['tags'] = ['sentence-transformers', 'synthetic' ,\"synthetic-data-workshop\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "5126dd9a-9d73-4f6e-967b-ac93506bb720",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CommitInfo(commit_url='https://huggingface.co/datasets/davanstrien/bill_summary_us_chunks-similarity/commit/8cf7a2e9209f631f5395296b0f8ee081101f4479', commit_message='Upload README.md with huggingface_hub', commit_description='', oid='8cf7a2e9209f631f5395296b0f8ee081101f4479', pr_url=None, pr_revision=None, pr_num=None)"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "card.push_to_hub(\"davanstrien/bill_summary_us_chunks-similarity\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5dfd1c60",
   "metadata": {},
   "source": [
    "fin"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}