-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Hello,
I've been using this project to study AI, and I'm also wanting to implement it into a small project and I've written a wrapper around your class to give me easier access. Anyway, in the last update you added some new things, but it also appears to have created a new bug.
In ChatFormat's constructor, you added this:
this.endOfMessage = specialTokens.get("<|eom_id|>");
The problem is that the model you suggest using with this program actually doesn't seem to recognize this special token. This leads to a NullPointerException because all of the special tokens are final variables. For now I just commented it out and it works fine again, but I think you might need to add a way for it to check if it has all of the tokens you're trying to map.
The model I used in this case was Meta-Llama-3-8B-Instruct-Q4_0.gguf
One other minor thing. In the runInteractive() function, you didn't close the in scanner. You can just wrap it in a try() block to make it a little cleaner:
try (Scanner in = new Scanner(System.in)) {}
Anyway, nice work on this. It's super helpful! I'm happy to help out/push some tweaks/handle the above myself if you guys are strapped for time. Thank you!
EDIT:
Also, I want to thank you again for making this. I've been looking for a raw Java approach like this for awhile. I have question as well, since I'm very new to this stuff (and have learned a lot from this class): how would you suggest going about writing code to throw out old tokens/responses when nearing the maxToken limit? I'm wanting to implement this into a game, so I'll need to be able to keep the conversations going without it stopping.