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/** @import { Source } from '#client' */2import { DEV } from 'esm-env';3import { set, source, state, increment } from '../internal/client/reactivity/sources.js';4import { label, tag } from '../internal/client/dev/tracing.js';5import { get, update_version } from '../internal/client/runtime.js';6 7/**8 * A reactive version of the built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object.9 * Reading contents of the map (by iterating, or by reading `map.size` or calling `map.get(...)` or `map.has(...)` as in the [tic-tac-toe example](https://svelte.dev/playground/0b0ff4aa49c9443f9b47fe5203c78293) below) in an [effect](https://svelte.dev/docs/svelte/$effect) or [derived](https://svelte.dev/docs/svelte/$derived)10 * will cause it to be re-evaluated as necessary when the map is updated.11 *12 * Note that values in a reactive map are _not_ made [deeply reactive](https://svelte.dev/docs/svelte/$state#Deep-state).13 *14 * ```svelte15 * <script>16 * import { SvelteMap } from 'svelte/reactivity';17 * import { result } from './game.js';18 *19 * let board = new SvelteMap();20 * let player = $state('x');21 * let winner = $derived(result(board));22 *23 * function reset() {24 * player = 'x';25 * board.clear();26 * }27 * </script>28 *29 * <div class="board">30 * {#each Array(9), i}31 * <button32 * disabled={board.has(i) || winner}33 * onclick={() => {34 * board.set(i, player);35 * player = player === 'x' ? 'o' : 'x';36 * }}37 * >{board.get(i)}</button>38 * {/each}39 * </div>40 *41 * {#if winner}42 * <p>{winner} wins!</p>43 * <button onclick={reset}>reset</button>44 * {:else}45 * <p>{player} is next</p>46 * {/if}47 * ```48 *49 * @template K50 * @template V51 * @extends {Map<K, V>}52 */53export class SvelteMap extends Map {54 /** @type {Map<K, Source<number>>} */55 #sources = new Map();56 #version = state(0);57 #size = state(0);58 #update_version = update_version || -1;59 60 /**61 * @param {Iterable<readonly [K, V]> | null | undefined} [value]62 */63 constructor(value) {64 super();65 66 if (DEV) {67 // If the value is invalid then the native exception will fire here68 value = new Map(value);69 70 tag(this.#version, 'SvelteMap version');71 tag(this.#size, 'SvelteMap.size');72 }73 74 if (value) {75 for (var [key, v] of value) {76 super.set(key, v);77 }78 this.#size.v = super.size;79 }80 }81 82 /**83 * If the source is being created inside the same reaction as the SvelteMap instance,84 * we use `state` so that it will not be a dependency of the reaction. Otherwise we85 * use `source` so it will be.86 *87 * @template T88 * @param {T} value89 * @returns {Source<T>}90 */91 #source(value) {92 return update_version === this.#update_version ? state(value) : source(value);93 }94 95 /** @param {K} key */96 has(key) {97 var sources = this.#sources;98 var s = sources.get(key);99 100 if (s === undefined) {101 if (super.has(key)) {102 s = this.#source(0);103 104 if (DEV) {105 tag(s, `SvelteMap get(${label(key)})`);106 }107 108 sources.set(key, s);109 } else {110 // We should always track the version in case111 // the Set ever gets this value in the future.112 get(this.#version);113 return false;114 }115 }116 117 get(s);118 return true;119 }120 121 /**122 * @param {(value: V, key: K, map: Map<K, V>) => void} callbackfn123 * @param {any} [this_arg]124 */125 forEach(callbackfn, this_arg) {126 this.#read_all();127 super.forEach(callbackfn, this_arg);128 }129 130 /** @param {K} key */131 get(key) {132 var sources = this.#sources;133 var s = sources.get(key);134 135 if (s === undefined) {136 if (super.has(key)) {137 s = this.#source(0);138 139 if (DEV) {140 tag(s, `SvelteMap get(${label(key)})`);141 }142 143 sources.set(key, s);144 } else {145 // We should always track the version in case146 // the Set ever gets this value in the future.147 get(this.#version);148 return undefined;149 }150 }151 152 get(s);153 return super.get(key);154 }155 156 /**157 * @param {K} key158 * @param {V} value159 * */160 set(key, value) {161 var sources = this.#sources;162 var s = sources.get(key);163 var prev_res = super.get(key);164 var res = super.set(key, value);165 var version = this.#version;166 167 if (s === undefined) {168 s = this.#source(0);169 170 if (DEV) {171 tag(s, `SvelteMap get(${label(key)})`);172 }173 174 sources.set(key, s);175 set(this.#size, super.size);176 increment(version);177 } else if (prev_res !== value) {178 increment(s);179 180 // if not every reaction of s is a reaction of version we need to also include version181 var v_reactions = version.reactions === null ? null : new Set(version.reactions);182 var needs_version_increase =183 v_reactions === null ||184 !s.reactions?.every((r) =>185 /** @type {NonNullable<typeof v_reactions>} */ (v_reactions).has(r)186 );187 if (needs_version_increase) {188 increment(version);189 }190 }191 192 return res;193 }194 195 /** @param {K} key */196 delete(key) {197 var sources = this.#sources;198 var s = sources.get(key);199 var res = super.delete(key);200 201 if (s !== undefined) {202 sources.delete(key);203 set(s, -1);204 }205 206 if (res) {207 set(this.#size, super.size);208 increment(this.#version);209 }210 211 return res;212 }213 214 clear() {215 if (super.size === 0) {216 return;217 }218 // Clear first, so we get nice console.log outputs with $inspect219 super.clear();220 var sources = this.#sources;221 set(this.#size, 0);222 for (var s of sources.values()) {223 set(s, -1);224 }225 increment(this.#version);226 sources.clear();227 }228 229 #read_all() {230 get(this.#version);231 232 var sources = this.#sources;233 if (this.#size.v !== sources.size) {234 for (var key of super.keys()) {235 if (!sources.has(key)) {236 var s = this.#source(0);237 if (DEV) {238 tag(s, `SvelteMap get(${label(key)})`);239 }240 241 sources.set(key, s);242 }243 }244 }245 246 for ([, s] of this.#sources) {247 get(s);248 }249 }250 251 keys() {252 get(this.#version);253 return super.keys();254 }255 256 values() {257 this.#read_all();258 return super.values();259 }260 261 entries() {262 this.#read_all();263 return super.entries();264 }265 266 [Symbol.iterator]() {267 return this.entries();268 }269 270 get size() {271 get(this.#size);272 return super.size;273 }274}275 