Replaced `BatchedExecutor.Prompt(string)` method with `BatchedExecutor.Create()` method. This improves the API in two ways:
- A conversation can be created, without immediately prompting it
- Other prompting overloads (e.g. prompt with token list) can be used without duplicating all the overloads onto `BatchedExecutor`
Added `BatchSize` property to `LLamaContext`
- Modified library loading to be based on `SetDllImportResolver`. This replaces the built in loading system and ensures there can't be two libraries loaded at once.
- llava and llama are loaded separately, as needed.
- All the previous loading logic is still used, within the `SetDllImportResolver`
- Split out CUDA, AVX and MacOS paths to separate helper methods.
- `Description` now specifies if it is for `llama` or `llava`
- Update Microsoft.KernelMemory.Core to version 0.34.240313.1
- Update Microsoft.SemanticKernel to version 1.6.2
- Update Microsoft.SemanticKernel.Plugins.Memory to version 1.6.2-alpha
- Update Microsoft.KernelMemory.Abstractions to version 0.34.240313.1
- Update Microsoft.SemanticKernel.Abstractions to version 1.6.2
Modified LLamaBatch to not share tokens with other sequences if logits is true. This ensures that the logit span at the end in used by exactly one sequence - therefore it's safe to mutate. This removes the need for copying _very_ large arrays (vocab size) and simplifies sampling pipelines.
* Added a `Guidance` method to `LLamaTokenDataArray` which applies classifier free guidance
* Factored out a safer `llama_sample_apply_guidance` method based on spans
* Created a guided sampling demo using the batched executor
* fixed comment, "classifier free" not "context free"
* Rebased onto master and fixed breakage due to changes in `BaseSamplingPipeline`
* Asking user for guidance weight
* Progress bar in batched fork demo
* Improved fork example (using tree display)
* Added proper disposal of resources in batched examples
* Added some more comments in BatchedExecutorGuidance
* - Modified ISamplingPipeline to accept `ReadOnlySpan<float>` of logits directly. This moves responsibility to copy the logits into the pipeline.
- Added a flag to `BaseSamplingPipeline` indicating if a logit copy is necessary. Skipping it in most cases.
* Fixed `RestoreProtectedTokens` not working if logit processing is skipped
* - Implemented a new greedy sampling pipeline (always sample most likely token)
- Moved `Grammar` into `BaseSamplingPipeline`
- Removed "protected tokens" concept from `BaseSamplingPipeline`. Was introducing a lot of incidental complexity.
- Implemented newline logit save/restore in `DefaultSamplingPipeline` (only place protected tokens was used)
* Implemented pipelines for mirostat v1 and v2
- UserSettings, simplifying the validation/re-ask loop down to one call
- Program, adding colour to figlet title
- Batched examples, showing default prompt
- ExampleRunner, resetting state after running an example
* LLama.Examples: disable console logging
* LLama.Examples: rename titles to signal grouped topics
* LLama.Examples: add additional PDF for Q&A
* LLama.Examples: improve kernel memory demo
multi-document ingestion
* LLama.Examples: improve message before resetting to main menu
* LLama.Examples: document Q&A with local memory
* LLama.Examples: RepoUtils.cs → ConsoleLogger.cs
* LLama.Examples: Examples/Runner.cs → ExampleRunner.cs
* LLama.Examples: delete unused console logger
* LLama.Examples: improve splash screen appearance
the llama_empty_call() no longer shows configuration information on startup, but it will display it automatically the first time a model is engaged
* LLama.Examples: Runner → ExampleRunner
* LLama.Examples: improve model path prompt
The last used model is stored in a config file and is re-used when a blank path is provided
* LLama.Examples: NativeApi.llama_empty_call() at startup
* LLama.Examples: reduce console noise when saving model path
* Embeddings example: set EmbeddingMode true
prevents an exception from being thrown when GetEmbeddings() is called
* Embeddings example: improve documentation and styling
* docs: improve GetEmbeddings page
If EmbeddingMode is not set to true, GetEmbeddings() throws an exception
* docs: improve GetEmbeddings page
The previous commit 6c9ff3158c was inaccurate
* Embeddings example: improve styling
displays the example description after the model is loaded to ensure the text is on the screen at the time the prompt is first requested
Conversations can be "forked", to create a copy of a conversation at a given point. This allows e.g. prompting a conversation with a system prefix just once and then forking it again and again for each individual conversation. Conversations can also be "rewound" to an earlier state.
Added two new examples, demonstrating forking and rewinding.
- Added a `DecodeAsync` overload which runs the work in a task
- Replaced some `NativeHandle` usage in `BatchedDecoding` with higher level equivalents.
- Made the `LLamaBatch` grow when token capacity is exceeded, removing the need to manage token capacity externally.