Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
GetValueFromBuffer.js97 linesDownload Raw Back to 2021
1'use strict';2 3var GetIntrinsic = require('get-intrinsic');4 5var $SyntaxError = require('es-errors/syntax');6var $TypeError = require('es-errors/type');7var $Uint8Array = GetIntrinsic('%Uint8Array%', true);8var isInteger = require('math-intrinsics/isInteger');9 10var callBound = require('call-bound');11 12var $slice = callBound('Array.prototype.slice');13 14var IsDetachedBuffer = require('./IsDetachedBuffer');15var RawBytesToNumeric = require('./RawBytesToNumeric');16 17var isArrayBuffer = require('is-array-buffer');18var isSharedArrayBuffer = require('is-shared-array-buffer');19var safeConcat = require('safe-array-concat');20 21var tableTAO = require('./tables/typed-array-objects');22 23var defaultEndianness = require('../helpers/defaultEndianness');24 25// https://262.ecma-international.org/11.0/#sec-getvaluefrombuffer26 27module.exports = function GetValueFromBuffer(arrayBuffer, byteIndex, type, isTypedArray, order) {28	var isSAB = isSharedArrayBuffer(arrayBuffer);29	if (!isArrayBuffer(arrayBuffer) && !isSAB) {30		throw new $TypeError('Assertion failed: `arrayBuffer` must be an ArrayBuffer or a SharedArrayBuffer');31	}32 33	if (!isInteger(byteIndex)) {34		throw new $TypeError('Assertion failed: `byteIndex` must be an integer');35	}36 37	if (typeof type !== 'string' || typeof tableTAO.size['$' + type] !== 'number') {38		throw new $TypeError('Assertion failed: `type` must be one of ' + tableTAO.choices);39	}40 41	if (typeof isTypedArray !== 'boolean') {42		throw new $TypeError('Assertion failed: `isTypedArray` must be a boolean');43	}44 45	if (order !== 'SeqCst' && order !== 'Unordered') {46		throw new $TypeError('Assertion failed: `order` must be either `SeqCst` or `Unordered`');47	}48 49	if (arguments.length > 5 && typeof arguments[5] !== 'boolean') {50		throw new $TypeError('Assertion failed: `isLittleEndian` must be a boolean, if present');51	}52 53	if (IsDetachedBuffer(arrayBuffer)) {54		throw new $TypeError('Assertion failed: `arrayBuffer` is detached'); // step 155	}56 57	// 2. Assert: There are sufficient bytes in arrayBuffer starting at byteIndex to represent a value of type.58 59	if (byteIndex < 0) {60		throw new $TypeError('Assertion failed: `byteIndex` must be non-negative'); // step 361	}62 63	// 4. Let block be arrayBuffer.[[ArrayBufferData]].64 65	var elementSize = tableTAO.size['$' + type]; // step 566	if (!elementSize) {67		throw new $TypeError('Assertion failed: `type` must be one of ' + tableTAO.choices);68	}69 70	var rawValue;71	if (isSAB) { // step 672		/*73		a. Let execution be the [[CandidateExecution]] field of the surrounding agent's Agent Record.74		b. Let eventList be the [[EventList]] field of the element in execution.[[EventLists]] whose [[AgentSignifier]] is AgentSignifier().75		c. If isTypedArray is true and type is "Int8", "Uint8", "Int16", "Uint16", "Int32", or "Uint32", let noTear be true; otherwise let noTear be false.76		d. Let rawValue be a List of length elementSize of nondeterministically chosen byte values.77		e. NOTE: In implementations, rawValue is the result of a non-atomic or atomic read instruction on the underlying hardware. The nondeterminism is a semantic prescription of the memory model to describe observable behaviour of hardware with weak consistency.78		f. Let readEvent be ReadSharedMemory{ [[Order]]: order, [[NoTear]]: noTear, [[Block]]: block, [[ByteIndex]]: byteIndex, [[ElementSize]]: elementSize }.79		g. Append readEvent to eventList.80		h. Append Chosen Value Record { [[Event]]: readEvent, [[ChosenValue]]: rawValue } to execution.[[ChosenValues]].81		*/82		throw new $SyntaxError('SharedArrayBuffer is not supported by this implementation');83	} else {84		// 7. Let rawValue be a List of elementSize containing, in order, the elementSize sequence of bytes starting with block[byteIndex].85		rawValue = $slice(new $Uint8Array(arrayBuffer, byteIndex), 0, elementSize); // step 686	}87 88	// 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.89	var isLittleEndian = arguments.length > 5 ? arguments[5] : defaultEndianness === 'little'; // step 890 91	var bytes = isLittleEndian92		? $slice(safeConcat([0, 0, 0, 0, 0, 0, 0, 0], rawValue), -elementSize)93		: $slice(safeConcat(rawValue, [0, 0, 0, 0, 0, 0, 0, 0]), 0, elementSize);94 95	return RawBytesToNumeric(type, bytes, isLittleEndian);96};97 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai