Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflow to check the spellings. #710

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/_typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Typos configuration file
#
# Info: https://github.com/marketplace/actions/typos-action
# Install: brew install typos-cli
# Install: conda install typos
# Run: typos -c .github/_typos.toml

[files]
extend-exclude = [
"_typos.toml",
"docs/xmldocs/",
"LLama.Web/wwwroot/",
"LLama/runtimes/deps/"
]
31 changes: 31 additions & 0 deletions .github/workflows/spell_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Check pull requests for typos.
#
# Configuration: .github/_typos.toml
#
# Info: https://github.com/marketplace/actions/typos-action
# Local install: brew install typos-cli
# Local install: conda install typos
# Local run: typos -c .github/_typos.toml

name: Spell Check

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
run:
name: Spell check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Use custom config file
uses: crate-ci/typos@master
with:
config: .github/_typos.toml
write_changes: false
quiet: true
2 changes: 1 addition & 1 deletion LLama.Examples/Examples/BatchedExecutorSaveAndLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static async Task Run()
// Continue generating text
await GenerateTokens(executor, conversation, sampler, decoder, n_len);

// Display final ouput
// Display final output
AnsiConsole.MarkupLine($"[red]{prompt}{decoder.Read()}[/]");
}

Expand Down
2 changes: 1 addition & 1 deletion LLama.Examples/Examples/LlavaInteractiveModeExecute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static async Task Run()
Console.WriteLine();


