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/*!2 Copyright 2013 Lovell Fuller and others.3 SPDX-License-Identifier: Apache-2.04*/5 6const { spawnSync } = require('node:child_process');7const { createHash } = require('node:crypto');8const semver = require('semver');9const detectLibc = require('detect-libc');10const pkg = require('../package.json');11 12/* node:coverage ignore next */13const minimumLibvipsVersionLabelled = process.env.npm_package_config_libvips || pkg.config.libvips;14const minimumLibvipsVersion = semver.coerce(minimumLibvipsVersionLabelled).version;15 16const prebuiltPlatforms = [17 'darwin-arm64', 'darwin-x64',18 'freebsd-arm64', 'freebsd-x64',19 'linux-arm', 'linux-arm64', 'linux-ppc64', 'linux-riscv64', 'linux-s390x', 'linux-wasm32', 'linux-x64',20 'linuxmusl-arm64', 'linuxmusl-x64',21 'win32-arm64', 'win32-ia32', 'win32-x64'22];23 24const spawnSyncOptions = {25 encoding: 'utf8',26 shell: true27};28 29const log = (item) => {30 if (item instanceof Error) {31 console.error(`sharp: Installation error: ${item.message}`);32 } else {33 console.log(`sharp: ${item}`);34 }35};36 37/* node:coverage disable */38 39const runtimeLibc = () => detectLibc.isNonGlibcLinuxSync() ? detectLibc.familySync() : '';40 41const runtimePlatformArch = () => `${process.platform}${runtimeLibc()}-${process.arch}`;42 43const buildPlatformArch = () => {44 if (isEmscripten()) {45 return 'wasm32';46 }47 const { npm_config_arch, npm_config_platform, npm_config_libc } = process.env;48 const libc = typeof npm_config_libc === 'string' ? npm_config_libc : runtimeLibc();49 return `${npm_config_platform || process.platform}${libc}-${npm_config_arch || process.arch}`;50};51 52const buildSharpLibvipsIncludeDir = () => {53 try {54 return require(`@img/sharp-libvips-dev-${buildPlatformArch()}/include`);55 } catch {56 try {57 return require('@img/sharp-libvips-dev/include');58 } catch {}59 }60 return '';61};62 63const buildSharpLibvipsCPlusPlusDir = () => {64 try {65 return require('@img/sharp-libvips-dev/cplusplus');66 } catch {}67 return '';68};69 70const buildSharpLibvipsLibDir = () => {71 try {72 return require(`@img/sharp-libvips-dev-${buildPlatformArch()}/lib`);73 } catch {74 try {75 return require(`@img/sharp-libvips-${buildPlatformArch()}/lib`);76 } catch {}77 }78 return '';79};80 81const isUnsupportedNodeRuntime = () => {82 if (process.release?.name === 'node' && process.versions) {83 if (!semver.satisfies(process.versions.node, pkg.engines.node)) {84 return { found: process.versions.node, expected: pkg.engines.node };85 }86 }87};88 89const isEmscripten = () => {90 const { CC } = process.env;91 return Boolean(CC?.endsWith('/emcc'));92};93 94const isRosetta = () => {95 if (process.platform === 'darwin' && process.arch === 'x64') {96 const translated = spawnSync('sysctl sysctl.proc_translated', spawnSyncOptions).stdout;97 return (translated || '').trim() === 'sysctl.proc_translated: 1';98 }99 return false;100};101 102/* node:coverage enable */103 104const sha512 = (s) => createHash('sha512').update(s).digest('hex');105 106const yarnLocator = () => {107 try {108 const identHash = sha512(`imgsharp-libvips-${buildPlatformArch()}`);109 const npmVersion = semver.coerce(pkg.optionalDependencies[`@img/sharp-libvips-${buildPlatformArch()}`], {110 includePrerelease: true111 }).version;112 return sha512(`${identHash}npm:${npmVersion}`).slice(0, 10);113 } catch {}114 return '';115};116 117/* node:coverage disable */118 119const spawnRebuild = () =>120 spawnSync(`node-gyp rebuild --directory=src ${isEmscripten() ? '--nodedir=emscripten' : ''}`, {121 ...spawnSyncOptions,122 stdio: 'inherit'123 }).status;124 125const globalLibvipsVersion = () => {126 if (process.platform !== 'win32') {127 const globalLibvipsVersion = spawnSync('pkg-config --modversion vips-cpp', {128 ...spawnSyncOptions,129 env: {130 ...process.env,131 PKG_CONFIG_PATH: pkgConfigPath()132 }133 }).stdout;134 return (globalLibvipsVersion || '').trim();135 } else {136 return '';137 }138};139 140const getBrewPkgConfigPath = () => {141 try {142 const brewPrefix = (spawnSync('brew', ['--prefix'], { encoding: 'utf8' }).stdout || '').trim();143 if (brewPrefix) {144 return `${brewPrefix}/lib/pkgconfig`;145 }146 } catch (_err) {}147 return undefined;148};149 150const getPkgConfigPath = () => {151 try {152 const pkgConfigPath = (spawnSync('pkg-config', ['--variable', 'pc_path', 'pkg-config'], { encoding: 'utf8' }).stdout || '').trim();153 if (pkgConfigPath) {154 return pkgConfigPath;155 }156 } catch (_err) {}157 return undefined;158};159 160/* node:coverage enable */161 162const pkgConfigPath = () => {163 if (process.platform !== 'win32') {164 return [165 getBrewPkgConfigPath(),166 getPkgConfigPath(),167 process.env.PKG_CONFIG_PATH168 ].filter(Boolean).join(':');169 } else {170 return '';171 }172};173 174const skipSearch = (status, reason, logger) => {175 if (logger) {176 logger(`Detected ${reason}, skipping search for globally-installed libvips`);177 }178 return status;179};180 181const useGlobalLibvips = (logger) => {182 if (Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) === true) {183 return skipSearch(false, 'SHARP_IGNORE_GLOBAL_LIBVIPS', logger);184 }185 if (Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS) === true) {186 return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS', logger);187 }188 /* node:coverage ignore next 3 */189 if (isRosetta()) {190 return skipSearch(false, 'Rosetta', logger);191 }192 const globalVipsVersion = globalLibvipsVersion();193 /* node:coverage ignore next */194 return !!globalVipsVersion && semver.gte(globalVipsVersion, minimumLibvipsVersion);195};196 197module.exports = {198 minimumLibvipsVersion,199 prebuiltPlatforms,200 buildPlatformArch,201 buildSharpLibvipsIncludeDir,202 buildSharpLibvipsCPlusPlusDir,203 buildSharpLibvipsLibDir,204 isUnsupportedNodeRuntime,205 runtimePlatformArch,206 log,207 yarnLocator,208 spawnRebuild,209 globalLibvipsVersion,210 pkgConfigPath,211 useGlobalLibvips212};213 