ollama-js icon indicating copy to clipboard operation
ollama-js copied to clipboard

digest mismatch when executing 'create()'

Open anastasiya1155 opened this issue 3 months ago • 2 comments

I have a consistent error when creating a new model based on my local gguf file. This error only happens when creating a first model, i.e. if there are any already loaded models in ollama this does not reproduce. Also, when running this command using ollama cli there is no error, only when using this library. Maybe I am missing some previous steps? Here is my code:

const response = await ollama.create({
	model: 'my-model', modelfile: `FROM ${modelPath}`
});

where modelPath is an absolute path to GGUF file on my machine. This same command works ok with ollama CLI. Response:

Failed to parse error response as JSON
ResponseError: digest mismatch, expected "sha256:06227ae08c77f2f6c8b16931c88510498cbc3c2a0acbb85e62186d614efb3737", got "sha256:9b3e16499cb74ed9e4824383fc96e014028d53e5679b68d4334bbb9df55afd57"
    at file:///Users/<my_path>/node_modules/ollama/dist/utils.js:58:15
    at Generator.next (<anonymous>)
    at fulfilled (file:///Users/<my_path>/node_modules/ollama/dist/utils.js:4:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  error: 'digest mismatch, expected "sha256:06227ae08c77f2f6c8b16931c88510498cbc3c2a0acbb85e62186d614efb3737", got "sha256:9b3e16499cb74ed9e4824383fc96e014028d53e5679b68d4334bbb9df55afd57"',
  status_code: 400
}

Steps to reproduce:

  1. Install and run ollama
  2. Make sure there are no models loaded by running ollama list (important)
  3. Create a new ollama model by using this library create() method

anastasiya1155 avatar Mar 06 '24 15:03 anastasiya1155

            const response = await ollama.create({
                model: Core.model_name,
                modelfile: Core.modelfile,
            });

Same here.

ResponseError: digest mismatch, expected "sha256:c2ca99d853de276fb25a13e369a0db2fd3782eff8d28973404ffa5ffca0b9267", got "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a"

I only get this while using the ollama package, POST-ing to the API works good though.

sha256 is absolutely the same:

wolf@wolf-mint:/usr/share/ollama/.ollama/models/okuu$ sha256sum Meta-Llama-3-8B-Instruct.Q6_K.gguf 
c2ca99d853de276fb25a13e369a0db2fd3782eff8d28973404ffa5ffca0b9267  Meta-Llama-3-8B-Instruct.Q6_K.gguf

YozoraWolf avatar May 01 '24 03:05 YozoraWolf

Hey all, an update here. This is a bug in the ollama-js library. The problem stems from this bit of code that attempts to open a stream to upload the file: https://github.com/ollama/ollama-js/blob/main/src/index.ts#L93

It's getting closed early so the checksum isn't correct. I'm still working on this, but if anyone has any ideas of a good fix please let me know.

BruceMacD avatar May 01 '24 21:05 BruceMacD