// Initilize Images in executor
// Initialize Images in executor
//
foreach (var image in imagePaths)
{
Expand Down
4 changes: 2 additions & 2 deletions LLama.Examples/Examples/SpeechChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ The short audio comes from a user that is speaking to an AI Language Model in re
int totalNonBlankClips; // ..but for example's sake they work on a
int nonIdleTime; // ..clip-based quant-length (1 = clipLength).
// Default detection settings: A speech of 750ms, followed by pause of 500ms. (2x250ms)
public (int minBlanksPerSeperation, int minNonBlanksForValidMessages) detectionSettings = (2, 3);
public (int minBlanksPerSeparation, int minNonBlanksForValidMessages) detectionSettings = (2, 3);

public HashSet<ISpeechListener> ServiceUsers = [];

Expand Down Expand Up @@ -156,7 +156,7 @@ void OnAudioDataAvailable(object? sender, WaveInEventArgs e)

// Compare the volume with the threshold and act accordingly. Once an interesting and 'full' set of clips pops up, serve it.
if (maxVolume >= voiceDetectionThreshold) { currentBlankClips = 0; totalNonBlankClips++; nonIdleTime++; }
else if (++currentBlankClips < detectionSettings.minBlanksPerSeperation) { nonIdleTime++; }
else if (++currentBlankClips < detectionSettings.minBlanksPerSeparation) { nonIdleTime++; }
else
{
if (totalNonBlankClips >= detectionSettings.minNonBlanksForValidMessages) { SendTranscription(); }
Expand Down
2 changes: 1 addition & 1 deletion LLama.Web/Async/AsyncLock.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace LLama.Web.Async
{
/// <summary>
/// Create an Async locking using statment
/// Create an Async locking using statement
/// </summary>
public sealed class AsyncLock
{
Expand Down
6 changes: 3 additions & 3 deletions LLama.Web/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public static List<string> GetOutputFilters(this ISessionConfig sessionConfig)
private static List<string> CombineCSV(List<string> list, string csv)
{
var results = list is null || list.Count == 0
? CommaSeperatedToList(csv)
: CommaSeperatedToList(csv).Concat(list);
? CommaSeparatedToList(csv)
: CommaSeparatedToList(csv).Concat(list);
return results
.Distinct()
.ToList();
}

private static List<string> CommaSeperatedToList(string value)
private static List<string> CommaSeparatedToList(string value)
{
if (string.IsNullOrEmpty(value))
return new List<string>();
Expand Down
2 changes: 1 addition & 1 deletion LLama.Web/Hubs/SessionConnectionHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override async Task OnDisconnectedAsync(Exception exception)
{
_logger.Log(LogLevel.Information, "[OnDisconnectedAsync], Id: {0}", Context.ConnectionId);

// Remove connections session on dissconnect
// Remove connections session on disconnect
await _modelSessionService.CloseAsync(Context.ConnectionId);
await base.OnDisconnectedAsync(exception);
}
Expand Down
6 changes: 3 additions & 3 deletions LLama.Web/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## LLama.Web - Basic ASP.NET Core examples of LLamaSharp in action
LLama.Web has no heavy dependencies and no extra frameworks ove bootstrap and jquery to keep the examples clean and easy to copy over to your own project
LLama.Web has no heavy dependencies and no extra frameworks over bootstrap and jquery to keep the examples clean and easy to copy over to your own project

## Websockets
Using signalr websockets simplifys the streaming of responses and model per connection management
Using signalr websockets simplifies the streaming of responses and model per connection management



Expand All @@ -23,7 +23,7 @@ Example:
{
"Name": "Alpaca",
"Path": "D:\\Repositories\\AI\\Prompts\\alpaca.txt",
"Prompt": "Alternativly to can set a prompt text directly and omit the Path"
"Prompt": "Alternatively to can set a prompt text directly and omit the Path"
"AntiPrompt": [
"User:"
],
Expand Down
2 changes: 1 addition & 1 deletion LLama.Web/Services/ModelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace LLama.Web.Services
{

/// <summary>
/// Sercive for handling Models,Weights & Contexts
/// Service for handling Models,Weights & Contexts
/// </summary>
public class ModelService : IModelService
{
Expand Down
2 changes: 1 addition & 1 deletion LLama/Abstractions/IInferenceParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace LLama.Abstractions
{
/// <summary>
/// The paramters used for inference.
/// The parameters used for inference.
/// </summary>
public interface IInferenceParams
{
Expand Down
2 changes: 1 addition & 1 deletion LLama/Abstractions/ILLamaExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface ILLamaExecutor
/// </summary>
public bool IsMultiModal { get; }
/// <summary>
/// Muti-Modal Projections / Clip Model weights
/// Multi-Modal Projections / Clip Model weights
/// </summary>
public LLavaWeights? ClipModel { get; }

Expand Down
2 changes: 1 addition & 1 deletion LLama/Abstractions/IModelParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public override void Write(Utf8JsonWriter writer, TensorSplitsCollection value,
public sealed record MetadataOverride
{
/// <summary>
/// Get the key being overriden by this override
/// Get the key being overridden by this override
/// </summary>
public string Key { get; }

Expand Down
2 changes: 1 addition & 1 deletion LLama/ChatSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@
InferenceParams? inferenceParams = null,
[EnumeratorCancellation] CancellationToken cancellationToken = default)
{
// Make sure the last message is an assistant message (reponse from the LLM).
// Make sure the last message is an assistant message (response from the LLM).
ChatHistory.Message? lastAssistantMessage = History.Messages.LastOrDefault();

if (lastAssistantMessage is null
Expand Down Expand Up @@ -676,7 +676,7 @@
Directory.CreateDirectory(path);

string modelStateFilePath = Path.Combine(path, ChatSession.MODEL_STATE_FILENAME);
var bytes = ContextState?.ToByteArray();

Check warning on line 679 in LLama/ChatSession.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

'LLamaContext.State.ToByteArray()' is obsolete: 'It is not generally safe to convert a state into a byte array - it will fail if the state is very large'

Check warning on line 679 in LLama/ChatSession.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

'LLamaContext.State.ToByteArray()' is obsolete: 'It is not generally safe to convert a state into a byte array - it will fail if the state is very large'
if (bytes is not null)
{
File.WriteAllBytes(modelStateFilePath, bytes);
Expand Down Expand Up @@ -718,7 +718,7 @@

string modelStateFilePath = Path.Combine(path, ChatSession.MODEL_STATE_FILENAME);
var contextState = File.Exists(modelStateFilePath) ?
State.FromByteArray(File.ReadAllBytes(modelStateFilePath))

Check warning on line 721 in LLama/ChatSession.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

'LLamaContext.State.FromByteArray(byte[])' is obsolete: 'It is not generally safe to convert a state into a byte array - it will fail if the state is very large'

Check warning on line 721 in LLama/ChatSession.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

'LLamaContext.State.FromByteArray(byte[])' is obsolete: 'It is not generally safe to convert a state into a byte array - it will fail if the state is very large'
: null;

string executorStateFilepath = Path.Combine(path, ChatSession.EXECUTOR_STATE_FILENAME);
Expand Down Expand Up @@ -774,7 +774,7 @@

return new SessionState(
contextState,
executorState,

Check warning on line 777 in LLama/ChatSession.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

Possible null reference argument for parameter 'executorState' in 'SessionState.SessionState(State? contextState, ExecutorBaseState executorState, ChatHistory history, List<ITextTransform> inputTransformPipeline, ITextStreamTransform outputTransform, IHistoryTransform historyTransform)'.

Check warning on line 777 in LLama/ChatSession.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

Possible null reference argument for parameter 'executorState' in 'SessionState.SessionState(State? contextState, ExecutorBaseState executorState, ChatHistory history, List<ITextTransform> inputTransformPipeline, ITextStreamTransform outputTransform, IHistoryTransform historyTransform)'.
history,
inputTransforms.ToList(),
outputTransform,
Expand Down
2 changes: 1 addition & 1 deletion LLama/Common/InferenceParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace LLama.Common
{
/// <summary>
/// The paramters used for inference.
/// The parameters used for inference.
/// </summary>
public record InferenceParams
: IInferenceParams
Expand Down
2 changes: 1 addition & 1 deletion LLama/Extensions/IContextParamsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace LLama.Extensions
{
/// <summary>
/// Extention methods to the IContextParams interface
/// Extension methods to the IContextParams interface
/// </summary>
public static class IContextParamsExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion LLama/Extensions/IModelParamsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace LLama.Extensions;

/// <summary>
/// Extention methods to the IModelParams interface
/// Extension methods to the IModelParams interface
/// </summary>
public static class IModelParamsExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion LLama/LLamaContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ protected override bool ReleaseHandle()
}

/// <summary>
/// Copy bytes to a desintation pointer.
/// Copy bytes to a destination pointer.
/// </summary>
/// <param name="dst">Destination to write to</param>
/// <param name="length">Length of the destination buffer</param>
Expand Down
2 changes: 1 addition & 1 deletion LLama/LLamaExecutorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
/// <summary>
/// Try to reuse the matching prefix from the session file.
/// </summary>
protected virtual void TryReuseMathingPrefix()
Copy link
Member

@martindevans martindevans Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a breaking change. But I'm not too concerned about it in this case tbh.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could mention it in the next release note. :)

protected virtual void TryReuseMatchingPrefix()
{
if (_n_session_consumed < _session_tokens.Count)
{
Expand Down Expand Up @@ -419,10 +419,10 @@
public string? SessionFilePath { get; set; }

[JsonPropertyName("embd")]
public LLamaToken[] Embeds { get; set; }

Check warning on line 422 in LLama/LLamaExecutorBase.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

Non-nullable property 'Embeds' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[JsonPropertyName("embd_inps")]
public LLamaToken[] EmbedInps { get; set; }

Check warning on line 425 in LLama/LLamaExecutorBase.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

Non-nullable property 'EmbedInps' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[JsonPropertyName("session_tokens")]
public LLamaToken[] SessionTokens { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions LLama/LLamaInstructExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
{
var state = await JsonSerializer.DeserializeAsync<InstructExecutorState>(fs);
await LoadState(state);

Check warning on line 109 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

Possible null reference argument for parameter 'data' in 'Task InstructExecutor.LoadState(ExecutorBaseState data)'.

Check warning on line 109 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

Possible null reference argument for parameter 'data' in 'Task InstructExecutor.LoadState(ExecutorBaseState data)'.

Check warning on line 109 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

Possible null reference argument for parameter 'data' in 'Task InstructExecutor.LoadState(ExecutorBaseState data)'.
}
}

Expand Down Expand Up @@ -147,11 +147,11 @@
}

/// <inheritdoc />
protected override async Task<(bool, IReadOnlyList<string>)> PostProcess(IInferenceParams inferenceParams, InferStateArgs args)

Check warning on line 150 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 150 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
if (_embed_inps.Count <= _consumedTokensCount)
{
if (_last_n_tokens.TokensEndsWithAnyString(args.Antiprompts, Context.NativeHandle.ModelHandle, Context.Encoding))

Check warning on line 154 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

'IReadOnlyListExtensions.TokensEndsWithAnyString<TTokens>(TTokens, IList<string>?, SafeLlamaModelHandle, Encoding)' is obsolete: 'Use an Antiprompt processor instead'

Check warning on line 154 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

'IReadOnlyListExtensions.TokensEndsWithAnyString<TTokens>(TTokens, IList<string>?, SafeLlamaModelHandle, Encoding)' is obsolete: 'Use an Antiprompt processor instead'
{
args.WaitForInput = true;
return (true, Array.Empty<string>());
Expand Down Expand Up @@ -189,7 +189,7 @@
HandleRunOutOfContext(inferenceParams.TokensKeep);
}

TryReuseMathingPrefix();
TryReuseMatchingPrefix();

var (result, _) = Context.NativeHandle.Decode(_embeds, LLamaSeqId.Zero, batch, ref _pastTokensCount);
if (result != DecodeResult.Ok)
Expand All @@ -212,7 +212,7 @@
if (!string.IsNullOrEmpty(_pathSession) && args.NeedToSaveSession)
{
args.NeedToSaveSession = false;
SaveSessionFile(_pathSession);

Check warning on line 215 in LLama/LLamaInstructExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (windows-release)

Possible null reference argument for parameter 'filename' in 'void StatefulExecutorBase.SaveSessionFile(string filename)'.
}

LLamaToken id;
Expand Down Expand Up @@ -259,7 +259,7 @@
return Task.CompletedTask;
}
/// <summary>
/// The desciptor of the state of the instruct executor.
/// The descriptor of the state of the instruct executor.
/// </summary>
public class InstructExecutorState : ExecutorBaseState
{
Expand Down
2 changes: 1 addition & 1 deletion LLama/LLamaInteractExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
{
var state = await JsonSerializer.DeserializeAsync<InteractiveExecutorState>(fs);
await LoadState(state);

Check warning on line 101 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

Possible null reference argument for parameter 'data' in 'Task InteractiveExecutor.LoadState(ExecutorBaseState data)'.

Check warning on line 101 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

Possible null reference argument for parameter 'data' in 'Task InteractiveExecutor.LoadState(ExecutorBaseState data)'.
}
}

Expand Down Expand Up @@ -159,7 +159,7 @@
{
foreach (var image in Images)
{
_imageEmbedHandles.Add(SafeLlavaImageEmbedHandle.CreateFromMemory(ClipModel.NativeHandle, Context, image));

Check warning on line 162 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

Dereference of a possibly null reference.

Check warning on line 162 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

Dereference of a possibly null reference.
}

int imageIndex = text.IndexOf("<image>");
Expand Down Expand Up @@ -196,11 +196,11 @@
/// <param name="inferenceParams"></param>
/// <param name="args"></param>
/// <returns></returns>
protected override async Task<(bool, IReadOnlyList<string>)> PostProcess(IInferenceParams inferenceParams, InferStateArgs args)

Check warning on line 199 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 199 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
if (_embed_inps.Count <= _consumedTokensCount)
{
if (_last_n_tokens.TokensEndsWithAnyString(args.Antiprompts, Context.NativeHandle.ModelHandle, Context.Encoding))

Check warning on line 203 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (linux-release)

'IReadOnlyListExtensions.TokensEndsWithAnyString<TTokens>(TTokens, IList<string>?, SafeLlamaModelHandle, Encoding)' is obsolete: 'Use an Antiprompt processor instead'

Check warning on line 203 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

'IReadOnlyListExtensions.TokensEndsWithAnyString<TTokens>(TTokens, IList<string>?, SafeLlamaModelHandle, Encoding)' is obsolete: 'Use an Antiprompt processor instead'
args.WaitForInput = true;

if (_pastTokensCount > 0 && args.WaitForInput)
Expand Down Expand Up @@ -234,7 +234,7 @@
HandleRunOutOfContext(inferenceParams.TokensKeep);
}

TryReuseMathingPrefix();
TryReuseMatchingPrefix();

// Changes to support Multi-Modal LLMs.
//
Expand All @@ -247,7 +247,7 @@

// Images
foreach( var image in _imageEmbedHandles )
ClipModel.EvalImageEmbed(Context, image, ref _pastTokensCount);

Check warning on line 250 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

Dereference of a possibly null reference.

// Post-image Tokens
end = Context.NativeHandle.Decode(_embeds.GetRange(_EmbedImagePosition, _embeds.Count - _EmbedImagePosition), LLamaSeqId.Zero, batch, ref _pastTokensCount);
Expand Down Expand Up @@ -280,7 +280,7 @@
if (!string.IsNullOrEmpty(_pathSession) && args.NeedToSaveSession)
{
args.NeedToSaveSession = false;
SaveSessionFile(_pathSession);

Check warning on line 283 in LLama/LLamaInteractExecutor.cs

View workflow job for this annotation

GitHub Actions / Test (osx-release)

Possible null reference argument for parameter 'filename' in 'void StatefulExecutorBase.SaveSessionFile(string filename)'.
}

LLamaToken id;
Expand Down
2 changes: 1 addition & 1 deletion LLama/LLamaStatelessExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public StatelessExecutor(LLamaWeights weights, IContextParams @params, ILogger?
/// <inheritdoc />
public async IAsyncEnumerable<string> InferAsync(string prompt, IInferenceParams? inferenceParams = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
// Ensure the context from last time is disposed (it always hould be)
// Ensure the context from last time is disposed (it always should be)
if (!Context.NativeHandle.IsClosed)
Context.Dispose();

Expand Down
4 changes: 2 additions & 2 deletions LLama/Native/NativeApi.LLava.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static unsafe partial class NativeApi
/// <param name="ctx_clip">SafeHandle to the Clip Model</param>
/// <param name="n_threads">Number of threads</param>
/// <param name="image_bytes">Binary image in jpeg format</param>
/// <param name="image_bytes_length">Bytes lenght of the image</param>
/// <param name="image_bytes_length">Bytes length of the image</param>
/// <returns>SafeHandle to the Embeddings</returns>
[DllImport(llavaLibraryName, EntryPoint = "llava_image_embed_make_with_bytes",
CallingConvention = CallingConvention.Cdecl)]
Expand All @@ -35,7 +35,7 @@ SafeLlavaImageEmbedHandle llava_image_embed_make_with_bytes(SafeLlavaModelHandle
/// <param name="ctx_clip">SafeHandle to the Clip Model</param>
/// <param name="n_threads">Number of threads</param>
/// <param name="image_path">Image filename (jpeg) to generate embeddings</param>
/// <returns>SafeHandel to the embeddings</returns>
/// <returns>SafeHandle to the embeddings</returns>
[DllImport(llavaLibraryName, EntryPoint = "llava_image_embed_make_with_filename", CallingConvention = CallingConvention.Cdecl)]
public static extern
SafeLlavaImageEmbedHandle llava_image_embed_make_with_filename(SafeLlavaModelHandle ctx_clip, int n_threads,
Expand Down
2 changes: 1 addition & 1 deletion LLama/Native/NativeApi.Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static NativeApi()
"3. One of the dependency of the native library is missed. Please use `ldd` on linux, `dumpbin` on windows and `otool`" +
"to check if all the dependency of the native library is satisfied. Generally you could find the libraries under your output folder.\n" +
"4. Try to compile llama.cpp yourself to generate a libllama library, then use `LLama.Native.NativeLibraryConfig.WithLibrary` " +
"to specify it at the very beginning of your code. For more informations about compilation, please refer to LLamaSharp repo on github.\n");
"to specify it at the very beginning of your code. For more information about compilation, please refer to LLamaSharp repo on github.\n");
}

// Now that the "loaded" flag is set configure logging in llama.cpp
Expand Down
4 changes: 2 additions & 2 deletions LLama/Native/NativeLibraryConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public NativeLibraryConfig SkipCheck(bool enable = true)
}

/// <summary>
/// Add self-defined search directories. Note that the file stucture of the added
/// Add self-defined search directories. Note that the file structure of the added
/// directories must be the same as the default directory. Besides, the directory
/// won't be used recursively.
/// </summary>
Expand All @@ -116,7 +116,7 @@ public NativeLibraryConfig WithSearchDirectories(IEnumerable<string> directories
}

/// <summary>
/// Add self-defined search directories. Note that the file stucture of the added
/// Add self-defined search directories. Note that the file structure of the added
/// directories must be the same as the default directory. Besides, the directory
/// won't be used recursively.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ For more examples, please refer to [LLamaSharp.Examples](./LLama.Examples).
#### Why GPU is not used when I have installed CUDA

1. If you are using backend packages, please make sure you have installed the cuda backend package which matches the cuda version of your device. Please note that before LLamaSharp v0.10.0, only one backend package should be installed.
2. Add `NativeLibraryConfig.Instance.WithLogs(LLamaLogLevel.Info)` to the very beginning of your code. The log will show which native library file is loaded. If the CPU library is loaded, please try to compile the native library yourself and open an issue for that. If the CUDA libraty is loaded, please check if `GpuLayerCount > 0` when loading the model weight.
2. Add `NativeLibraryConfig.Instance.WithLogs(LLamaLogLevel.Info)` to the very beginning of your code. The log will show which native library file is loaded. If the CPU library is loaded, please try to compile the native library yourself and open an issue for that. If the CUDA library is loaded, please check if `GpuLayerCount > 0` when loading the model weight.

#### Why the inference is slow

Expand Down
2 changes: 1 addition & 1 deletion docs/Examples/LLavaInteractiveModeExecute.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace LLama.Examples.Examples
Console.WriteLine();


// Initilize Images in executor
// Initialize Images in executor
//
foreach (var image in imagePaths)
{
Expand Down
4 changes: 2 additions & 2 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Frequently asked qustions
# Frequently asked questions

Sometimes, your application with LLM and LLamaSharp may have unexpected behaviours. Here are some frequently asked questions, which may help you to deal with your problem.

## Why GPU is not used when I have installed CUDA

1. If you are using backend packages, please make sure you have installed the cuda backend package which matches the cuda version of your device. Please note that before LLamaSharp v0.10.0, only one backend package should be installed.
2. Add `NativeLibraryConfig.Instance.WithLogs(LLamaLogLevel.Info)` to the very beginning of your code. The log will show which native library file is loaded. If the CPU library is loaded, please try to compile the native library yourself and open an issue for that. If the CUDA libraty is loaded, please check if `GpuLayerCount > 0` when loading the model weight.
2. Add `NativeLibraryConfig.Instance.WithLogs(LLamaLogLevel.Info)` to the very beginning of your code. The log will show which native library file is loaded. If the CPU library is loaded, please try to compile the native library yourself and open an issue for that. If the CUDA library is loaded, please check if `GpuLayerCount > 0` when loading the model weight.

## Why the inference is slow

Expand Down
2 changes: 1 addition & 1 deletion docs/QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ do
Console.WriteLine();


// Initilize Images in executor
// Initialize Images in executor
//
ex.ImagePaths = imagePaths.ToList();
}
Expand Down
6 changes: 3 additions & 3 deletions docs/Tutorials/Executors.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface ILLamaExecutor
/// </summary>
public bool IsMultiModal { get; }
/// <summary>
/// Muti-Modal Projections / Clip Model weights
/// Multi-Modal Projections / Clip Model weights
/// </summary>
public LLavaWeights? ClipModel { get; }

Expand Down Expand Up @@ -110,7 +110,7 @@ At this time, by repeating the same mode of `Q: xxx? A: xxx.`, LLM outputs the a

## BatchedExecutor

Different from other executors, `BatchedExecutor` could accept multiple inputs from different sessions and geneate outputs for them at the same time. Here is an example to use it.
Different from other executors, `BatchedExecutor` could accept multiple inputs from different sessions and generate outputs for them at the same time. Here is an example to use it.

```cs
using LLama.Batched;
Expand Down Expand Up @@ -249,7 +249,7 @@ Here is the parameters for LLamaSharp executors.

```cs
/// <summary>
/// The paramters used for inference.
/// The parameters used for inference.
/// </summary>
public record InferenceParams
: IInferenceParams
Expand Down
2 changes: 1 addition & 1 deletion docs/Tutorials/NativeLibraryConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ As indicated in [Architecture](../Architecture.md), LLamaSharp uses the native l
Before introducing the way to customize native library loading, please follow the tips below to see if you need to compile the native library yourself, rather than use the published backend packages, which contain native library files for multiple targets.

1. Your device/environment has not been supported by any published backend packages. For example, vulkan has not been supported yet. In this case, it will mean a lot to open an issue to tell us you are using it. Since our support for new backend will have a delay, you could compile yourself before that.
2. You want to gain the best performance of LLamaSharp. Because LLamaSharp offloads the model to both GPU and CPU, the performance is significantly related with CPU if your GPU memory size is small. AVX ([Advanced Vector Extensions](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions)) and BLAS ([Basic Linear Algebra Subprograms](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms)) are the most important ways to accelerate the CPU computation. By default, LLamaSharp disables the support for BLAS and use AVX2 for CUDA backend yet. If you would like to enable BLAS or use AVX 512 along with CUDA, please compile the native library youself, following the [instructions here](../ContributingGuide.md).
2. You want to gain the best performance of LLamaSharp. Because LLamaSharp offloads the model to both GPU and CPU, the performance is significantly related with CPU if your GPU memory size is small. AVX ([Advanced Vector Extensions](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions)) and BLAS ([Basic Linear Algebra Subprograms](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms)) are the most important ways to accelerate the CPU computation. By default, LLamaSharp disables the support for BLAS and use AVX2 for CUDA backend yet. If you would like to enable BLAS or use AVX 512 along with CUDA, please compile the native library yourself, following the [instructions here](../ContributingGuide.md).
3. You want to debug the c++ code.


Expand Down
Loading
Loading