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
tweened.js306 linesDownload Raw Back to motion
1/** @import { Task } from '../internal/client/types' */2/** @import { Tweened, TweenOptions } from './public' */3import { writable } from '../store/shared/index.js';4import { raf } from '../internal/client/timing.js';5import { loop } from '../internal/client/loop.js';6import { linear } from '../easing/index.js';7import { is_date } from './utils.js';8import { set, state } from '../internal/client/reactivity/sources.js';9import { tag } from '../internal/client/dev/tracing.js';10import { get, render_effect } from 'svelte/internal/client';11import { DEV } from 'esm-env';12 13/**14 * @template T15 * @param {T} a16 * @param {T} b17 * @returns {(t: number) => T}18 */19function get_interpolator(a, b) {20	if (a === b || a !== a) return () => a;21 22	const type = typeof a;23	if (type !== typeof b || Array.isArray(a) !== Array.isArray(b)) {24		throw new Error('Cannot interpolate values of different type');25	}26 27	if (Array.isArray(a)) {28		const arr = /** @type {Array<any>} */ (b).map((bi, i) => {29			return get_interpolator(/** @type {Array<any>} */ (a)[i], bi);30		});31 32		// @ts-ignore33		return (t) => arr.map((fn) => fn(t));34	}35 36	if (type === 'object') {37		if (!a || !b) {38			throw new Error('Object cannot be null');39		}40 41		if (is_date(a) && is_date(b)) {42			const an = a.getTime();43			const bn = b.getTime();44			const delta = bn - an;45 46			// @ts-ignore47			return (t) => new Date(an + t * delta);48		}49 50		const keys = Object.keys(b);51 52		/** @type {Record<string, (t: number) => T>} */53		const interpolators = {};54		keys.forEach((key) => {55			// @ts-ignore56			interpolators[key] = get_interpolator(a[key], b[key]);57		});58 59		// @ts-ignore60		return (t) => {61			/** @type {Record<string, any>} */62			const result = {};63			keys.forEach((key) => {64				result[key] = interpolators[key](t);65			});66			return result;67		};68	}69 70	if (type === 'number') {71		const delta = /** @type {number} */ (b) - /** @type {number} */ (a);72		// @ts-ignore73		return (t) => a + t * delta;74	}75 76	// for non-numeric values, snap to the final value immediately77	return () => b;78}79 80/**81 * A tweened store in Svelte is a special type of store that provides smooth transitions between state values over time.82 *83 * @deprecated Use [`Tween`](https://svelte.dev/docs/svelte/svelte-motion#Tween) instead84 * @template T85 * @param {T} [value]86 * @param {TweenOptions<T>} [defaults]87 * @returns {Tweened<T>}88 */89export function tweened(value, defaults = {}) {90	const store = writable(value);91	/** @type {Task} */92	let task;93	let target_value = value;94	/**95	 * @param {T} new_value96	 * @param {TweenOptions<T>} [opts]97	 */98	function set(new_value, opts) {99		target_value = new_value;100 101		if (value == null) {102			store.set((value = new_value));103			return Promise.resolve();104		}105 106		/** @type {Task | null} */107		let previous_task = task;108 109		let started = false;110		let {111			delay = 0,112			duration = 400,113			easing = linear,114			interpolate = get_interpolator115		} = { ...defaults, ...opts };116 117		if (duration === 0) {118			if (previous_task) {119				previous_task.abort();120				previous_task = null;121			}122			store.set((value = target_value));123			return Promise.resolve();124		}125 126		const start = raf.now() + delay;127 128		/** @type {(t: number) => T} */129		let fn;130		task = loop((now) => {131			if (now < start) return true;132			if (!started) {133				fn = interpolate(/** @type {any} */ (value), new_value);134				if (typeof duration === 'function')135					duration = duration(/** @type {any} */ (value), new_value);136				started = true;137			}138			if (previous_task) {139				previous_task.abort();140				previous_task = null;141			}142			const elapsed = now - start;143			if (elapsed > /** @type {number} */ (duration)) {144				store.set((value = new_value));145				return false;146			}147			// @ts-ignore148			store.set((value = fn(easing(elapsed / duration))));149			return true;150		});151		return task.promise;152	}153	return {154		set,155		update: (fn, opts) =>156			set(fn(/** @type {any} */ (target_value), /** @type {any} */ (value)), opts),157		subscribe: store.subscribe158	};159}160 161/**162 * A wrapper for a value that tweens smoothly to its target value. Changes to `tween.target` will cause `tween.current` to163 * move towards it over time, taking account of the `delay`, `duration` and `easing` options.164 *165 * ```svelte166 * <script>167 * 	import { Tween } from 'svelte/motion';168 *169 * 	const tween = new Tween(0);170 * </script>171 *172 * <input type="range" bind:value={tween.target} />173 * <input type="range" bind:value={tween.current} disabled />174 * ```175 * @template T176 * @since 5.8.0177 */178export class Tween {179	#current;180	#target;181 182	/** @type {TweenOptions<T>} */183	#defaults;184 185	/** @type {import('../internal/client/types').Task | null} */186	#task = null;187 188	/**189	 * @param {T} value190	 * @param {TweenOptions<T>} options191	 */192	constructor(value, options = {}) {193		this.#current = state(value);194		this.#target = state(value);195		this.#defaults = options;196 197		if (DEV) {198			tag(this.#current, 'Tween.current');199			tag(this.#target, 'Tween.target');200		}201	}202 203	/**204	 * Create a tween whose value is bound to the return value of `fn`. This must be called205	 * inside an effect root (for example, during component initialisation).206	 *207	 * ```svelte208	 * <script>209	 * 	import { Tween } from 'svelte/motion';210	 *211	 * 	let { number } = $props();212	 *213	 * 	const tween = Tween.of(() => number);214	 * </script>215	 * ```216	 * @template U217	 * @param {() => U} fn218	 * @param {TweenOptions<U>} [options]219	 */220	static of(fn, options) {221		const tween = new Tween(fn(), options);222 223		render_effect(() => {224			tween.set(fn());225		});226 227		return tween;228	}229 230	/**231	 * Sets `tween.target` to `value` and returns a `Promise` that resolves if and when `tween.current` catches up to it.232	 *233	 * If `options` are provided, they will override the tween's defaults.234	 * @param {T} value235	 * @param {TweenOptions<T>} [options]236	 * @returns237	 */238	set(value, options) {239		set(this.#target, value);240 241		let {242			delay = 0,243			duration = 400,244			easing = linear,245			interpolate = get_interpolator246		} = { ...this.#defaults, ...options };247 248		if (duration === 0) {249			this.#task?.abort();250			set(this.#current, value);251			return Promise.resolve();252		}253 254		const start = raf.now() + delay;255 256		/** @type {(t: number) => T} */257		let fn;258		let started = false;259		let previous_task = this.#task;260 261		this.#task = loop((now) => {262			if (now < start) {263				return true;264			}265 266			if (!started) {267				started = true;268 269				const prev = this.#current.v;270 271				fn = interpolate(prev, value);272 273				if (typeof duration === 'function') {274					duration = duration(prev, value);275				}276 277				previous_task?.abort();278			}279 280			const elapsed = now - start;281 282			if (elapsed > /** @type {number} */ (duration)) {283				set(this.#current, value);284				return false;285			}286 287			set(this.#current, fn(easing(elapsed / /** @type {number} */ (duration))));288			return true;289		});290 291		return this.#task.promise;292	}293 294	get current() {295		return get(this.#current);296	}297 298	get target() {299		return get(this.#target);300	}301 302	set target(v) {303		this.set(v);304	}305}306 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai