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
resource.svelte.js144 linesDownload Raw Back to resource
1import { watch } from "../watch/index.js";2// Helper functions for debounce and throttle3// eslint-disable-next-line @typescript-eslint/no-explicit-any4function debounce(fn, delay) {5    let timeoutId;6    let lastResolve = null;7    return (...args) => {8        return new Promise((resolve) => {9            if (lastResolve) {10                lastResolve(undefined);11            }12            lastResolve = resolve;13            clearTimeout(timeoutId);14            timeoutId = setTimeout(async () => {15                const result = await fn(...args);16                if (lastResolve) {17                    lastResolve(result);18                    lastResolve = null;19                }20            }, delay);21        });22    };23}24// eslint-disable-next-line @typescript-eslint/no-explicit-any25function throttle(fn, delay) {26    let lastRun = 0;27    let lastPromise = null;28    return (...args) => {29        const now = Date.now();30        if (lastRun && now - lastRun < delay) {31            return lastPromise ?? Promise.resolve(undefined);32        }33        lastRun = now;34        lastPromise = fn(...args);35        return lastPromise;36    };37}38function runResource(source, fetcher, options = {}, effectFn) {39    const { lazy = false, once = false, initialValue, debounce: debounceTime, throttle: throttleTime, } = options;40    // Create state41    let current = $state(initialValue);42    let loading = $state(false);43    let error = $state(undefined);44    let cleanupFns = $state([]);45    // Helper function to run cleanup functions46    const runCleanup = () => {47        cleanupFns.forEach((fn) => fn());48        cleanupFns = [];49    };50    // Helper function to register cleanup51    const onCleanup = (fn) => {52        cleanupFns = [...cleanupFns, fn];53    };54    // Create the base fetcher function55    const baseFetcher = async (value, previousValue, refetching = false) => {56        try {57            loading = true;58            error = undefined;59            runCleanup();60            // Create new AbortController for this fetch61            const controller = new AbortController();62            onCleanup(() => controller.abort());63            // eslint-disable-next-line @typescript-eslint/no-explicit-any64            const result = await fetcher(value, previousValue, {65                data: current,66                refetching,67                onCleanup,68                signal: controller.signal,69            });70            current = result;71            return result;72        }73        catch (e) {74            if (!(e instanceof DOMException && e.name === "AbortError")) {75                error = e;76            }77            return undefined;78        }79        finally {80            loading = false;81        }82    };83    // Apply debounce or throttle if specified84    const runFetcher = debounceTime85        ? debounce(baseFetcher, debounceTime)86        : throttleTime87            ? throttle(baseFetcher, throttleTime)88            : baseFetcher;89    // Setup effect90    const sources = Array.isArray(source) ? source : [source];91    let prevValues;92    effectFn((values, previousValues) => {93        // Skip if once and already ran94        if (once && prevValues) {95            return;96        }97        // Skip if values haven't changed98        if (prevValues && JSON.stringify(values) === JSON.stringify(prevValues)) {99            return;100        }101        prevValues = values;102        runFetcher(Array.isArray(source) ? values : values[0], Array.isArray(source) ? previousValues : previousValues?.[0]);103    }, { lazy });104    return {105        get current() {106            return current;107        },108        get loading() {109            return loading;110        },111        get error() {112            return error;113        },114        mutate: (value) => {115            current = value;116        },117        refetch: (info) => {118            const values = sources.map((s) => s());119            return runFetcher(Array.isArray(source) ? values : values[0], Array.isArray(source) ? values : values[0], info ?? true);120        },121    };122}123// Implementation124export function resource(source, fetcher, options) {125    return runResource(source, fetcher, options, (fn, options) => {126        const sources = Array.isArray(source) ? source : [source];127        const getters = () => sources.map((s) => s());128        watch(getters, (values, previousValues) => {129            fn(values, previousValues ?? []);130        }, options);131    });132}133// Implementation134export function resourcePre(source, fetcher, options) {135    return runResource(source, fetcher, options, (fn, options) => {136        const sources = Array.isArray(source) ? source : [source];137        const getter = () => sources.map((s) => s());138        watch.pre(getter, (values, previousValues) => {139            fn(values, previousValues ?? []);140        }, options);141    });142}143resource.pre = resourcePre;144 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai