Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: automatic batching #104

Merged
merged 13 commits into from
Nov 26, 2023
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ insert_final_newline = true
[{package.json,package-lock.json,manifest.json}]
indent_size = 2

[.babelrc]
indent_size = 2

[*.yml]
indent_size = 2
32 changes: 20 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
},
"ignorePatterns": ["/dist", "/llama", "/docs-site"],
"extends": [
"eslint:recommended"
"eslint:recommended",
"plugin:jsdoc/recommended"
],
"globals": {
"Atomics": "readonly",
Expand All @@ -24,21 +25,31 @@
"files": ["**.ts"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended-typescript"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"import",
"node"
"node",
"jsdoc"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": ["off"],
"@typescript-eslint/ban-ts-comment": ["off"],
"@typescript-eslint/no-explicit-any": ["off"],
"semi": ["off"],
"@typescript-eslint/semi": ["warn", "always"],
"@typescript-eslint/no-inferrable-types": ["off"]
"@typescript-eslint/no-inferrable-types": ["off"],
"jsdoc/require-param": ["off"],
"jsdoc/check-param-names": ["warn", {
"checkDestructured": false
}],
"jsdoc/require-returns": ["off"],
"jsdoc/require-jsdoc": ["off"],
"jsdoc/require-yields": ["off"],
"jsdoc/require-param-description": ["off"]
}
}, {
"files": ["test/**/**.ts"],
Expand All @@ -49,11 +60,15 @@
"plugins": [
"@typescript-eslint",
"import",
"node"
"node",
"jsdoc"
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts"]
},
"jsdoc": {
"exemptDestructuredRootsFromChecks": true
}
},
"rules": {
Expand Down Expand Up @@ -108,13 +123,6 @@
}],
"no-eval": ["error"],
"array-callback-return": ["error"],
"valid-jsdoc": ["error", {
"requireParamType": true,
"requireReturnType": true,
"requireReturn": false,
"requireParamDescription": false,
"requireReturnDescription": false
}],
"no-empty": ["error", {
"allowEmptyCatch": true
}],
Expand Down
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: [giladgd, ido-pluto]
github: giladgd
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ body:
description: >-
Add any other context about the bug report here.
- type: checkboxes
id: drivers
id: features
attributes:
label: Relevant Features Used
options:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ body:
label: Additional Context
description: Add any other context about the feature request here
- type: checkboxes
id: drivers
id: features
attributes:
label: Related Features to This Feature Request
options:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ jobs:

release:
name: Release
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta'
runs-on: ubuntu-latest
concurrency: release-${{ github.ref }}
environment:
Expand Down Expand Up @@ -296,20 +296,20 @@ jobs:
echo "npm-url=https://www.npmjs.com/package/node-llama-cpp/v/$(cat .semanticRelease.npmPackage.deployedVersion.txt)" >> $GITHUB_OUTPUT
fi
- name: Generate docs with updated version
if: steps.set-npm-url.outputs.npm-url != ''
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
env:
DOCS_URL_BASE: "/node-llama-cpp/"
run: |
export DOCS_PACKAGE_VERSION=$(cat .semanticRelease.npmPackage.deployedVersion.txt)
npm run docs:build
- name: Upload docs to GitHub Pages
if: steps.set-npm-url.outputs.npm-url != ''
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v2
with:
name: pages-docs
path: docs-site
- name: Deploy docs to GitHub Pages
if: steps.set-npm-url.outputs.npm-url != ''
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
uses: actions/deploy-pages@v2
with:
artifact_name: pages-docs
3 changes: 2 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"branches": [
"master"
"master",
{"name": "beta", "prerelease": true}
],
"ci": true,
"plugins": [
Expand Down
10 changes: 9 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ export default defineConfig({
}, {
text: "Contributing",
link: "/guide/contributing"
}]
},
...(
packageJson?.funding?.url == null
? []
: [{
text: "Sponsor",
link: packageJson?.funding?.url
}]
)]
}
],
search: {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[![Build](https://github.com/withcatai/node-llama-cpp/actions/workflows/build.yml/badge.svg)](https://github.com/withcatai/node-llama-cpp/actions/workflows/build.yml)
[![License](https://badgen.net/badge/color/MIT/green?label=license)](https://www.npmjs.com/package/node-llama-cpp)
[![License](https://badgen.net/badge/color/TypeScript/blue?label=types)](https://www.npmjs.com/package/node-llama-cpp)
[![Types](https://badgen.net/badge/color/TypeScript/blue?label=types)](https://www.npmjs.com/package/node-llama-cpp)
[![Version](https://badgen.net/npm/v/node-llama-cpp)](https://www.npmjs.com/package/node-llama-cpp)

</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/chat-prompt-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const model = new LlamaModel({
const context = new LlamaContext({model});
const session = new LlamaChatSession({
context,
promptWrapper: new LlamaChatPromptWrapper() // by default, GeneralChatPromptWrapper is used
promptWrapper: new LlamaChatPromptWrapper() // by default, "auto" is used
});


Expand Down
19 changes: 10 additions & 9 deletions llama/.clang-format
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
BasedOnStyle: Google
IndentWidth: 2
IndentWidth: 4
UseTab: Never
TabWidth: 2
ColumnLimit: 500
TabWidth: 4
ColumnLimit: 140
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlignTrailingComments: false
SpaceAfterTemplateKeyword: false
AllowShortBlocksOnASingleLine: true
AllowShortBlocksOnASingleLine: false
MaxEmptyLinesToKeep: 3
NamespaceIndentation: None
CommentPragmas: '^[^ ]'
FixNamespaceComments: false
AccessModifierOffset: -4
IndentAccessModifiers: true
SpaceAfterCStyleCast: false
PointerAlignment: Left
IndentCaseLabels: false
Expand All @@ -31,6 +31,7 @@ UseCRLF: false
AllowAllArgumentsOnNextLine: true
AlignAfterOpenBracket: DontAlign
PackConstructorInitializers: CurrentLine
AlignAfterOpenBracket: BlockIndent
BraceWrapping:
AfterStruct: false
AfterClass: false
Expand All @@ -43,4 +44,4 @@ BraceWrapping:
BeforeElse: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
SplitEmptyNamespace: false
Loading
Loading