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/* eslint-env mocha */2 3const ImageData = (typeof window === 'object' ? window.ImageData : require('./index.js'))4 5const assert = (condition) => { if (!condition) throw new Error('Assertion failed') }6const assertThrows = (fn, condition) => { try { fn() } catch (err) { return assert(condition(err)) }; throw new Error('Function did not throw') }7 8const isStrict = (function () { return !this })()9const getRGBA = (data, idx) => `${data[(idx * 4)]},${data[(idx * 4) + 1]},${data[(idx * 4) + 2]},${data[(idx * 4) + 3]}`10const setRGBA = (data, idx, color) => data.set(color.split(',').map(Number), idx * 4)11 12assert(typeof ImageData === 'function')13assert(ImageData.length === 2)14 15{16 const img = new ImageData(10, 10)17 18 assert(typeof img === 'object')19 assert(img.width === 10)20 assert(img.height === 10)21 assert(img.data instanceof Uint8ClampedArray)22 assert(img.data.length === 400)23 assert(getRGBA(img.data, 4) === '0,0,0,0')24 25 setRGBA(img.data, 4, '0,255,255,128')26 assert(getRGBA(img.data, 4) === '0,255,255,128')27}28 29{30 const arr = new Uint8ClampedArray(24)31 const img = new ImageData(arr, 2)32 33 assert(typeof img === 'object')34 assert(img.width === 2)35 assert(img.height === 3)36 assert(img.data === arr)37}38 39{40 const arr = new Uint8ClampedArray(28)41 const img = new ImageData(arr, 7)42 43 assert(typeof img === 'object')44 assert(img.width === 7)45 assert(img.height === 1)46 assert(img.data === arr)47}48 49{50 const arr = new Uint8ClampedArray(28)51 const img = new ImageData(arr, 7, undefined)52 53 assert(typeof img === 'object')54 assert(img.width === 7)55 assert(img.height === 1)56 assert(img.data === arr)57}58 59{60 const arr = new Uint8ClampedArray(24)61 const img = new ImageData(arr, 2, 3)62 63 assert(typeof img === 'object')64 assert(img.width === 2)65 assert(img.height === 3)66 assert(img.data === arr)67}68 69{70 const img = new ImageData(100, 50)71 72 assertThrows(() => new ImageData(), err => err.name === 'TypeError' && err.message === "Failed to construct 'ImageData': 2 arguments required, but only 0 present.")73 assertThrows(() => new ImageData(10), err => err.name === 'TypeError' && err.message === "Failed to construct 'ImageData': 2 arguments required, but only 1 present.")74 assertThrows(() => new ImageData(new Uint8ClampedArray(0)), err => err.name === 'TypeError' && err.message === "Failed to construct 'ImageData': 2 arguments required, but only 1 present.")75 assertThrows(() => new ImageData(new Uint8Array(400), 25, 25), err => err.name === 'TypeError' && err.message === "Failed to construct 'ImageData': parameter 1 is not of type 'Uint8ClampedArray'.")76 77 assertThrows(() => new ImageData(10, undefined), err => err.message === "Failed to construct 'ImageData': The source height is zero or not a number.")78 assertThrows(() => new ImageData(0, 10), err => err.message === "Failed to construct 'ImageData': The source width is zero or not a number.")79 assertThrows(() => new ImageData(10, 0), err => err.message === "Failed to construct 'ImageData': The source height is zero or not a number.")80 assertThrows(() => new ImageData('width', 'height'), err => err.message === "Failed to construct 'ImageData': The source width is zero or not a number.")81 assertThrows(() => new ImageData(1 << 31, 1 << 31), err => err.message === "Failed to construct 'ImageData': The requested image size exceeds the supported range.")82 83 assertThrows(() => new ImageData(new Uint8ClampedArray(27), 2), err => err.message === "Failed to construct 'ImageData': The input data length is not a multiple of 4.")84 assertThrows(() => new ImageData(new Uint8ClampedArray(28), 7, 0), err => err.message === "Failed to construct 'ImageData': The source height is zero or not a number.")85 assertThrows(() => new ImageData(new Uint8ClampedArray(104), 14), err => err.message === "Failed to construct 'ImageData': The input data length is not a multiple of (4 * width).")86 assertThrows(() => new ImageData(new Uint8ClampedArray([12, 34, 168, 65328]), 1, 151), err => err.message === "Failed to construct 'ImageData': The input data length is not equal to (4 * width * height).")87 assertThrows(() => new ImageData(this, 4, 4), err => err.name === 'TypeError' && err.message === "Failed to construct 'ImageData': parameter 1 is not of type 'Uint8ClampedArray'.")88 assertThrows(() => new ImageData(null, 4, 4), err => err.name === 'TypeError' && err.message === "Failed to construct 'ImageData': parameter 1 is not of type 'Uint8ClampedArray'.")89 assertThrows(() => new ImageData(img.data, 0), err => err.message === "Failed to construct 'ImageData': The source width is zero or not a number.")90 assertThrows(() => new ImageData(img.data, 13), err => err.message === "Failed to construct 'ImageData': The input data length is not a multiple of (4 * width).")91 assertThrows(() => new ImageData(img.data, 1 << 31), err => err.message === "Failed to construct 'ImageData': The requested image size exceeds the supported range.")92 assertThrows(() => new ImageData(img.data, 'biggish'), err => err.message === "Failed to construct 'ImageData': The source width is zero or not a number.")93 assertThrows(() => new ImageData(img.data, 1 << 24, 1 << 31), err => err.message === "Failed to construct 'ImageData': The requested image size exceeds the supported range.")94}95 96{97 const img = new ImageData(-0xfffffffc, -0xfffffffc)98 99 assert(img.width === 4)100 assert(img.height === 4)101 assert(img.data.length === 64)102}103 104{105 const arr = new Uint8ClampedArray(64)106 const img = new ImageData(arr, -0xfffffffc)107 108 assert(img.width === 4)109 assert(img.height === 4)110 assert(img.data.length === 64)111}112 113{114 const arr = new Uint8ClampedArray(64)115 const img = new ImageData(arr, -0xfffffffc, -0xfffffffc)116 117 assert(img.width === 4)118 assert(img.height === 4)119 assert(img.data.length === 64)120}121 122{123 const img1 = new ImageData(100, 50)124 const img2 = new ImageData(img1.data, 100)125 126 assert(img2.width === 100)127 assert(img2.height === 50)128 assert(img2.data === img1.data)129 130 assert(getRGBA(img1.data, 10) === '0,0,0,0')131 assert(getRGBA(img2.data, 10) === '0,0,0,0')132 133 setRGBA(img1.data, 10, '0,255,255,128')134 assert(getRGBA(img1.data, 10) === '0,255,255,128')135 assert(getRGBA(img2.data, 10) === '0,255,255,128')136}137 138{139 const arr = new Uint8ClampedArray(400)140 141 arr[22] = 129142 143 const img = new ImageData(arr, 20, 5)144 assert(img.width === 20)145 assert(img.height === 5)146 assert(img.data === arr)147 148 assert(getRGBA(arr, 2) === '0,0,0,0')149 assert(getRGBA(img.data, 2) === '0,0,0,0')150 151 setRGBA(img.data, 2, '0,255,255,128')152 assert(getRGBA(arr, 2) === '0,255,255,128')153 assert(getRGBA(img.data, 2) === '0,255,255,128')154}155 156{157 const img = new ImageData(1, 1)158 const keys = Object.getOwnPropertyNames(img)159 160 assert(keys.length === 1)161 assert(keys.includes('data'))162}163 164{165 const img = new ImageData(1, 1)166 const keys = Object.keys(img)167 168 assert(keys.length === 1)169 assert(keys.includes('data'))170}171 172{173 const img = new ImageData(1, 1)174 const keys = []175 176 for (const key in img) keys.push(key)177 178 assert(keys.length === 3)179 assert(keys.includes('data'))180 assert(keys.includes('data'))181 assert(keys.includes('data'))182}183 184{185 const img = new ImageData(12, 16)186 const arr1 = img.data187 const arr2 = new Uint8ClampedArray(768)188 189 if (isStrict) {190 assertThrows(() => { img.width = 20 }, err => err.name === 'TypeError')191 assertThrows(() => { img.height = 20 }, err => err.name === 'TypeError')192 assertThrows(() => { img.data = arr2 }, err => err.name === 'TypeError')193 } else {194 img.width = 20195 img.height = 20196 img.data = arr2197 }198 199 assert(img.width === 12)200 assert(img.height === 16)201 assert(img.data === arr1)202}203 