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'use strict'2 3const debug = require('../internal/debug')4const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')5const { safeRe: re, t } = require('../internal/re')6 7const parseOptions = require('../internal/parse-options')8const { compareIdentifiers } = require('../internal/identifiers')9 10const isPrereleaseIdentifier = (prerelease, identifier) => {11 const identifiers = identifier.split('.')12 if (identifiers.length > prerelease.length) {13 return false14 }15 16 for (let i = 0; i < identifiers.length; i++) {17 if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {18 return false19 }20 }21 22 return true23}24 25class SemVer {26 constructor (version, options) {27 options = parseOptions(options)28 29 if (version instanceof SemVer) {30 if (version.loose === !!options.loose &&31 version.includePrerelease === !!options.includePrerelease) {32 return version33 } else {34 version = version.version35 }36 } else if (typeof version !== 'string') {37 throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)38 }39 40 if (version.length > MAX_LENGTH) {41 throw new TypeError(42 `version is longer than ${MAX_LENGTH} characters`43 )44 }45 46 debug('SemVer', version, options)47 this.options = options48 this.loose = !!options.loose49 // this isn't actually relevant for versions, but keep it so that we50 // don't run into trouble passing this.options around.51 this.includePrerelease = !!options.includePrerelease52 53 const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])54 55 if (!m) {56 throw new TypeError(`Invalid Version: ${version}`)57 }58 59 this.raw = version60 61 // these are actually numbers62 this.major = +m[1]63 this.minor = +m[2]64 this.patch = +m[3]65 66 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {67 throw new TypeError('Invalid major version')68 }69 70 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {71 throw new TypeError('Invalid minor version')72 }73 74 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {75 throw new TypeError('Invalid patch version')76 }77 78 // numberify any prerelease numeric ids79 if (!m[4]) {80 this.prerelease = []81 } else {82 this.prerelease = m[4].split('.').map((id) => {83 if (/^[0-9]+$/.test(id)) {84 const num = +id85 if (num >= 0 && num < MAX_SAFE_INTEGER) {86 return num87 }88 }89 return id90 })91 }92 93 this.build = m[5] ? m[5].split('.') : []94 this.format()95 }96 97 format () {98 this.version = `${this.major}.${this.minor}.${this.patch}`99 if (this.prerelease.length) {100 this.version += `-${this.prerelease.join('.')}`101 }102 return this.version103 }104 105 toString () {106 return this.version107 }108 109 compare (other) {110 debug('SemVer.compare', this.version, this.options, other)111 if (!(other instanceof SemVer)) {112 if (typeof other === 'string' && other === this.version) {113 return 0114 }115 other = new SemVer(other, this.options)116 }117 118 if (other.version === this.version) {119 return 0120 }121 122 return this.compareMain(other) || this.comparePre(other)123 }124 125 compareMain (other) {126 if (!(other instanceof SemVer)) {127 other = new SemVer(other, this.options)128 }129 130 if (this.major < other.major) {131 return -1132 }133 if (this.major > other.major) {134 return 1135 }136 if (this.minor < other.minor) {137 return -1138 }139 if (this.minor > other.minor) {140 return 1141 }142 if (this.patch < other.patch) {143 return -1144 }145 if (this.patch > other.patch) {146 return 1147 }148 return 0149 }150 151 comparePre (other) {152 if (!(other instanceof SemVer)) {153 other = new SemVer(other, this.options)154 }155 156 // NOT having a prerelease is > having one157 if (this.prerelease.length && !other.prerelease.length) {158 return -1159 } else if (!this.prerelease.length && other.prerelease.length) {160 return 1161 } else if (!this.prerelease.length && !other.prerelease.length) {162 return 0163 }164 165 let i = 0166 do {167 const a = this.prerelease[i]168 const b = other.prerelease[i]169 debug('prerelease compare', i, a, b)170 if (a === undefined && b === undefined) {171 return 0172 } else if (b === undefined) {173 return 1174 } else if (a === undefined) {175 return -1176 } else if (a === b) {177 continue178 } else {179 return compareIdentifiers(a, b)180 }181 } while (++i)182 }183 184 compareBuild (other) {185 if (!(other instanceof SemVer)) {186 other = new SemVer(other, this.options)187 }188 189 let i = 0190 do {191 const a = this.build[i]192 const b = other.build[i]193 debug('build compare', i, a, b)194 if (a === undefined && b === undefined) {195 return 0196 } else if (b === undefined) {197 return 1198 } else if (a === undefined) {199 return -1200 } else if (a === b) {201 continue202 } else {203 return compareIdentifiers(a, b)204 }205 } while (++i)206 }207 208 // preminor will bump the version up to the next minor release, and immediately209 // down to pre-release. premajor and prepatch work the same way.210 inc (release, identifier, identifierBase) {211 if (release.startsWith('pre')) {212 if (!identifier && identifierBase === false) {213 throw new Error('invalid increment argument: identifier is empty')214 }215 // Avoid an invalid semver results216 if (identifier) {217 const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])218 if (!match || match[1] !== identifier) {219 throw new Error(`invalid identifier: ${identifier}`)220 }221 }222 }223 224 switch (release) {225 case 'premajor':226 this.prerelease.length = 0227 this.patch = 0228 this.minor = 0229 this.major++230 this.inc('pre', identifier, identifierBase)231 break232 case 'preminor':233 this.prerelease.length = 0234 this.patch = 0235 this.minor++236 this.inc('pre', identifier, identifierBase)237 break238 case 'prepatch':239 // If this is already a prerelease, it will bump to the next version240 // drop any prereleases that might already exist, since they are not241 // relevant at this point.242 this.prerelease.length = 0243 this.inc('patch', identifier, identifierBase)244 this.inc('pre', identifier, identifierBase)245 break246 // If the input is a non-prerelease version, this acts the same as247 // prepatch.248 case 'prerelease':249 if (this.prerelease.length === 0) {250 this.inc('patch', identifier, identifierBase)251 }252 this.inc('pre', identifier, identifierBase)253 break254 case 'release':255 if (this.prerelease.length === 0) {256 throw new Error(`version ${this.raw} is not a prerelease`)257 }258 this.prerelease.length = 0259 break260 261 case 'major':262 // If this is a pre-major version, bump up to the same major version.263 // Otherwise increment major.264 // 1.0.0-5 bumps to 1.0.0265 // 1.1.0 bumps to 2.0.0266 if (267 this.minor !== 0 ||268 this.patch !== 0 ||269 this.prerelease.length === 0270 ) {271 this.major++272 }273 this.minor = 0274 this.patch = 0275 this.prerelease = []276 break277 case 'minor':278 // If this is a pre-minor version, bump up to the same minor version.279 // Otherwise increment minor.280 // 1.2.0-5 bumps to 1.2.0281 // 1.2.1 bumps to 1.3.0282 if (this.patch !== 0 || this.prerelease.length === 0) {283 this.minor++284 }285 this.patch = 0286 this.prerelease = []287 break288 case 'patch':289 // If this is not a pre-release version, it will increment the patch.290 // If it is a pre-release it will bump up to the same patch version.291 // 1.2.0-5 patches to 1.2.0292 // 1.2.0 patches to 1.2.1293 if (this.prerelease.length === 0) {294 this.patch++295 }296 this.prerelease = []297 break298 // This probably shouldn't be used publicly.299 // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.300 case 'pre': {301 const base = Number(identifierBase) ? 1 : 0302 303 if (this.prerelease.length === 0) {304 this.prerelease = [base]305 } else {306 let i = this.prerelease.length307 while (--i >= 0) {308 if (typeof this.prerelease[i] === 'number') {309 this.prerelease[i]++310 i = -2311 }312 }313 if (i === -1) {314 // didn't increment anything315 if (identifier === this.prerelease.join('.') && identifierBase === false) {316 throw new Error('invalid increment argument: identifier already exists')317 }318 this.prerelease.push(base)319 }320 }321 if (identifier) {322 // 1.2.0-beta.1 bumps to 1.2.0-beta.2,323 // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0324 let prerelease = [identifier, base]325 if (identifierBase === false) {326 prerelease = [identifier]327 }328 if (isPrereleaseIdentifier(this.prerelease, identifier)) {329 const prereleaseBase = this.prerelease[identifier.split('.').length]330 if (isNaN(prereleaseBase)) {331 this.prerelease = prerelease332 }333 } else {334 this.prerelease = prerelease335 }336 }337 break338 }339 default:340 throw new Error(`invalid increment argument: ${release}`)341 }342 this.raw = this.format()343 if (this.build.length) {344 this.raw += `+${this.build.join('.')}`345 }346 return this347 }348}349 350module.exports = SemVer351 