Commit Graph

420 Commits

Author SHA1 Message Date
Martin Evans cf4754db44 Removed unnecessary parameters from some low level sampler methods 2023-08-26 21:38:24 +01:00
Martin Evans 0ce5cf97fc
Merge pull request #124 from martindevans/native_sampling_api_improvements
Two small improvements to the native sampling API
2023-08-26 01:35:48 +01:00
Martin Evans f70525fec2 Two small improvements to the native sampling API:
- Modified `llama_sample_token_mirostat` and `llama_sample_token_mirostat_v2` to take `ref float` instead of as a `float*`. Less pointers is always good.
 - Modified `llama_sample_repetition_penalty` and `llama_sample_frequency_and_presence_penalties` to take pointers instead of arrays. This allows the use non non allocating types (e.g. Span) instead of arrays
 - Modified higher level API to accept `Memory<int>` instead of `int[]`, which can be used to reduce allocations at call sites
2023-08-26 01:25:48 +01:00
Martin Evans da3dffe812
Merge pull request #120 from martindevans/code_warnings_cleanup
ReSharper code warnings cleanup
2023-08-25 00:04:42 +01:00
Martin Evans a911b77dec Various minor changes, resolving about 100 ReSharper code quality warnings 2023-08-24 23:15:53 +01:00
Martin Evans 5a6c6de0dc
Merge pull request #115 from martindevans/model_params_record
ModelsParams record class
2023-08-24 22:54:23 +01:00
Martin Evans d367317c2c
Merge pull request #119 from martindevans/improved_cloning
Improved Cloning
2023-08-24 17:59:35 +01:00
Martin Evans 70be6c7368 Removed `virtual` method in newly sealed class 2023-08-24 17:08:01 +01:00
Martin Evans ebacdb666d - Moved the lower level state get/set methods onto SafeLLamaContextHandle
- Used those methods to add a `Clone` method to SafeLLamaContextHandle
 - Simplified `LLamaContext` by using the new methods
 - Sealed `LLamaContext` and `LLamaEmbedder`
2023-08-24 17:03:27 +01:00
Martin Evans 77aa5fa0d0 Added `JsonConverter` attribute, so System.Text.Json serialization is seamless 2023-08-24 16:17:49 +01:00
Martin Evans df80ec9161
Merge pull request #97 from martindevans/embedder_tests
Embedder Test
2023-08-24 02:08:39 +01:00
Martin Evans 634bd3feed Loosened requirements even more! 2023-08-24 01:55:54 +01:00
Martin Evans 9587699a60 loosened requirements even further for CI 2023-08-24 01:48:12 +01:00
Martin Evans bc70358b3e expanded epsilon enough to allow CI to pass 2023-08-24 01:18:21 +01:00
Martin Evans 469b5e6fcd
Merge pull request #117 from martindevans/more_obsoletion
OldVersion obsoletion notices
2023-08-24 01:17:08 +01:00
Martin Evans 804686818c Merge branch 'embedder_tests' of github.com:martindevans/LLamaSharp into embedder_tests 2023-08-24 01:14:24 +01:00
Martin Evans 058c4e84b1 Rewritten LLamaEmbedder to use `LLamaContext` instead of the lower level handles 2023-08-24 01:14:12 +01:00
Martin Evans 08501db155 cleaned up basic test a bit 2023-08-24 01:03:03 +01:00
Martin Evans 498ed109c1 Fixed dot product based test 2023-08-24 01:03:03 +01:00
Martin Evans 35e48691ea Added a known correct value to the unit tests 2023-08-24 01:03:03 +01:00
Martin Evans dff308e31b Added a test for the LLamaEmbedder 2023-08-24 01:03:03 +01:00
Martin Evans 829f32b27d - Added `Obsolete` attributes to the entire `OldVersion` namespace, so they can be removed in the future
- Minor changes to cleanup some of the compiler warnings
2023-08-24 00:59:32 +01:00
Martin Evans ee772a2921 added `using` statement instead of full qualification 2023-08-24 00:24:16 +01:00
Martin Evans 93f24f8a51 Switched to properly typed `Encoding` property 2023-08-24 00:09:00 +01:00
Martin Evans d92e2664ac
Merge pull request #116 from zombieguy98/master
Changed type conversion
2023-08-23 23:04:03 +01:00
zombieguy 45b01d5a78 Improved type conversion
Type conversion is now done in the property rather than the utils class and uses the System.Convert class to ensure consistency.
2023-08-23 19:36:14 +01:00
Martin Evans 29df14cd9c Converted ModelParams into a `record` class. This has several advantages:
- Equality, hashing etc all implemented automatically
 - Default values are defined in just one place (the properties) instead of the constructor as well
 - Added test to ensure that serialization works properly
