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
utils.js161 linesDownload Raw Back to src
1import { MAX_ARRAY_INDEX, MAX_ARRAY_LEN } from './constants.js';2 3/** @type {Record<string, string>} */4export const escaped = {5	'<': '\\u003C',6	'\\': '\\\\',7	'\b': '\\b',8	'\f': '\\f',9	'\n': '\\n',10	'\r': '\\r',11	'\t': '\\t',12	'\u2028': '\\u2028',13	'\u2029': '\\u2029'14};15 16export class DevalueError extends Error {17	/**18	 * @param {string} message19	 * @param {string[]} keys20	 * @param {any} [value] - The value that failed to be serialized21	 * @param {any} [root] - The root value being serialized22	 */23	constructor(message, keys, value, root) {24		super(message);25		this.name = 'DevalueError';26		this.path = keys.join('');27		this.value = value;28		this.root = root;29	}30}31 32/** @param {any} thing */33export function is_primitive(thing) {34	return thing === null || (typeof thing !== 'object' && typeof thing !== 'function');35}36 37const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype)38	.sort()39	.join('\0');40 41/** @param {any} thing */42export function is_plain_object(thing) {43	const proto = Object.getPrototypeOf(thing);44 45	return (46		proto === Object.prototype ||47		proto === null ||48		Object.getPrototypeOf(proto) === null ||49		Object.getOwnPropertyNames(proto).sort().join('\0') === object_proto_names50	);51}52 53/** @param {any} thing */54export function get_type(thing) {55	return Object.prototype.toString.call(thing).slice(8, -1);56}57 58/** @param {string} char */59function get_escaped_char(char) {60	switch (char) {61		case '"':62			return '\\"';63		case '<':64			return '\\u003C';65		case '\\':66			return '\\\\';67		case '\n':68			return '\\n';69		case '\r':70			return '\\r';71		case '\t':72			return '\\t';73		case '\b':74			return '\\b';75		case '\f':76			return '\\f';77		case '\u2028':78			return '\\u2028';79		case '\u2029':80			return '\\u2029';81		default:82			return char < ' ' ? `\\u${char.charCodeAt(0).toString(16).padStart(4, '0')}` : '';83	}84}85 86/** @param {string} str */87export function stringify_string(str) {88	let result = '';89	let last_pos = 0;90	const len = str.length;91 92	for (let i = 0; i < len; i += 1) {93		const char = str[i];94		const replacement = get_escaped_char(char);95		if (replacement) {96			result += str.slice(last_pos, i) + replacement;97			last_pos = i + 1;98		}99	}100 101	return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;102}103 104/** @param {Record<string | symbol, any>} object */105export function enumerable_symbols(object) {106	return Object.getOwnPropertySymbols(object).filter(107		(symbol) => Object.getOwnPropertyDescriptor(object, symbol).enumerable108	);109}110 111const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;112 113/** @param {string} key */114export function stringify_key(key) {115	return is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';116}117 118/** @param {number} n */119export function is_valid_array_index(n) {120	if (!Number.isInteger(n)) return false;121	if (n < 0) return false;122	if (n > MAX_ARRAY_INDEX) return false;123	return true;124}125 126/** @param {number} n */127export function is_valid_array_len(n) {128	if (!Number.isInteger(n)) return false;129	if (n < 0) return false;130	if (n > MAX_ARRAY_LEN) return false;131	return true;132}133 134/** @param {string} s */135function is_valid_array_index_string(s) {136	if (s.length === 0) return false;137	if (s.length > 1 && s.charCodeAt(0) === 48) return false; // leading zero138	for (let i = 0; i < s.length; i++) {139		const c = s.charCodeAt(i);140		if (c < 48 || c > 57) return false;141	}142	// by this point we know it's a string of digits, but it has to be within143	// the range of valid array indices144	return is_valid_array_index(+s);145}146 147/**148 * Finds the populated indices of an array.149 * @param {unknown[]} array150 */151export function valid_array_indices(array) {152	const keys = Object.keys(array);153	for (var i = keys.length - 1; i >= 0; i--) {154		if (is_valid_array_index_string(keys[i])) {155			break;156		}157	}158	keys.length = i + 1;159	return keys;160}161 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai