Compare commits

...

10 Commits

Author SHA1 Message Date
likelovewant
9a36dc537d Update README.md
edit the download links and guide for use pre-relased version.
2024-05-12 22:27:43 +08:00
likelovewant
9b3b3f6a14 Merge branch 'ollama:main' into main 2024-05-12 21:57:11 +08:00
jmorganca
4ec7445a6f Revert "use post token"
This reverts commit 0fec3525ad.
2024-05-11 22:19:14 -07:00
Michael Yang
0372c51f82 Merge pull request #4369 from ollama/mxyng/post-token
use post token
2024-05-11 19:29:14 -07:00
Michael Yang
0fec3525ad use post token 2024-05-11 19:13:16 -07:00
Jeffrey Morgan
41ba3017fd Fix OpenAI finish_reason values when empty (#4368) 2024-05-11 15:31:41 -07:00
todashuta
8080fbce35 fix ollama create's usage string (#4362) 2024-05-11 14:47:49 -07:00
Michael Yang
ec14f6ceda case sensitive filepaths (#4366) 2024-05-11 14:12:36 -07:00
Daniel Hiltgen
c60a086635 Merge pull request #4331 from dhiltgen/fix_unit
Fix envconfig unit test
2024-05-11 09:16:28 -07:00
Daniel Hiltgen
824ee5446f Fix envconfig unit test 2024-05-10 16:49:48 -07:00
6 changed files with 47 additions and 23 deletions

View File

@@ -14,7 +14,25 @@ Get up and running with large language models locally.
### Windows preview ### Windows preview
[Download](https://ollama.com/download/OllamaSetup.exe) [Download](https://github.com/likelovewant/ollama-for-amd/releases)
For AMD use or build , please follow the guide on [wiki](https://github.com/likelovewant/ollama-for-amd/wiki)
official support list
```
"gfx900" "gfx906:xnack-" "gfx908:xnack-" "gfx90a:xnack+" "gfx90a:xnack-" "gfx940" "gfx941" "gfx942" "gfx1010""gfx1012" "gfx1030" "gfx1100""gfx1101" "gfx1102"
```
Please download from ollama [official](https://ollama.com/download/OllamaSetup.exe)
Example extra list add on this repo.
```
"gfx803" "gfx902" "gfx904""gfx940" "gfx941" "gfx942" "gfx1010" "gfx1011" "gfx1012" "gfx1031" "gfx1032""gfx1034" "gfx1035" "gfx1036" "gfx1103"
```
Please follow the [wiki](https://github.com/likelovewant/ollama-for-amd/wiki) guide to build or use the pre-release version.
Note: `gfx803, gfx1010` reported not working by the wiki method ,expected a future support
### Linux ### Linux

View File

@@ -1050,7 +1050,7 @@ func NewCLI() *cobra.Command {
RunE: CreateHandler, RunE: CreateHandler,
} }
createCmd.Flags().StringP("file", "f", "Modelfile", "Name of the Modelfile (default \"Modelfile\")") createCmd.Flags().StringP("file", "f", "Modelfile", "Name of the Modelfile")
createCmd.Flags().StringP("quantize", "q", "", "Quantize model to this level (e.g. q4_0)") createCmd.Flags().StringP("quantize", "q", "", "Quantize model to this level (e.g. q4_0)")
showCmd := &cobra.Command{ showCmd := &cobra.Command{

View File

@@ -109,7 +109,12 @@ func toChatCompletion(id string, r api.ChatResponse) ChatCompletion {
Choices: []Choice{{ Choices: []Choice{{
Index: 0, Index: 0,
Message: Message{Role: r.Message.Role, Content: r.Message.Content}, Message: Message{Role: r.Message.Role, Content: r.Message.Content},
FinishReason: &r.DoneReason, FinishReason: func(reason string) *string {
if len(reason) > 0 {
return &reason
}
return nil
}(r.DoneReason),
}}, }},
Usage: Usage{ Usage: Usage{
// TODO: ollama returns 0 for prompt eval if the prompt was cached, but openai returns the actual count // TODO: ollama returns 0 for prompt eval if the prompt was cached, but openai returns the actual count
@@ -127,13 +132,16 @@ func toChunk(id string, r api.ChatResponse) ChatCompletionChunk {
Created: time.Now().Unix(), Created: time.Now().Unix(),
Model: r.Model, Model: r.Model,
SystemFingerprint: "fp_ollama", SystemFingerprint: "fp_ollama",
Choices: []ChunkChoice{ Choices: []ChunkChoice{{
{
Index: 0, Index: 0,
Delta: Message{Role: "assistant", Content: r.Message.Content}, Delta: Message{Role: "assistant", Content: r.Message.Content},
FinishReason: &r.DoneReason, FinishReason: func(reason string) *string {
}, if len(reason) > 0 {
}, return &reason
}
return nil
}(r.DoneReason),
}},
} }
} }

View File

@@ -1,20 +1,20 @@
package envconfig package envconfig
import ( import (
"os"
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestConfig(t *testing.T) { func TestConfig(t *testing.T) {
os.Setenv("OLLAMA_DEBUG", "") Debug = false // Reset whatever was loaded in init()
t.Setenv("OLLAMA_DEBUG", "")
LoadConfig() LoadConfig()
require.False(t, Debug) require.False(t, Debug)
os.Setenv("OLLAMA_DEBUG", "false") t.Setenv("OLLAMA_DEBUG", "false")
LoadConfig() LoadConfig()
require.False(t, Debug) require.False(t, Debug)
os.Setenv("OLLAMA_DEBUG", "1") t.Setenv("OLLAMA_DEBUG", "1")
LoadConfig() LoadConfig()
require.True(t, Debug) require.True(t, Debug)
} }

View File

@@ -291,11 +291,9 @@ func (n Name) Filepath() string {
panic("illegal attempt to get filepath of invalid name") panic("illegal attempt to get filepath of invalid name")
} }
return filepath.Join( return filepath.Join(
strings.ToLower(filepath.Join(
n.Host, n.Host,
n.Namespace, n.Namespace,
n.Model, n.Model,
)),
n.Tag, n.Tag,
) )
} }

View File

@@ -276,9 +276,9 @@ func TestFilepathAllocs(t *testing.T) {
allocs := testing.AllocsPerRun(1000, func() { allocs := testing.AllocsPerRun(1000, func() {
n.Filepath() n.Filepath()
}) })
var allowedAllocs float64 = 3 var allowedAllocs float64 = 1
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
allowedAllocs = 5 allowedAllocs = 3
} }
if allocs > allowedAllocs { if allocs > allowedAllocs {
t.Errorf("allocs = %v; allowed %v", allocs, allowedAllocs) t.Errorf("allocs = %v; allowed %v", allocs, allowedAllocs)