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

Generation skipping some characters #10

Closed
nuaimat opened this issue Jan 24, 2024 · 10 comments
Closed

Generation skipping some characters #10

nuaimat opened this issue Jan 24, 2024 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@nuaimat
Copy link

nuaimat commented Jan 24, 2024

Hello

in addition to the other issue i am facing (#9)
whenever i generate text using either cmd+shift+. or cmd+shift+/ the generated text seems to be missing few characters from some words.

notice that i am running plock + ollama : openhermes2.5-mistral

see these two examples

  1. highlighted text: "what is the purpose of life"
    response: The purpose of life is a subjective and philosophical question, with various perspectives based on cultural, religious, and personal beliefs. Some common themes include self-fulfilment, personal growh contributing positvely to societ, and finding meanig i relationships and xperiences. Ulimately, each indivdual mus determine their ow sense o purpose.
    notice the misspelled words:

    • growh instead of growth
    • positvely instead of positively
    • societ instead of society
    • meanig instead of meaning
      all of them are missing one character
  2. highlighted text: "write a one line story about cryptocurrencies "
    response As the world embrace digital currency, ryptocurencies soared an crashed like wavesin a unpredictable sea.
    notice the misspelled words:

    • ryptocurencies instead of cryptocurencies
    • wavesin instead of "waves in"

it's strange that it doesn't happen on all cases. and i am not sure if it has to do with macos throttling typing of generated text or the code logic that transforms the ollama response stream.

asking the same questions to ollama directly:
ollama run openhermes2.5-mistral

  1. prompt: what is the purpose of life
    response: The purpose of life is a subjective and philosophical question that has been debated throughout human history. Different people, cultures, and belief systems offer various answers to this question. Some believe life's purpose is to seek happiness, personal growth, or self-fulfillment. Others may see it as serving a higher power, contributing to society, or finding meaning in relationships and experiences. Ultimately, the purpose of life depends on an individual's values, beliefs, and personal journey.
  2. prompt: write a one line story about cryptocurrencies
    response: In a world ravaged by economic turmoil, cryptocurrencies emerged as a revolutionary digital asset, transforming the financial landscape forever.
@jasonjmcghee
Copy link
Owner

jasonjmcghee commented Jan 24, 2024

This is rough. Is this a dev build? Can you try adding "-- --release" if so? That's really only kicking the problem down the road.

We might need to find a more creative and/or lower level solution.

Or maybe a self-monitoring / self-correction mechanism of some sort.

Other things to try....

  • use "text" instead of "fast_text"
  • Change the delta buffer size (like more than 4)
  • figure out a better way to output text...

@jasonjmcghee jasonjmcghee added bug Something isn't working help wanted Extra attention is needed labels Jan 24, 2024
@nuaimat
Copy link
Author

nuaimat commented Jan 25, 2024

retried compiling with
npm run tauri build '-- --release'
then installed the generated app

and started it via command line, still same issue, some characters are still missing when generating.

@jasonjmcghee
Copy link
Owner

jasonjmcghee commented Jan 26, 2024

I added a new capability to paste the text after it finishes which won't have this problem. But that doesn't have the nice capability of real time streaming.

Another approach could be to pop up a window that it streams to, and then have an easy copy / paste. This would ensure nothing is missed.

See #15

@nuaimat
Copy link
Author

nuaimat commented Jan 26, 2024

whats strange is the generation text on terminal is fine,
see:
plock terminal output:

SELECTION: Some("Searches wikipedia for the given query, then returns the search results. This is a helper function.")
Whole output: def wiki_search(query):
    from bs4 import BeautifulSoup
    import requests
    url = f"https://en.wikipedia.org/wiki/Special:Search/{query}"
    response = requests.get(url)
    soup = BeautifulSoup(response.text, "html.parser")
    return soup.find_all("h3")[1:]

text output in a text editor:

def wiki_search(query):
    from bs4 import BeautifulSoup
    import requests
    url = f"https://en.wikipedia.org/wiki/Special:Search/{query}"
    response = requests.get(url)
    soup = Beautifuloup(response.tex, "html.parse")
    return sou.find_all(h3")[:]

notice "Beautifuloup" is misspelled inside the IDE, but it's fine on the terminal.

i strongly believe this bug has to do with the way the code is fetching response from ollama -> display it on the gui

@jasonjmcghee
Copy link
Owner

Sorry for not being clear- this is 100% enigo causing this issue. Like enigo::fast_text (now using enigo::text which calls it). I think it is either truncating incorrectly or getting io blocked and not confirming it outputted properly.

@jasonjmcghee jasonjmcghee pinned this issue Jan 31, 2024
@kgoodridge
Copy link

Happening to me too. Could you chunk the streaming and do a short sleep between chunks? Totally ignorant guess.

@kengoodridge
Copy link
Contributor

This fixed it for me...

do with it what you will...

https://github.com/jasonjmcghee/plock/pull/20/files

@jasonjmcghee
Copy link
Owner

@kengoodridge / @kgoodridge excited to review it- Welcome to developing plock- happy you’re here!

@jasonjmcghee
Copy link
Owner

enigo-rs/enigo#260

jasonjmcghee added a commit that referenced this issue Feb 3, 2024
…some-characters

#10 generation skipping some characters
@jasonjmcghee
Copy link
Owner

I believe this is fixed - going to cut a new version

@jasonjmcghee jasonjmcghee unpinned this issue Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants