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 $TypeError = require('es-errors/type');6var $Uint8Array = GetIntrinsic('%Uint8Array%', true);7 8var isInteger = require('math-intrinsics/isInteger');9var callBound = require('call-bound');10 11var $charAt = callBound('String.prototype.charAt');12var $reverse = callBound('Array.prototype.reverse');13var $slice = callBound('Array.prototype.slice');14 15var bytesAsFloat32 = require('../helpers/bytesAsFloat32');16var bytesAsFloat64 = require('../helpers/bytesAsFloat64');17var bytesAsInteger = require('../helpers/bytesAsInteger');18var defaultEndianness = require('../helpers/defaultEndianness');19 20var IsDetachedBuffer = require('./IsDetachedBuffer');21 22var isArrayBuffer = require('is-array-buffer');23var safeConcat = require('safe-array-concat');24 25var tableTAO = require('./tables/typed-array-objects');26 27var isUnsignedElementType = function isUnsignedElementType(type) { return $charAt(type, 0) === 'U'; };28 29// https://262.ecma-international.org/6.0/#sec-getvaluefrombuffer30 31module.exports = function GetValueFromBuffer(arrayBuffer, byteIndex, type) {32 if (!isArrayBuffer(arrayBuffer)) {33 throw new $TypeError('Assertion failed: `arrayBuffer` must be an ArrayBuffer');34 }35 36 if (!isInteger(byteIndex)) {37 throw new $TypeError('Assertion failed: `byteIndex` must be an integer');38 }39 40 if (typeof type !== 'string') {41 throw new $TypeError('Assertion failed: `type` must be a string');42 }43 44 if (arguments.length > 3 && typeof arguments[3] !== 'boolean') {45 throw new $TypeError('Assertion failed: `isLittleEndian` must be a boolean, if present');46 }47 48 if (IsDetachedBuffer(arrayBuffer)) {49 throw new $TypeError('Assertion failed: ArrayBuffer is detached'); // step 150 }51 52 // 2. Assert: There are sufficient bytes in arrayBuffer starting at byteIndex to represent a value of type.53 54 if (byteIndex < 0) {55 throw new $TypeError('Assertion failed: `byteIndex` must be non-negative'); // step 356 }57 58 // 4. Let block be arrayBuffer’s [[ArrayBufferData]] internal slot.59 60 var elementSize = tableTAO.size['$' + type]; // step 561 if (!elementSize) {62 throw new $TypeError('Assertion failed: `type` must be one of ' + tableTAO.choices);63 }64 65 // 6. Let rawValue be a List of elementSize containing, in order, the elementSize sequence of bytes starting with block[byteIndex].66 var rawValue = $slice(new $Uint8Array(arrayBuffer, byteIndex), 0, elementSize); // step 667 68 // 8. If isLittleEndian is not present, set isLittleEndian to either true or false. The choice is implementation dependent and should be the alternative that is most efficient for the implementation. An implementation must use the same value each time this step is executed and the same value must be used for the corresponding step in the SetValueInBuffer abstract operation.69 var isLittleEndian = arguments.length > 3 ? arguments[3] : defaultEndianness === 'little'; // step 770 71 if (!isLittleEndian) {72 $reverse(rawValue); // step 873 }74 75 var bytes = $slice(safeConcat([0, 0, 0, 0, 0, 0, 0, 0], rawValue), -elementSize);76 77 if (type === 'Float32') { // step 378 return bytesAsFloat32(bytes);79 }80 81 if (type === 'Float64') { // step 482 return bytesAsFloat64(bytes);83 }84 85 return bytesAsInteger(bytes, elementSize, isUnsignedElementType(type), false);86};87 