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 is = require('./is.cjs');7 8/**9 * Boolean operations for bandbool.10 * @private11 */12const bool = {13 and: 'and',14 or: 'or',15 eor: 'eor'16};17 18/**19 * Remove alpha channels, if any. This is a no-op if the image does not have an alpha channel.20 *21 * See also {@link /api-operation/#flatten flatten}.22 *23 * @example24 * sharp('rgba.png')25 * .removeAlpha()26 * .toFile('rgb.png', function(err, info) {27 * // rgb.png is a 3 channel image without an alpha channel28 * });29 *30 * @returns {Sharp}31 */32function removeAlpha () {33 this.options.removeAlpha = true;34 return this;35}36 37/**38 * Ensure the output image has an alpha transparency channel.39 * If missing, the added alpha channel will have the specified40 * transparency level, defaulting to fully-opaque (1).41 * This is a no-op if the image already has an alpha channel.42 *43 * @since 0.21.244 *45 * @example46 * // rgba.png will be a 4 channel image with a fully-opaque alpha channel47 * await sharp('rgb.jpg')48 * .ensureAlpha()49 * .toFile('rgba.png')50 *51 * @example52 * // rgba is a 4 channel image with a fully-transparent alpha channel53 * const rgba = await sharp(rgb)54 * .ensureAlpha(0)55 * .toBuffer();56 *57 * @param {number} [alpha=1] - alpha transparency level (0=fully-transparent, 1=fully-opaque)58 * @returns {Sharp}59 * @throws {Error} Invalid alpha transparency level60 */61function ensureAlpha (alpha) {62 if (is.defined(alpha)) {63 if (is.number(alpha) && is.inRange(alpha, 0, 1)) {64 this.options.ensureAlpha = alpha;65 } else {66 throw is.invalidParameterError('alpha', 'number between 0 and 1', alpha);67 }68 } else {69 this.options.ensureAlpha = 1;70 }71 return this;72}73 74/**75 * Extract a single channel from a multi-channel image.76 *77 * The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).78 *79 * @example80 * // green.jpg is a greyscale image containing the green channel of the input81 * await sharp(input)82 * .extractChannel('green')83 * .toFile('green.jpg');84 *85 * @example86 * // red1 is the red value of the first pixel, red2 the second pixel etc.87 * const [red1, red2, ...] = await sharp(input)88 * .extractChannel(0)89 * .raw()90 * .toBuffer();91 *92 * @param {number|string} channel - zero-indexed channel/band number to extract, or `red`, `green`, `blue` or `alpha`.93 * @returns {Sharp}94 * @throws {Error} Invalid channel95 */96function extractChannel (channel) {97 const channelMap = { red: 0, green: 1, blue: 2, alpha: 3 };98 if (Object.keys(channelMap).includes(channel)) {99 channel = channelMap[channel];100 }101 if (is.integer(channel) && is.inRange(channel, 0, 4)) {102 this.options.extractChannel = channel;103 } else {104 throw is.invalidParameterError('channel', 'integer or one of: red, green, blue, alpha', channel);105 }106 return this;107}108 109/**110 * Join one or more channels to the image.111 * The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.112 * By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.113 * Channel ordering follows vips convention:114 * - sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.115 * - CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.116 *117 * Buffers may be any of the image formats supported by sharp.118 * For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.119 *120 * @param {Array<string|Buffer>|string|Buffer} images - one or more images (file paths, Buffers).121 * @param {Object} options - image options, see `sharp()` constructor.122 * @returns {Sharp}123 * @throws {Error} Invalid parameters124 */125function joinChannel (images, options) {126 if (Array.isArray(images)) {127 images.forEach(function (image) {128 this.options.joinChannelIn.push(this._createInputDescriptor(image, options));129 }, this);130 } else {131 this.options.joinChannelIn.push(this._createInputDescriptor(images, options));132 }133 return this;134}135 136/**137 * Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.138 *139 * @example140 * sharp('3-channel-rgb-input.png')141 * .bandbool(sharp.bool.and)142 * .toFile('1-channel-output.png', function (err, info) {143 * // The output will be a single channel image where each pixel `P = R & G & B`.144 * // If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`145 * // then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.146 * });147 *148 * @param {string} boolOp - one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.149 * @returns {Sharp}150 * @throws {Error} Invalid parameters151 */152function bandbool (boolOp) {153 if (is.string(boolOp) && is.inArray(boolOp, ['and', 'or', 'eor'])) {154 this.options.bandBoolOp = boolOp;155 } else {156 throw is.invalidParameterError('boolOp', 'one of: and, or, eor', boolOp);157 }158 return this;159}160 161/**162 * Decorate the Sharp prototype with channel-related functions.163 * @module Sharp164 * @private165 */166module.exports = (Sharp) => {167 Object.assign(Sharp.prototype, {168 // Public instance functions169 removeAlpha,170 ensureAlpha,171 extractChannel,172 joinChannel,173 bandbool174 });175 // Class attributes176 Sharp.bool = bool;177};178 