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/* globals Symbol: false, Uint8Array: false, WeakMap: false */2/*!3 * deep-eql4 * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>5 * MIT Licensed6 */7 8function type(obj) {9 if (typeof obj === 'undefined') {10 return 'undefined';11 }12 13 if (obj === null) {14 return 'null';15 }16 17 const stringTag = obj[Symbol.toStringTag];18 if (typeof stringTag === 'string') {19 return stringTag;20 }21 const sliceStart = 8;22 const sliceEnd = -1;23 return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);24}25 26function FakeMap() {27 this._key = 'chai/deep-eql__' + Math.random() + Date.now();28}29 30FakeMap.prototype = {31 get: function get(key) {32 return key[this._key];33 },34 set: function set(key, value) {35 if (Object.isExtensible(key)) {36 Object.defineProperty(key, this._key, {37 value: value,38 configurable: true,39 });40 }41 },42};43 44export var MemoizeMap = typeof WeakMap === 'function' ? WeakMap : FakeMap;45/*!46 * Check to see if the MemoizeMap has recorded a result of the two operands47 *48 * @param {Mixed} leftHandOperand49 * @param {Mixed} rightHandOperand50 * @param {MemoizeMap} memoizeMap51 * @returns {Boolean|null} result52*/53function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {54 // Technically, WeakMap keys can *only* be objects, not primitives.55 if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {56 return null;57 }58 var leftHandMap = memoizeMap.get(leftHandOperand);59 if (leftHandMap) {60 var result = leftHandMap.get(rightHandOperand);61 if (typeof result === 'boolean') {62 return result;63 }64 }65 return null;66}67 68/*!69 * Set the result of the equality into the MemoizeMap70 *71 * @param {Mixed} leftHandOperand72 * @param {Mixed} rightHandOperand73 * @param {MemoizeMap} memoizeMap74 * @param {Boolean} result75*/76function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {77 // Technically, WeakMap keys can *only* be objects, not primitives.78 if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {79 return;80 }81 var leftHandMap = memoizeMap.get(leftHandOperand);82 if (leftHandMap) {83 leftHandMap.set(rightHandOperand, result);84 } else {85 leftHandMap = new MemoizeMap();86 leftHandMap.set(rightHandOperand, result);87 memoizeMap.set(leftHandOperand, leftHandMap);88 }89}90 91/*!92 * Primary Export93 */94 95export default deepEqual;96 97/**98 * Assert deeply nested sameValue equality between two objects of any type.99 *100 * @param {Mixed} leftHandOperand101 * @param {Mixed} rightHandOperand102 * @param {Object} [options] (optional) Additional options103 * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.104 * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of105 complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular106 references to blow the stack.107 * @return {Boolean} equal match108 */109function deepEqual(leftHandOperand, rightHandOperand, options) {110 // If we have a comparator, we can't assume anything; so bail to its check first.111 if (options && options.comparator) {112 return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);113 }114 115 var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);116 if (simpleResult !== null) {117 return simpleResult;118 }119 120 // Deeper comparisons are pushed through to a larger function121 return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);122}123 124/**125 * Many comparisons can be canceled out early via simple equality or primitive checks.126 * @param {Mixed} leftHandOperand127 * @param {Mixed} rightHandOperand128 * @return {Boolean|null} equal match129 */130function simpleEqual(leftHandOperand, rightHandOperand) {131 // Equal references (except for Numbers) can be returned early132 if (leftHandOperand === rightHandOperand) {133 // Handle +-0 cases134 return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;135 }136 137 // handle NaN cases138 if (139 leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare140 rightHandOperand !== rightHandOperand // eslint-disable-line no-self-compare141 ) {142 return true;143 }144 145 // Anything that is not an 'object', i.e. symbols, functions, booleans, numbers,146 // strings, and undefined, can be compared by reference.147 if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {148 // Easy out b/c it would have passed the first equality check149 return false;150 }151 return null;152}153 154/*!155 * The main logic of the `deepEqual` function.156 *157 * @param {Mixed} leftHandOperand158 * @param {Mixed} rightHandOperand159 * @param {Object} [options] (optional) Additional options160 * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.161 * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of162 complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular163 references to blow the stack.164 * @return {Boolean} equal match165*/166function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {167 options = options || {};168 options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();169 var comparator = options && options.comparator;170 171 // Check if a memoized result exists.172 var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);173 if (memoizeResultLeft !== null) {174 return memoizeResultLeft;175 }176 var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);177 if (memoizeResultRight !== null) {178 return memoizeResultRight;179 }180 181 // If a comparator is present, use it.182 if (comparator) {183 var comparatorResult = comparator(leftHandOperand, rightHandOperand);184 // Comparators may return null, in which case we want to go back to default behavior.185 if (comparatorResult === false || comparatorResult === true) {186 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);187 return comparatorResult;188 }189 // To allow comparators to override *any* behavior, we ran them first. Since it didn't decide190 // what to do, we need to make sure to return the basic tests first before we move on.191 var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);192 if (simpleResult !== null) {193 // Don't memoize this, it takes longer to set/retrieve than to just compare.194 return simpleResult;195 }196 }197 198 var leftHandType = type(leftHandOperand);199 if (leftHandType !== type(rightHandOperand)) {200 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);201 return false;202 }203 204 // Temporarily set the operands in the memoize object to prevent blowing the stack205 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);206 207 var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);208 memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);209 return result;210}211 212function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {213 switch (leftHandType) {214 case 'String':215 case 'Number':216 case 'Boolean':217 case 'Date':218 // If these types are their instance types (e.g. `new Number`) then re-deepEqual against their values219 return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());220 case 'Promise':221 case 'Symbol':222 case 'function':223 case 'WeakMap':224 case 'WeakSet':225 return leftHandOperand === rightHandOperand;226 case 'Error':227 return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options);228 case 'Arguments':229 case 'Int8Array':230 case 'Uint8Array':231 case 'Uint8ClampedArray':232 case 'Int16Array':233 case 'Uint16Array':234 case 'Int32Array':235 case 'Uint32Array':236 case 'Float32Array':237 case 'Float64Array':238 case 'Array':239 return iterableEqual(leftHandOperand, rightHandOperand, options);240 case 'RegExp':241 return regexpEqual(leftHandOperand, rightHandOperand);242 case 'Generator':243 return generatorEqual(leftHandOperand, rightHandOperand, options);244 case 'DataView':245 return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);246 case 'ArrayBuffer':247 return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);248 case 'Set':249 return entriesEqual(leftHandOperand, rightHandOperand, options);250 case 'Map':251 return entriesEqual(leftHandOperand, rightHandOperand, options);252 case 'Temporal.PlainDate':253 case 'Temporal.PlainTime':254 case 'Temporal.PlainDateTime':255 case 'Temporal.Instant':256 case 'Temporal.ZonedDateTime':257 case 'Temporal.PlainYearMonth':258 case 'Temporal.PlainMonthDay':259 return leftHandOperand.equals(rightHandOperand);260 case 'Temporal.Duration':261 return leftHandOperand.total('nanoseconds') === rightHandOperand.total('nanoseconds');262 case 'Temporal.TimeZone':263 case 'Temporal.Calendar':264 return leftHandOperand.toString() === rightHandOperand.toString();265 default:266 return objectEqual(leftHandOperand, rightHandOperand, options);267 }268}269 270/*!271 * Compare two Regular Expressions for equality.272 *273 * @param {RegExp} leftHandOperand274 * @param {RegExp} rightHandOperand275 * @return {Boolean} result276 */277 278function regexpEqual(leftHandOperand, rightHandOperand) {279 return leftHandOperand.toString() === rightHandOperand.toString();280}281 282/*!283 * Compare two Sets/Maps for equality. Faster than other equality functions.284 *285 * @param {Set} leftHandOperand286 * @param {Set} rightHandOperand287 * @param {Object} [options] (Optional)288 * @return {Boolean} result289 */290 291function entriesEqual(leftHandOperand, rightHandOperand, options) {292 try {293 // IE11 doesn't support Set#entries or Set#@@iterator, so we need manually populate using Set#forEach294 if (leftHandOperand.size !== rightHandOperand.size) {295 return false;296 }297 if (leftHandOperand.size === 0) {298 return true;299 }300 } catch (sizeError) {301 // things that aren't actual Maps or Sets will throw here302 return false;303 }304 var leftHandItems = [];305 var rightHandItems = [];306 leftHandOperand.forEach(function gatherEntries(key, value) {307 leftHandItems.push([ key, value ]);308 });309 rightHandOperand.forEach(function gatherEntries(key, value) {310 rightHandItems.push([ key, value ]);311 });312 return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);313}314 315/*!316 * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.317 *318 * @param {Iterable} leftHandOperand319 * @param {Iterable} rightHandOperand320 * @param {Object} [options] (Optional)321 * @return {Boolean} result322 */323 324function iterableEqual(leftHandOperand, rightHandOperand, options) {325 var length = leftHandOperand.length;326 if (length !== rightHandOperand.length) {327 return false;328 }329 if (length === 0) {330 return true;331 }332 var index = -1;333 while (++index < length) {334 if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {335 return false;336 }337 }338 return true;339}340 341/*!342 * Simple equality for generator objects such as those returned by generator functions.343 *344 * @param {Iterable} leftHandOperand345 * @param {Iterable} rightHandOperand346 * @param {Object} [options] (Optional)347 * @return {Boolean} result348 */349 350function generatorEqual(leftHandOperand, rightHandOperand, options) {351 return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);352}353 354/*!355 * Determine if the given object has an @@iterator function.356 *357 * @param {Object} target358 * @return {Boolean} `true` if the object has an @@iterator function.359 */360function hasIteratorFunction(target) {361 return typeof Symbol !== 'undefined' &&362 typeof target === 'object' &&363 typeof Symbol.iterator !== 'undefined' &&364 typeof target[Symbol.iterator] === 'function';365}366 367/*!368 * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.369 * This will consume the iterator - which could have side effects depending on the @@iterator implementation.370 *371 * @param {Object} target372 * @returns {Array} an array of entries from the @@iterator function373 */374function getIteratorEntries(target) {375 if (hasIteratorFunction(target)) {376 try {377 return getGeneratorEntries(target[Symbol.iterator]());378 } catch (iteratorError) {379 return [];380 }381 }382 return [];383}384 385/*!386 * Gets all entries from a Generator. This will consume the generator - which could have side effects.387 *388 * @param {Generator} target389 * @returns {Array} an array of entries from the Generator.390 */391function getGeneratorEntries(generator) {392 var generatorResult = generator.next();393 var accumulator = [ generatorResult.value ];394 while (generatorResult.done === false) {395 generatorResult = generator.next();396 accumulator.push(generatorResult.value);397 }398 return accumulator;399}400 401/*!402 * Gets all own and inherited enumerable keys from a target.403 *404 * @param {Object} target405 * @returns {Array} an array of own and inherited enumerable keys from the target.406 */407function getEnumerableKeys(target) {408 var keys = [];409 for (var key in target) {410 keys.push(key);411 }412 return keys;413}414 415function getEnumerableSymbols(target) {416 var keys = [];417 var allKeys = Object.getOwnPropertySymbols(target);418 for (var i = 0; i < allKeys.length; i += 1) {419 var key = allKeys[i];420 if (Object.getOwnPropertyDescriptor(target, key).enumerable) {421 keys.push(key);422 }423 }424 return keys;425}426 427/*!428 * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of429 * each key. If any value of the given key is not equal, the function will return false (early).430 *431 * @param {Mixed} leftHandOperand432 * @param {Mixed} rightHandOperand433 * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against434 * @param {Object} [options] (Optional)435 * @return {Boolean} result436 */437function keysEqual(leftHandOperand, rightHandOperand, keys, options) {438 var length = keys.length;439 if (length === 0) {440 return true;441 }442 for (var i = 0; i < length; i += 1) {443 if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {444 return false;445 }446 }447 return true;448}449 450/*!451 * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`452 * for each enumerable key in the object.453 *454 * @param {Mixed} leftHandOperand455 * @param {Mixed} rightHandOperand456 * @param {Object} [options] (Optional)457 * @return {Boolean} result458 */459function objectEqual(leftHandOperand, rightHandOperand, options) {460 var leftHandKeys = getEnumerableKeys(leftHandOperand);461 var rightHandKeys = getEnumerableKeys(rightHandOperand);462 var leftHandSymbols = getEnumerableSymbols(leftHandOperand);463 var rightHandSymbols = getEnumerableSymbols(rightHandOperand);464 leftHandKeys = leftHandKeys.concat(leftHandSymbols);465 rightHandKeys = rightHandKeys.concat(rightHandSymbols);466 467 if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {468 if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {469 return false;470 }471 return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);472 }473 474 var leftHandEntries = getIteratorEntries(leftHandOperand);475 var rightHandEntries = getIteratorEntries(rightHandOperand);476 if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {477 leftHandEntries.sort();478 rightHandEntries.sort();479 return iterableEqual(leftHandEntries, rightHandEntries, options);480 }481 482 if (leftHandKeys.length === 0 &&483 leftHandEntries.length === 0 &&484 rightHandKeys.length === 0 &&485 rightHandEntries.length === 0) {486 return true;487 }488 489 return false;490}491 492/*!493 * Returns true if the argument is a primitive.494 *495 * This intentionally returns true for all objects that can be compared by reference,496 * including functions and symbols.497 *498 * @param {Mixed} value499 * @return {Boolean} result500 */501function isPrimitive(value) {502 return value === null || typeof value !== 'object';503}504 505function mapSymbols(arr) {506 return arr.map(function mapSymbol(entry) {507 if (typeof entry === 'symbol') {508 return entry.toString();509 }510 511 return entry;512 });513}514 