-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #787 from patrick-hovsepian/generic_prompt
Generic Prompt Formatter
- Loading branch information
Showing
14 changed files
with
386 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Text; | ||
using LLama.Common; | ||
using LLama.Native; | ||
using LLama.Extensions; | ||
|
||
namespace LLama.Unittest.Native; | ||
|
||
public class SafeLlamaModelHandleTests | ||
{ | ||
private readonly LLamaWeights _model; | ||
private readonly SafeLlamaModelHandle TestableHandle; | ||
|
||
public SafeLlamaModelHandleTests() | ||
{ | ||
var @params = new ModelParams(Constants.GenerativeModelPath) | ||
{ | ||
ContextSize = 1, | ||
GpuLayerCount = Constants.CIGpuLayerCount | ||
}; | ||
_model = LLamaWeights.LoadFromFile(@params); | ||
|
||
TestableHandle = _model.NativeHandle; | ||
} | ||
|
||
[Fact] | ||
public void MetadataValByKey_ReturnsCorrectly() | ||
{ | ||
const string key = "general.name"; | ||
var template = _model.NativeHandle.MetadataValueByKey(key); | ||
var name = Encoding.UTF8.GetStringFromSpan(template!.Value.Span); | ||
|
||
const string expected = "LLaMA v2"; | ||
Assert.Equal(expected, name); | ||
|
||
var metadataLookup = _model.Metadata[key]; | ||
Assert.Equal(expected, metadataLookup); | ||
Assert.Equal(name, metadataLookup); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.