emacs-copilot icon indicating copy to clipboard operation
emacs-copilot copied to clipboard

Doing vfork: Exec format error

Open erwagasore opened this issue 1 year ago • 7 comments

I am using macOS M2 and I have followed the installation process. But I am facing an error when attempted to run the command copilot-complete with keybinding C-c C-k. The screenshots bellow are highlighting the issue

  • I just runned the command and at the bottom you can see the error in the minibuffer Screenshot 2024-01-20 at 14 11 29

  • In the buffer below there is a prompt file generate Screenshot 2024-01-20 at 14 11 58

  • I have both Q3 and Q5 llamafiles which are executable and in the executable path Screenshot 2024-01-20 at 14 12 19

I tried to read on Hacker News but since I am very inexperience with regard to llamafiles I would appreciate to have a step by step guide to fix this issue. Thanks

erwagasore avatar Jan 20 '24 12:01 erwagasore

having the same issue on MacOS M1 using wizardcoder-python-34b-v1.0.Q5_K_M.llamafile

zzhjerry avatar Feb 14 '24 13:02 zzhjerry

Change binary name to "sh" and use llama file as a parameter to a program

locutus3009 avatar Feb 19 '24 11:02 locutus3009

@locutus3009 I am not that knowledgable on this. Can you please elaborate on this. Maybe with an example. Thank you

erwagasore avatar Feb 28 '24 15:02 erwagasore

@erwagasore Here's how to do the change that @locutus3009 is proposing. Change defcustom copilot-bin in the buffer that contains the code to run eval-buffer on to:

(defcustom copilot-bin
  "sh"
  "Path of llamafile executable with LLM weights."
  :type 'string
  :group 'copilot) 

and in the same buffer, change the call-process block to

      (call-process copilot-bin nil (list (current-buffer) nil) t
                    "wizardcoder-python-34b-v1.0.Q3_K_M.llamafile"
                    "--prompt-cache" cash
                    "--prompt-cache-all"
                    "--silent-prompt"
                    "--temp" "0"
                    "-c" "1024"
                    "-ngl" "35"
                    "-r" "```"
                    "-r" "\n}"
                    "-f" hist))

However, I still can't get this to work even when using sh and ape (as explained by @jart here) to execute the llamafile. When I call the copilot-complete function in a code buffer, emacs spins for a while (like it's loading up the llamafile), but then outputs nothing.

I'm on M3 Silicon, using zsh 5.9, and emacs 29.1.

feldrick avatar May 01 '24 12:05 feldrick

(defcustom copilot-bin
  "sh"
  "Path of llamafile executable with LLM weights."
  :type 'string
  :group 'copilot) 

and in the same buffer, change the call-process block to

      (call-process copilot-bin nil (list (current-buffer) nil) t
                    "wizardcoder-python-34b-v1.0.Q3_K_M.llamafile"
                    "--prompt-cache" cash
                    "--prompt-cache-all"
                    "--silent-prompt"
                    "--temp" "0"
                    "-c" "1024"
                    "-ngl" "35"
                    "-r" "```"
                    "-r" "\n}"
                    "-f" hist))

However, I still can't get this to work even when using sh and ape (as explained by @jart here) to execute the llamafile. When I call the copilot-complete function in a code buffer, emacs spins for a while (like it's loading up the llamafile), but then outputs nothing.

I had to add-c as first argument followed by the llamafile executable as the next one. However, the llamafile ran as a server instead of returning the completions in the buffer.

spilornis avatar Jul 24 '24 09:07 spilornis

@feldrick I have a similar outcome, but instead it OOMs even with the 13b model; I'm on an Mac Pro M3 as well

edit: nvm 13b works for me with ape! No luck with anything larger

govi218 avatar Sep 09 '24 07:09 govi218

I too was getting the vfork error, in my case, I made the llamafile a native executable using the assimilate command for my platform as referenced here: https://github.com/jart/emacs-copilot/issues/2#issuecomment-1872986072

However, in my case, I also had to remove the caching flags

                    "--prompt-cache" cash
                    "--prompt-cache-all"

from the copilot.el because of this issue: https://github.com/jart/emacs-copilot/issues/12

programmer-ke avatar Jan 08 '25 11:01 programmer-ke