Commit Graph

1118 Commits

Author SHA1 Message Date
Rinne fb12577235
Merge pull request #629 from zsogitbe/experimental_cpp
Update LLamaSharpCpp
2024-03-29 03:28:51 +08:00
Zoli Somogyi 4bc111f3b3 Update LLamaSharpCpp 2024-03-28 20:06:47 +01:00
Rinne 886d4cf9ef
Merge pull request #628 from zsogitbe/experimental_cpp
LLamaSharpCpp - combine C# and C++ solution
2024-03-29 00:12:20 +08:00
Zoli Somogyi dfe19c1c5b LLamaSharpCpp - combine C# and C++ solution
This is the final result of my experimentation with the simplest solution I have found. One more step could be done by adding a clever script to pre-configure llama.cpp with the required settings (GPU, AVX2, platform...) and even full automatic build.
2024-03-28 08:10:52 +01:00
Rinne 6ddd45baa3
Merge pull request #602 from AsakusaRinne/add_submodule
build: add llama.cpp as submodule.
2024-03-17 18:00:53 +08:00
Rinne e17c8df992
Merge pull request #604 from AsakusaRinne/fix_readme_example
docs: update the example in readme.
2024-03-16 12:08:11 +08:00
Rinne a0dac6293f
docs: update the example in readme. 2024-03-16 12:06:06 +08:00
Rinne 5da0b4616a
build: add llama.cpp as submodule. 2024-03-14 23:27:38 +08:00
jlsantiago 3b2836eac4
Llava api (#563)
* Add llava_binaries, update all binaries to make the test

* Llava API + LlavaTest

Preliminary

* First prototype of Load + Unit Test

* Temporary run test con branch LlavaAPI

* Disable Embed test to review the rest of the test

* Restore Embedding test

* Use BatchThread to eval image embeddings

Test Threads default value to ensure it doesn´t produce problems.

* Rename test file

* Update action versions

* Test only one method, no release embeddings

* Revert "Test only one method, no release embeddings"

This reverts commit 264e176dccc9cd0be318b800ae5e102a4635d01c.

* Correct API call

* Only test llava related functionality

* Cuda and Cblast binaries

* Restore build policy

* Changes related with code review

* Add SafeHandles

* Set overwrite to upload-artifact@v4

* Revert to upload-artifact@v3

* revert to upload-artifact@v3
2024-03-13 22:10:44 +00:00
Martin Evans ce4de7d607
llama_decode lock (#595)
* Added a lock object into `SafeLlamaModelHandle` which all calls to `llama_decode` (in the `SafeLLamaContextHandle`) lock first. This prevents two contexts from running inference on the same model at the same time, which seems to be unsafe in llama.cpp.

* Modified the lock to be global over _all_ inferences. This seems to be necessary (at least with the CUDA backend).
2024-03-13 00:33:16 +00:00
Valentin Arthur Thomas 9deb50a2f4
update readme.md backends (#587) 2024-03-11 23:42:01 +00:00
Clovis Henrique Ribeiro d0f79814e9
Added conditional compilation code to progress_callback (in LlamaModelParams struct) so the struct plays nice with legacy NET Framework 4.8 (#593) 2024-03-11 14:36:50 +00:00
Rinne 884641f751
ci: add dependabot.yml 2024-03-11 21:39:40 +08:00
Martin Evans f0b0bbcbb7
Mutable Logits (#586)
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.
2024-03-10 13:56:11 +00:00
Martin Evans a8ba9f05b3
March Binary Update (#565)
* Updated binaries to llama.cpp `3ab8b3a92ede46df88bc5a2dfca3777de4a2b2b6` (build run: https://github.com/SciSharp/LLamaSharp/actions/runs/8118890586)

* Added abort callback

* Added properties to get/set thread count on `LLamaContext`

* Fixed LLamaLogLevel numbering
2024-03-06 15:19:42 +00:00
dependabot[bot] 6f03d5ac5c
build(deps): bump Microsoft.SemanticKernel and Microsoft.SemanticKernel.Abstractions (#572)
Bumps [Microsoft.SemanticKernel](https://github.com/microsoft/semantic-kernel) and [Microsoft.SemanticKernel.Abstractions](https://github.com/microsoft/semantic-kernel). These dependencies needed to be updated together.

Updates `Microsoft.SemanticKernel` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/microsoft/semantic-kernel/releases)
- [Commits](https://github.com/microsoft/semantic-kernel/compare/dotnet-1.4.0...dotnet-1.5.0)

Updates `Microsoft.SemanticKernel.Abstractions` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/microsoft/semantic-kernel/releases)
- [Commits](https://github.com/microsoft/semantic-kernel/compare/dotnet-1.4.0...dotnet-1.5.0)

---
updated-dependencies:
- dependency-name: Microsoft.SemanticKernel
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: Microsoft.SemanticKernel.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-05 00:58:43 +00:00
Rinne aa9a0a776b
Merge pull request #571 from SciSharp/dependabot/nuget/System.Text.Json-8.0.2
build(deps): bump System.Text.Json from 8.0.1 to 8.0.2
2024-03-04 17:37:37 +08:00
dependabot[bot] 4068a6f03b
build(deps): bump System.Text.Json from 8.0.1 to 8.0.2
Bumps [System.Text.Json](https://github.com/dotnet/runtime) from 8.0.1 to 8.0.2.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v8.0.2)

---
updated-dependencies:
- dependency-name: System.Text.Json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 07:04:42 +00:00
Martin Evans defac000ad
Added a `%(RecursiveDir)` element to the props file, this causes files to be copied along with the folder structure rather than dumped into the root. (#561) 2024-03-03 17:58:50 +00:00
jlsantiago ef24196444
Build Llava binaries (#556)
* Include llava binaries in the build

* Temporary comment

* Temporary do not remove artifacts

* Update upload version

* Remove artifacts
2024-03-01 13:41:09 +00:00
Martin Evans 8ac1634233
Removed `llama_eval`. It is going to be completely removed in the next version of llama.cpp (#553) 2024-02-28 21:41:39 +00:00
Martin Evans f0e7e7cc0a
Removed `SamplingApi`. it has been marked as Obsolete for a while, replaced by instance methods on `LLamaTokenDataArray` (#552) 2024-02-28 19:30:53 +00:00
Martin Evans a0731db944
Added tests checking that memory is freed properly (#551) 2024-02-28 17:12:24 +00:00
Martin Evans 7d84625a67
Classifier Free Guidance (#536)
* 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
2024-02-26 15:41:57 +00:00
dependabot[bot] 364259aabe
build(deps): bump Microsoft.SemanticKernel from 1.1.0 to 1.4.0 (#544)
Bumps [Microsoft.SemanticKernel](https://github.com/microsoft/semantic-kernel) from 1.1.0 to 1.4.0.
- [Release notes](https://github.com/microsoft/semantic-kernel/releases)
- [Commits](https://github.com/microsoft/semantic-kernel/compare/dotnet-1.1.0...dotnet-1.4.0)

---
updated-dependencies:
- dependency-name: Microsoft.SemanticKernel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 15:21:22 +00:00
dependabot[bot] e50f30d740
build(deps): bump Microsoft.KernelMemory.Core, System.Text.Json and Microsoft.KernelMemory.Abstractions (#546)
Bumps [Microsoft.KernelMemory.Core](https://github.com/microsoft/kernel-memory), [System.Text.Json](https://github.com/dotnet/runtime) and [Microsoft.KernelMemory.Abstractions](https://github.com/microsoft/kernel-memory). These dependencies needed to be updated together.

Updates `Microsoft.KernelMemory.Core` from 0.26.240121.1 to 0.29.240219.2
- [Release notes](https://github.com/microsoft/kernel-memory/releases)
- [Commits](https://github.com/microsoft/kernel-memory/compare/packages-0.26.240121.1...packages-0.29.240219.2)

Updates `System.Text.Json` from 8.0.1 to 8.0.2
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v8.0.2)

Updates `Microsoft.KernelMemory.Abstractions` from 0.26.240104.1 to 0.29.240219.3
- [Release notes](https://github.com/microsoft/kernel-memory/releases)
- [Commits](https://github.com/microsoft/kernel-memory/compare/0.26.240104.1...abstractions-0.29.240219.3)

---
updated-dependencies:
- dependency-name: Microsoft.KernelMemory.Core
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: System.Text.Json
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: Microsoft.KernelMemory.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 14:58:15 +00:00
dependabot[bot] 33827a1ba8
build(deps): bump Microsoft.SemanticKernel.Abstractions (#542)
Bumps [Microsoft.SemanticKernel.Abstractions](https://github.com/microsoft/semantic-kernel) from 1.1.0 to 1.4.0.
- [Release notes](https://github.com/microsoft/semantic-kernel/releases)
- [Commits](https://github.com/microsoft/semantic-kernel/compare/dotnet-1.1.0...dotnet-1.4.0)

---
updated-dependencies:
- dependency-name: Microsoft.SemanticKernel.Abstractions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 14:09:11 +00:00
dependabot[bot] 070969b23f
build(deps): bump coverlet.collector from 6.0.0 to 6.0.1 (#540)
Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-26 14:08:27 +00:00
alexhiggins732 3b5e781f1f
Add link to newly created Blazor Demo, requested by in the documentation. (#539) 2024-02-26 14:07:56 +00:00
Martin Evans 91a7967869
`ReadOnlySpan<float>` in ISamplingPipeline (#538)
* - 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
2024-02-25 02:12:00 +00:00
Martin Evans 74a39188a2
Used `AnsiConsole` in a few more places: (#534)
- 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
2024-02-24 02:18:05 +00:00
Scott W Harden 91ca9d2732
LLamaSharp.Examples: Document Q&A with local storage (#532)
* 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
2024-02-23 00:44:06 +00:00
Scott W Harden a6394001a1
NativeLibraryConfig: WithLogs(LLamaLogLevel) (#529)
Adds a NativeLibraryConfig.WithLogs() overload to let the user indicate the log level (with "info" as the default)
2024-02-21 23:51:09 +00:00
Scott W Harden 06ffe3ac95
LLama.Examples: improve model path prompt (#526)
* 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
2024-02-21 14:20:13 +00:00
Scott W Harden efa49cc8de
Improve "embeddings" example (#525)
* 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
2024-02-20 15:34:20 +00:00
Martin Evans 3d7bf4287c
Merge pull request #523 from swharden/patch-1
ChatSession: improve exception message
2024-02-19 23:04:42 +00:00
Scott W Harden 4c3077d0f0
ChatSession: improve exception message
The original message contained the word "preceeded" which should be spelled as "preceded"
2024-02-19 17:50:37 -05:00
Martin Evans ca2b7cf4d5
Merge pull request #520 from SciSharp/dependabot/nuget/xunit.runner.visualstudio-2.5.7
build(deps): bump xunit.runner.visualstudio from 2.5.6 to 2.5.7
2024-02-19 13:57:59 +00:00
dependabot[bot] 7fbf979fe0
build(deps): bump xunit.runner.visualstudio from 2.5.6 to 2.5.7
Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.6 to 2.5.7.
- [Release notes](https://github.com/xunit/visualstudio.xunit/releases)
- [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.6...2.5.7)

---
updated-dependencies:
- dependency-name: xunit.runner.visualstudio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 13:37:28 +00:00
Martin Evans 39fe4263e5
Merge pull request #521 from SciSharp/dependabot/nuget/Microsoft.AspNetCore.OpenApi-8.0.2
build(deps): bump Microsoft.AspNetCore.OpenApi from 8.0.1 to 8.0.2
2024-02-19 13:36:15 +00:00
Martin Evans 7a20ec6a5f
Merge pull request #522 from SciSharp/dependabot/nuget/xunit-2.7.0
build(deps): bump xunit from 2.6.6 to 2.7.0
2024-02-19 13:35:59 +00:00
dependabot[bot] 939d288384
build(deps): bump xunit from 2.6.6 to 2.7.0
Bumps [xunit](https://github.com/xunit/xunit) from 2.6.6 to 2.7.0.
- [Commits](https://github.com/xunit/xunit/compare/2.6.6...2.7.0)

---
updated-dependencies:
- dependency-name: xunit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 06:30:01 +00:00
dependabot[bot] 03ec5d9807
build(deps): bump Microsoft.AspNetCore.OpenApi from 8.0.1 to 8.0.2
Bumps [Microsoft.AspNetCore.OpenApi](https://github.com/dotnet/aspnetcore) from 8.0.1 to 8.0.2.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](https://github.com/dotnet/aspnetcore/compare/v8.0.1...v8.0.2)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.OpenApi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 06:29:48 +00:00
Martin Evans 6230350b97
Merge pull request #515 from martindevans/warnings_cleanup
Warnings Cleanup
2024-02-17 23:47:25 +00:00
Martin Evans c7d0dc915a Assorted small changes to clean up some code warnings 2024-02-17 23:07:10 +00:00
Martin Evans 9bc129e252
Merge pull request #512 from martindevans/updated_version
Release 0.10.0
2024-02-15 14:41:27 +00:00
Martin Evans 174f21a385 0.10.0 2024-02-15 14:40:56 +00:00
Martin Evans 633727bb73
Merge pull request #511 from martindevans/fixed_release_minor
Fixed Minor Release Script
2024-02-15 14:40:29 +00:00
Martin Evans 69a74bb053 Commented back in the line that pushes to nuget 2024-02-15 14:38:00 +00:00
Martin Evans d03c1a9201
Merge pull request #503 from martindevans/batched_executor_again
Introduced a new `BatchedExecutor`
2024-02-15 14:26:57 +00:00