Giter Site home page Giter Site logo

macoron / gpt4all.unity Goto Github PK

View Code? Open in Web Editor NEW
91.0 9.0 15.0 2.42 MB

Bindings of gpt4all language models for Unity3d running on your local machine

License: MIT License

C# 95.17% Shell 3.10% Batchfile 1.73%
gpt gpt4all large-language-models llm unity3d

gpt4all.unity's People

Contributors

macoron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpt4all.unity's Issues

String conversion error: Partial byte sequence encountered in the input and questions

Hi ! Sorry to bother you but i am a very beginner in unity ! ^^ I need your help about that error and GPU use in unity :

  • I cloned the repository in my project.
  • So i end up with 2 folders in my Asset folder named : "Samples" and "StreamingAssets"
  • Until there. All was good.
  • I have installed Gpt4all on my computer with the "installer for windows" downloaded on their website.
  • I cloned llama.ccp repository and used w64devkit to build it.
  • I downloaded ggml-gpt4all-j-v1.3-groovy.bin and placed it in StreamingAssets\Gpt4All
  • I launched the unity project to see what happen and all worked.
  • But when the chat moves towards the "enter text" in unity, the LLM stops writing its answer in mid-sentence.
  • And I get this error :

ExecutionEngineException: String conversion error: Partial byte sequence encountered in the input.
(wrapper native-to-managed) Gpt4All.LlmWrapper.ResponseCallbackStatic(int,intptr)
Gpt4All.LlmWrapper.Prompt (System.String promptText, Gpt4All.LlmPromptContext context) (at Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:85)
Gpt4All.LlmWrapper+<>c__DisplayClass17_0.b__0 () (at Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:99)
System.Threading.Tasks.Task`1[TResult].InnerInvoke () (at :0)
System.Threading.Tasks.Task.Execute () (at :0)
--- End of stack trace from previous location where exception was thrown ---
Gpt4All.LlmWrapper.PromptAsync (System.String promptText, Gpt4All.LlmPromptContext context) (at Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:100)
Gpt4All.LlmManager.Prompt (System.String rawPrompt) (at Packages/com.gpt4all.unity/Scripts/LlmManager.cs:133)
Gpt4All.Samples.ChatSample.SendToChat (System.String prompt) (at Assets/Samples/1 - Chat/ChatSample.cs:43)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) (at :0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at :0)
UnityEngine.UnitySynchronizationContext.Exec () (at :0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at :0)

Do you have an idea of what it is ?
Did I download and install things correctly ?
And finally, do you know how to use GPU instead of CPU ?

Thanks in advance Macoron !

Error: libllama.dll and libllmodel.dll

I encountered an issue when attempting to add a repository as a Unity Package to my existing project using the Git URL in Unity Package Manager. The error logs indicate that two DLL files, namely libllama.dll and libllmodel.dll, along with their dependencies, could not be loaded.

Steps to Reproduce:
1. Open Unity project.
2. Go to Unity Package Manager.
3. Click on the "+" button and select "Add package from git URL".
4. Enter the Git URL for the repository and proceed.
5. Wait for the package to be imported.
6. Observe the error message related to the DLL files and their dependencies not being loaded.

Error Logs:

  • ../Library/PackageCache/com.gpt4all.unity@548076b369/Plugins/Windows/libllama.dll' because one or more of its dependencies could not be loaded.

  • ../Library/PackageCache/com.gpt4all.unity@548076b369/Plugins/Windows/libllmodel.dll' because one or more of its dependencies could not be loaded.

Unity3D 2022.2.2f1
Win11

Thanks.

** modelPath failing in LlmWrapper fix! **

**Sinds u promote both methods of installing (package manager or cloning/downloading the git)

**add this above async void Awake in LlManager.cs

    // Singleton instance
    public static LlmManager Instance { get; private set; }

**add this inside async void Awake in LlManager.cs

   if (Instance == null)
        {
            Instance = this;
        }
   else
       {
            DestroyImmediate(this);
        }

Put this method in Llmanager.cs:

    public string GetModelPath(string modelPath)
    {
        return Path.Combine(Application.streamingAssetsPath, modelPath);
    }

And this around line 117:

      // correcting faulty path by getting it from one central In-App location
      var path = GetModelPath(modelPath);

Then in LlWrapper.cs around line 202:

        // correcting faulty path by getting it from one central In-App location
        var path = LlmManager.Instance.GetModelPath(modelPath);

Crash during project loading

I've been reported that project may crash during opening in Unity. Still researching why it could be the case, but if you are experiencing something similar, try to checkout this commit:

67aeaab

Please report in this issue if you have this problem and if checkout to other commit helped you.

Doesn't work with 4bit?

Tried using with several ggml bins (some from TheBloke, some from GPT4All) and it seems like this code only works with models not labeled as 4bit? Or am I missing something?

Whisper not loaded and failed to load LLM

Hi Macoron !!!!!!!!!

It seems i found new errors in unity ๐Ÿ˜ข and this time, I took screenshots ๐Ÿ˜ ! I tried to launch the project in a new unity project this morning and poof ๐Ÿ˜ฎ! Here come the errors โ˜น๏ธ ! Take a look at that :

issues

AI respond to the instructions with every prompt

When filling out a larger instruction, the AI starts to pay less attention to the prompt and responds primarily with the instruction in mind.

I tried to fix this by removing the formation of the print input and instead giving it an initial print in init. This worked with smaller instructions but when given a longer instruction it refused to respond.

C# bindings

Is it possible to use these DLLs (libllama.dll, libllmodel.dll) that in your project for a Windows console application using Target Framework .NET 6 or .NET 7 to run gpt4all?

Error loading model

hey getting this error please help

NullReferenceException: Object reference not set to an instance of an object
Gpt4All.LlmManager.InitModel () (at ./Packages/com.gpt4all.unity/Scripts/LlmManager.cs:114)
UnityEngine.Debug:LogException(Exception)
Gpt4All.d__37:MoveNext() (at ./Packages/com.gpt4all.unity/Scripts/LlmManager.cs:121)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(LlmWrapper)
Gpt4All.d__28:MoveNext() (at ./Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:214)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

Request for Simplified Response Format

Problem:
Currently, when interacting with gpt4all, the responses are generated in a conversational format, with character-by-character animated iterations. While this format can be useful for some applications, there are cases where a more simplified response format is desired.

Proposal:
I suggest implementing an option to receive responses from gpt4all as a single, complete text without character iteration. This would make it easier for developers to integrate gpt4all into applications where an animated response is not necessary or preferred.

Thanks.

problema with dll

I Clone the repository to be able to use it, downloaded the models "ggml-mpt-7b-chat" and "ggml-gpt4all-j-v1.3-groovy", I'm using the default one and it seems to take it well, but then it gives me the following error:

DllNotFoundException: libllmodel assembly:<unknown assembly> type:<unknown type> member:(null) Gpt4All.LlmWrapper.InitFromPath (Gpt4All.LlmModelType type, System.String modelPath) (at ./Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:161) Gpt4All.LlmWrapper+<>c__DisplayClass25_0.<InitFromPathAsync>b__0 () (at ./Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:198) System.Threading.Tasks.Task1[TResult].InnerInvoke () (at <5d4cbfbeb62e454f98e19b231866113e>:0)
System.Threading.Tasks.Task.Execute () (at <5d4cbfbeb62e454f98e19b231866113e>:0)
--- End of stack trace from previous location where exception was thrown ---
Gpt4All.LlmWrapper.InitFromPathAsync (Gpt4All.LlmModelType type, System.String modelPath) (at ./Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:199)
Gpt4All.LlmManager.InitModel () (at ./Packages/com.gpt4all.unity/Scripts/LlmManager.cs:111)
UnityEngine.Debug:LogException(Exception)
Gpt4All.d__34:MoveNext() (at ./Packages/com.gpt4all.unity/Scripts/LlmManager.cs:119)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
Gpt4All.d__25:MoveNext() (at ./Packages/com.gpt4all.unity/Scripts/LlmWrapper.cs:199)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

This message appears in the console when I hit play in the editor. I'm not sure if I'm missing a step or doing something wrong. I'm using Unity version 2022.2.9f1. I appreciate any information you can provide.
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.