Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1// Copyright © 2013 Pieroxy <pieroxy@pieroxy.net>2// This work is free. You can redistribute it and/or modify it3// under the terms of the WTFPL, Version 24// For more information see LICENSE.txt or http://www.wtfpl.net/5//6// LZ-based compression algorithm, version 1.0.2-rc17var LZString = {8 9 writeBit : function(value, data) {10 data.val = (data.val << 1) | value;11 if (data.position == 15) {12 data.position = 0;13 data.string += String.fromCharCode(data.val);14 data.val = 0;15 } else {16 data.position++;17 }18 },19 20 writeBits : function(numBits, value, data) {21 if (typeof(value)=="string")22 value = value.charCodeAt(0);23 for (var i=0 ; i<numBits ; i++) {24 this.writeBit(value&1, data);25 value = value >> 1;26 }27 },28 29 produceW : function (context) {30 if (Object.prototype.hasOwnProperty.call(context.dictionaryToCreate,context.w)) {31 if (context.w.charCodeAt(0)<256) {32 this.writeBits(context.numBits, 0, context.data);33 this.writeBits(8, context.w, context.data);34 } else {35 this.writeBits(context.numBits, 1, context.data);36 this.writeBits(16, context.w, context.data);37 }38 this.decrementEnlargeIn(context);39 delete context.dictionaryToCreate[context.w];40 } else {41 this.writeBits(context.numBits, context.dictionary[context.w], context.data);42 }43 this.decrementEnlargeIn(context);44 },45 46 decrementEnlargeIn : function(context) {47 context.enlargeIn--;48 if (context.enlargeIn == 0) {49 context.enlargeIn = Math.pow(2, context.numBits);50 context.numBits++;51 }52 },53 54 compress: function (uncompressed) {55 var context = {56 dictionary: {},57 dictionaryToCreate: {},58 c:"",59 wc:"",60 w:"",61 enlargeIn: 2, // Compensate for the first entry which should not count62 dictSize: 3,63 numBits: 2,64 result: "",65 data: {string:"", val:0, position:0}66 }, i;67 68 for (i = 0; i < uncompressed.length; i += 1) {69 context.c = uncompressed.charAt(i);70 if (!Object.prototype.hasOwnProperty.call(context.dictionary,context.c)) {71 context.dictionary[context.c] = context.dictSize++;72 context.dictionaryToCreate[context.c] = true;73 }74 75 context.wc = context.w + context.c;76 if (Object.prototype.hasOwnProperty.call(context.dictionary,context.wc)) {77 context.w = context.wc;78 } else {79 this.produceW(context);80 // Add wc to the dictionary.81 context.dictionary[context.wc] = context.dictSize++;82 context.w = String(context.c);83 }84 }85 86 // Output the code for w.87 if (context.w !== "") {88 this.produceW(context);89 }90 91 // Mark the end of the stream92 this.writeBits(context.numBits, 2, context.data);93 94 // Flush the last char95 while (context.data.val>0) this.writeBit(0,context.data)96 return context.data.string;97 },98 99 readBit : function(data) {100 var res = data.val & data.position;101 data.position >>= 1;102 if (data.position == 0) {103 data.position = 32768;104 data.val = data.string.charCodeAt(data.index++);105 }106 //data.val = (data.val << 1);107 return res>0 ? 1 : 0;108 },109 110 readBits : function(numBits, data) {111 var res = 0;112 var maxpower = Math.pow(2,numBits);113 var power=1;114 while (power!=maxpower) {115 res |= this.readBit(data) * power;116 power <<= 1;117 }118 return res;119 },120 121 decompress: function (compressed) {122 var dictionary = {},123 next,124 enlargeIn = 4,125 dictSize = 4,126 numBits = 3,127 entry = "",128 result = "",129 i,130 w,131 c,132 errorCount=0,133 literal,134 data = {string:compressed, val:compressed.charCodeAt(0), position:32768, index:1};135 136 for (i = 0; i < 3; i += 1) {137 dictionary[i] = i;138 }139 140 next = this.readBits(2, data);141 switch (next) {142 case 0: 143 c = String.fromCharCode(this.readBits(8, data));144 break;145 case 1: 146 c = String.fromCharCode(this.readBits(16, data));147 break;148 case 2: 149 return "";150 }151 dictionary[3] = c;152 w = result = c;153 while (true) {154 c = this.readBits(numBits, data);155 156 switch (c) {157 case 0: 158 if (errorCount++ > 10000) return "Error";159 c = String.fromCharCode(this.readBits(8, data));160 dictionary[dictSize++] = c;161 c = dictSize-1;162 enlargeIn--;163 break;164 case 1: 165 c = String.fromCharCode(this.readBits(16, data));166 dictionary[dictSize++] = c;167 c = dictSize-1;168 enlargeIn--;169 break;170 case 2: 171 return result;172 }173 174 if (enlargeIn == 0) {175 enlargeIn = Math.pow(2, numBits);176 numBits++;177 }178 179 if (dictionary[c]) {180 entry = dictionary[c];181 } else {182 if (c === dictSize) {183 entry = w + w.charAt(0);184 } else {185 return null;186 }187 }188 result += entry;189 190 // Add w+entry[0] to the dictionary.191 dictionary[dictSize++] = w + entry.charAt(0);192 enlargeIn--;193 194 w = entry;195 196 if (enlargeIn == 0) {197 enlargeIn = Math.pow(2, numBits);198 numBits++;199 }200 201 }202 return result;203 }204};205 