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'use strict';2 3var GetIntrinsic = require('get-intrinsic');4 5var min = require('math-intrinsics/min');6var $TypeError = require('es-errors/type');7var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);8var $Uint8Array = GetIntrinsic('%Uint8Array%', true);9 10var callBound = require('call-bound');11 12var byteLength = require('array-buffer-byte-length');13var $maxByteLength = callBound('%ArrayBuffer.prototype.maxByteLength%', true);14var copy = function copyAB(src, start, end) {15 var that = new $Uint8Array(src);16 if (typeof end === 'undefined') {17 end = that.length; // eslint-disable-line no-param-reassign18 }19 var result = new $ArrayBuffer(end - start);20 var resultArray = new $Uint8Array(result);21 for (var i = 0; i < resultArray.length; i++) {22 resultArray[i] = that[i + start];23 }24 return result;25};26var $abSlice = callBound('%ArrayBuffer.prototype.slice%', true)27 || function slice(ab, a, b) { // in node < 0.11, slice is an own nonconfigurable property28 return ab.slice ? ab.slice(a, b) : copy(ab, a, b); // node 0.8 lacks `slice`29 };30 31var DetachArrayBuffer = require('./DetachArrayBuffer');32var IsDetachedBuffer = require('./IsDetachedBuffer');33var IsFixedLengthArrayBuffer = require('./IsFixedLengthArrayBuffer');34var ToIndex = require('./ToIndex');35 36var isArrayBuffer = require('is-array-buffer');37var isSharedArrayBuffer = require('is-shared-array-buffer');38 39// https://262.ecma-international.org/15.0/#sec-arraybuffercopyanddetach40 41module.exports = function ArrayBufferCopyAndDetach(arrayBuffer, newLength, preserveResizability) {42 if (preserveResizability !== 'PRESERVE-RESIZABILITY' && preserveResizability !== 'FIXED-LENGTH') {43 throw new $TypeError('`preserveResizability` must be ~PRESERVE-RESIZABILITY~ or ~FIXED-LENGTH~');44 }45 46 if (!isArrayBuffer(arrayBuffer) || isSharedArrayBuffer(arrayBuffer)) {47 throw new $TypeError('`arrayBuffer` must be a non-shared ArrayBuffer'); // steps 1 - 248 }49 50 var abByteLength;51 52 var newByteLength;53 if (typeof newLength === 'undefined') { // step 354 newByteLength = byteLength(arrayBuffer); // step 3.a55 abByteLength = newByteLength;56 } else { // step 457 newByteLength = ToIndex(newLength); // step 4.a58 }59 60 if (IsDetachedBuffer(arrayBuffer)) {61 throw new $TypeError('`arrayBuffer` must not be detached'); // step 562 }63 64 var newMaxByteLength;65 if (preserveResizability === 'PRESERVE-RESIZABILITY' && !IsFixedLengthArrayBuffer(arrayBuffer)) { // step 666 newMaxByteLength = $maxByteLength(arrayBuffer); // step 6.a67 } else { // step 768 newMaxByteLength = 'EMPTY'; // step 7.a69 }70 71 // commented out since there's no way to set or access this key72 73 // 8. If arrayBuffer.[[ArrayBufferDetachKey]] is not undefined, throw a TypeError exception.74 75 // 9. Let newBuffer be ? AllocateArrayBuffer(%ArrayBuffer%, newByteLength, newMaxByteLength).76 var newBuffer = newMaxByteLength === 'EMPTY' ? new $ArrayBuffer(newByteLength) : new $ArrayBuffer(newByteLength, { maxByteLength: newMaxByteLength });77 78 if (typeof abByteLength !== 'number') {79 abByteLength = byteLength(arrayBuffer);80 }81 var copyLength = min(newByteLength, abByteLength); // step 1082 if (newByteLength > copyLength || newMaxByteLength !== 'EMPTY') {83 var taNew = new $Uint8Array(newBuffer);84 var taOld = new $Uint8Array(arrayBuffer);85 for (var i = 0; i < copyLength; i++) {86 taNew[i] = taOld[i];87 }88 } else {89 newBuffer = $abSlice(arrayBuffer, 0, copyLength); // ? optimization for when the new buffer will not be larger than the old one90 }91 /*92 11. Let fromBlock be arrayBuffer.[[ArrayBufferData]].93 12. Let toBlock be newBuffer.[[ArrayBufferData]].94 13. Perform CopyDataBlockBytes(toBlock, 0, fromBlock, 0, copyLength).95 14. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a realloc.96 */97 98 DetachArrayBuffer(arrayBuffer); // step 1599 100 return newBuffer; // step 16101};102 