LostRuins / koboldcpp

Run GGUF models easily with a KoboldAI UI. One File. Zero Install.
https://github.com/lostruins/koboldcpp
GNU Affero General Public License v3.0
4.66k stars 334 forks source link

When selecting a stop sequence without API access, "GET /sw.js HTTP/1.1" returns 404 and soft-locks koboldcpp until the stop sequence is removed. #131

Closed bucketcat closed 1 year ago

bucketcat commented 1 year ago

Took a while to figure this out. Adding a string which outputs something like "Read the tooltip, dummy. Requires Kobold API..." to console, or having stop sequences be ignored if API authentication can't be established could be possible solutions.

Nevertheless, removing the stop sequence and refreshing the browser resolved the issue.

Mostly leaving this here since it might help someone trying to diagnose the same issue, I.e. a tendency to ignore tooltips. Feel free to close it as is, since this is technically user error on my end.

LostRuins commented 1 year ago

I don't really understand - adding a stop token should not soft lock koboldcpp. How does it happen and what did you use for the stop token?

bucketcat commented 1 year ago

I used "Chapter". It caused GET /sw.js HTTP/1.1 to 404 when loading the browser, restarting koboldcpp, swapping browser, trying in FF debugging mode, FF offline mode, cache clear + reload. No matter what I got GET /sw.js HTTP/1.1 404. Maybe unrelated, but the various JS files loaded in different orders every time.

I could load up the dev tools and monitor the network traffic if you want the specific packets/api calls?

I tried it several times and it was the stop sequence that broke the service worker. Be it in the middle of run time, or on boot. And it persisted through sessions/reboots until I removed it.

Any specific logs or info that you want while I'm at it?

bucketcat commented 1 year ago

Looking at the stack-trace, it fails compiling entirely immediately returning on pressing generate, reloading the page or doing anything besides editing the text.

Uncaught TypeError: _.stop_sequence is undefined
    submit_generation http://localhost:26001/:29
    onclick http://localhost26001/:1

in console:

127.0.0.1 - - [01/May/2023 22:23:00] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [01/May/2023 22:23:01] "GET /api/v1/model HTTP/1.1" 200 -
127.0.0.1 - - [01/May/2023 22:23:01] "GET /api/v1/info/version HTTP/1.1" 200 -
127.0.0.1 - - [01/May/2023 22:23:01] "GET /sw.js HTTP/1.1" 404 -

When refreshing the page, I don't get the error but sw.js still returns 404.

Edit: Nothing else interesting in console, cosmetic stuff failing, the cloudflare telemetry failing to load due to being firewalled etc.

Removing the single stop sequence immediately resolves it.

Edit 2: It's a null pointer exception. Dunno how it works with javascript, but could it perhaps be related to capitalization? So something like string.equals() rather than string.equalsIgnoreCase() (java syntax) resulting in it returning null and throwing the exception? I did capitalize the C in Chapter.

LostRuins commented 1 year ago

Hi, this should be fixed in the latest version. Can you help check?

bucketcat commented 1 year ago

Will do! I'll edit this comment with the findings.

Edit: Yup, working fine now! Closed, and cheers for the quick fix!