2023-08-23 00:58:25 +01:00
Martin Evans 42fc5e4983
Merge pull request #114 from martindevans/minor_code_cleanup
Minor Code Cleanup
2023-08-23 00:07:53 +01:00
Martin Evans 2830e5755c - Applied a lot of minor R# code quality suggestions. Lots of unnecessary imports removed.
- Deleted `NativeInfo` (internal class, not used anywhere)
2023-08-22 23:20:13 +01:00
Martin Evans 854532c08e
Merge pull request #112 from martindevans/classifier_free_guidance
Added native symbol for CFG
2023-08-22 18:35:13 +01:00
Martin Evans a6cd0cf848
Merge pull request #111 from erinloy/master
Re-renaming some arguments to allow for easy deserialization from appsettings.json.
2023-08-22 18:33:45 +01:00
Martin Evans 4b7d718551 Added native symbol for CFG 2023-08-22 17:11:49 +01:00
Erin Loy 8f0b52eb09 Re-renaming some arguments to allow for easy deserialization from appsettings.json. 2023-08-22 09:09:22 -07:00
Martin Evans 976ca6a740
Merge pull request #102 from martindevans/grammar_basics
Grammar basics
2023-08-22 14:54:28 +01:00
Martin Evans 9fc17f3136 Fixed unit tests 2023-08-22 14:16:20 +01:00
Martin Evans 759ae26f36
Merge branch 'master' into grammar_basics 2023-08-22 14:06:57 +01:00
Martin Evans 70835a0010
Merge pull request #107 from martindevans/stateless_improvements
Stateless Executor Fix
2023-08-22 14:05:16 +01:00
Martin Evans a45d9089e1 Fixed demos 2023-08-22 01:32:53 +01:00
Martin Evans a9e6f21ab8 - Creating and destroying contexts in the stateless executor, saving memory. It now uses zero memory when not inferring!
- Passing encoding in the `IModelParams`, which reduces how often encoding needs to be passed around
2023-08-22 01:30:13 +01:00
Martin Evans 48bc0a6f8a Doe the same for the second test, hopefully fixing CI 2023-08-22 01:28:28 +01:00
Martin Evans 6f2ab8e039 Not asserting the answer, just that it didn't change 2023-08-22 01:28:28 +01:00
Martin Evans e7b217f462 Fixed out of context logic 2023-08-22 01:28:28 +01:00
Martin Evans 4738c26299 - Reduced context size of test, to speed it up
- Removed some unnecessary `ToArray` calls
 - Initial pass on LLamaStatelessExecutor, the context overflow management is broken but I think I found where it's ported from
2023-08-22 01:28:28 +01:00
Martin Evans ae8ef17a4a - Added various convenience overloads to `LLamaContext.Eval`
- Converted `SafeLLamaContextHandle` to take a `ReadOnlySpan` for Eval, narrower type better represents what's really needed
2023-08-22 01:28:28 +01:00
Martin Evans 4d0c044b9f Added tests for the StatelessExecutor, one is currently failing 2023-08-22 01:28:27 +01:00
Martin Evans 629e544341 cleaned up basic test a bit 2023-08-22 00:28:08 +01:00
Martin Evans 8f41a8395f Fixed dot product based test 2023-08-21 16:49:09 +01:00
Martin Evans 8d5eccd28b
Merge pull request #108 from erinloy/master
renamed some arguments in ModelParams constructor so that class can be serialized easily
2023-08-20 00:29:46 +01:00
Erin Loy 592a80840b renamed some arguments in ModelParams constructor so that classcan be serialized easily 2023-08-19 15:55:19 -07:00
Martin Evans 5e31c6db82
Merge pull request #105 from martindevans/update_demos
Updated Demos
2023-08-17 23:34:51 +01:00