Skip to content

Commit

Permalink
docs: improvements (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
giladgd authored Oct 5, 2024
1 parent 4ee10a9 commit 51eab61
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 5 deletions.
1 change: 1 addition & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export default defineConfig({
]
},
themeConfig: {
logo: "/icon.svg",
editLink: {
pattern: "https://github.com/withcatai/node-llama-cpp/edit/master/docs/:path"
},
Expand Down
9 changes: 9 additions & 0 deletions .vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
--vp-c-brand-2: #cc6e3a;
--vp-c-brand-3: #cd8156;
--vp-c-brand-soft: rgb(255 156 100 / 14%);
color-scheme: light;
}

.dark {
--vp-c-brand-1: #ffc7a8;
--vp-c-brand-2: #e78e5c;
--vp-c-brand-3: #dd773e;
--vp-c-brand-soft: rgb(255 156 100 / 16%);
color-scheme: dark;
}

:root {
Expand Down Expand Up @@ -74,6 +76,13 @@
--vp-c-neutral-inverse: rgb(0 0 0 / 60%);
}

.VPNavBarTitle>.title>.logo {
margin-bottom: -2px;
}
.VPNavBar.home .VPNavBarTitle>.title>.logo {
display: none;
}

.VPNavBar:before {
display: block;
position: absolute;
Expand Down
83 changes: 83 additions & 0 deletions assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions assets/icon.v3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/guide/choosing-a-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ npx --no node-llama-cpp inspect estimate <model-file-url>
```
:::

### What do you need this model for? (chat, code completion, analyzing data, classification, etc.)
### What do you need this model for? (chat, code completion, analyzing data, classification, etc.) {#model-purpose}
There are plenty of models with different areas of expertise and capabilities.

When you choose a model that is more specialized in the task you need it for, it will usually perform better than a general model.
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/downloading-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ or the [`resolveModelFile`](../api/functions/resolveModelFile.md) method will au
Alternatively, you can use the token in the [`tokens`](../api/type-aliases/ModelDownloaderOptions.md#tokens) option when using [`createModelDownloader`](../api/functions/createModelDownloader.md) or [`resolveModelFile`](../api/functions/resolveModelFile.md).

## Inspecting Remote Models
You can inspect the metadata of a remote model without downloading it by either using the [`inspect gguf` command](../cli/inspect/gguf.md) with a URL,
You can inspect the metadata of a remote model without downloading it by either using the [`inspect gguf`](../cli/inspect/gguf.md) command with a URL,
or using the [`readGgufFileInfo`](../api/functions/readGgufFileInfo.md) method with a URL:
```typescript
import {readGgufFileInfo} from "node-llama-cpp";
Expand All @@ -140,7 +140,7 @@ const modelMetadata = await readGgufFileInfo("<model url>");
It's handy to check the compatibility of a remote model with your current machine hardware before downloading it,
so you won't waste time downloading a model that won't work on your machine.

You can do so using the [`inspect estimate` command](../cli/inspect/estimate.md) with a URL:
You can do so using the [`inspect estimate`](../cli/inspect/estimate.md) command with a URL:
```shell
npx --no node-llama-cpp inspect estimate <model-url>
```
Expand Down
2 changes: 2 additions & 0 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ We recommend getting a GGUF model from either [Michael Radermacher on Hugging Fa

We recommend starting by getting a small model that doesn't have a lot of parameters just to ensure everything works, so try downloading a `7B`/`8B` parameters model first (search for models with both `7B`/`8B` and `GGUF` in their name).

To ensure you can chat with the model, make sure you [choose an Instruct model](./choosing-a-model.md#model-purpose) by looking for `Instruct` or `it` in the model name.

For improved download speeds, you can use the [`pull`](../cli/pull.md) command to download a model:
```shell
npx --no node-llama-cpp pull --dir ./models <model-file-url>
Expand Down
5 changes: 5 additions & 0 deletions docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,8 @@ const context = await model.createContext({
If you found that the memory estimation is indeed inaccurate,
please [open a new issue on GitHub](https://github.com/withcatai/node-llama-cpp/issues/new/choose) with a link to the model you're using and the output of the [`inspect measure`](../cli/inspect/measure.md) command.

## Getting an `The specified module could not be found \\?\C:\Users\Administrator\AppData\Roaming\npm\node_modules` Error on a Windows Machine
The common cause for this issue is when using the `Administrator` to run `npm install` and then trying to run the code with a different user.

Ensure you're not using the `Administrator` user for `npm install` nor to run the code.
9 changes: 9 additions & 0 deletions docs/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/modelDependent/codegemma/parallel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ describe("CodeGemma", () => {
});

const resPromise = completion.generateCompletion("const singleLineArrayFromOneToHundred = [1, 2, 3, ", {
maxTokens: 40
maxTokens: 20
});
const resPromise2 = completion2.generateCompletion("const singleLineArrayFromOneToHundred = [100, 99, 98, 97, 96, ", {
maxTokens: 40
maxTokens: 20
});

const [
Expand Down

0 comments on commit 51eab61

Please sign in to comment.