ValueFX9507 commited on
Commit
a574fc1
·
verified ·
1 Parent(s): f606485

Upload 2 files

Browse files
AutoInstall/Model_install_backup.mf ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ���滻��һ��Ϊģ��·��
2
+ TEMPLATE """
3
+ {{ if .Messages }}
4
+ {{- if or .System .Tools }}<|im_start|>system
5
+ {{ .System }}
6
+ {{- if .Tools }}
7
+
8
+ # Tools
9
+
10
+ You are provided with function signatures within <tools></tools> XML tags:
11
+ <tools>{{- range .Tools }}
12
+ {"type": "function", "function": {{ .Function }}}{{- end }}
13
+ </tools>
14
+
15
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
16
+ <tool_call>
17
+ {"name": <function-name>, "arguments": <args-json-object>}
18
+ </tool_call>
19
+ {{- end }}<|im_end|>
20
+ {{ end }}
21
+ {{- range $i, $_ := .Messages }}
22
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
23
+ {{- if eq .Role "user" }}<|im_start|>user
24
+ {{ .Content }}<|im_end|>
25
+ {{ else if eq .Role "assistant" }}<|im_start|>assistant
26
+ {{ if .Content }}{{ .Content }}
27
+ {{- else if .ToolCalls }}<tool_call>
28
+ {{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
29
+ {{ end }}</tool_call>
30
+ {{- end }}{{ if not $last }}<|im_end|>
31
+ {{ end }}
32
+ {{- else if eq .Role "tool" }}<|im_start|>tool
33
+ <tool_response>
34
+ {{ .Content }}
35
+ </tool_response><|im_end|>
36
+ {{ end }}
37
+ {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
38
+ {{ end }}
39
+ {{- end }}
40
+ {{- else }}
41
+ {{- if .System }}<|im_start|>system
42
+ {{ .System }}<|im_end|>
43
+ {{ end }}{{ if .Prompt }}<|im_start|>user
44
+ {{ .Prompt }}<|im_end|>
45
+ {{ end }}<|im_start|>assistant
46
+ {{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}"""
47
+ PARAMETER stop "<|im_start|>"
48
+ PARAMETER stop "<|im_end|>"
AutoInstall/自动安装-放到模型目录运行(目录必须是英文).CMD ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+
4
+ :: ���� 1�����Ollama�Ƿ�װ
5
+ echo ���ڼ��Ollama�Ƿ�װ...
6
+ where ollama >nul 2>nul
7
+ if %errorlevel% neq 0 (
8
+ echo [����] Ollamaδ��װ��δ����PATH��������
9
+ echo ���ȷ��� https://ollama.ai/download ���ذ�װ
10
+ pause
11
+ exit /b 1
12
+ )
13
+ echo Ollama�Ѱ�װ��������һ��...
14
+
15
+ :: ���� 2��ɨ�赱ǰĿ¼�µ�GGUF�ļ�
16
+ echo ����ɨ�赱ǰĿ¼�µ�GGUFģ���ļ�...
17
+ set file_count=0
18
+ for /f "delims=" %%i in ('dir /b *.gguf 2^>nul') do (
19
+ set /a file_count+=1
20
+ set "file_!file_count!=%%i"
21
+ )
22
+
23
+ if %file_count% equ 0 (
24
+ echo [����] ��ǰĿ¼δ�ҵ��κ�.gguf�ļ�
25
+ echo �뽫ģ���ļ�����ͬһĿ¼�������б��ű�
26
+ pause
27
+ exit /b 1
28
+ )
29
+
30
+ :: ���� 3����ʾ����ģ���б�
31
+ echo ����%file_count%������ģ�ͣ�
32
+ for /l %%i in (1,1,%file_count%) do (
33
+ echo [%%i] !file_%%i!
34
+ )
35
+
36
+ :: ���� 4���û�ѡ��ģ��
37
+ :select
38
+ set /p "choice=������ģ�ͱ��(1-%file_count%)��"
39
+ echo ������֤����...
40
+ set /a "choice=!choice!" 2>nul
41
+ if not defined choice (
42
+ echo ���������ֱ�ţ�
43
+ goto select
44
+ )
45
+ if !choice! lss 1 (
46
+ echo ��Ų���С��1��
47
+ goto select
48
+ )
49
+ if !choice! gtr %file_count% (
50
+ echo ��Ų��ܴ���%file_count%��
51
+ goto select
52
+ )
53
+
54
+ :: ��ȡ�û�ѡ���ģ���ļ���
55
+ set "selected_file=!file_%choice%!"
56
+
57
+ :: ���� 5����ȡģ�͵�����·��
58
+ for %%i in ("%cd%\%selected_file%") do set "full_path=%%~fi"
59
+ echo ��ѡ��ģ�ͣ�!selected_file!
60
+ echo ģ������·����!full_path!
61
+
62
+ :: ���·���Ƿ���Ч
63
+ if not exist "!full_path!" (
64
+ echo [����] ģ��·����Ч���ļ������ڣ�
65
+ pause
66
+ exit /b 1
67
+ )
68
+
69
+ :: ���� 6������ģ������
70
+ :input_name
71
+ set /p "model_name=������ģ������(����Сд��ĸ+�»���)��"
72
+ if not defined model_name (
73
+ echo ���Ʋ���Ϊ�գ�
74
+ goto input_name
75
+ )
76
+
77
+ :: ���� 7������Modelfile�ļ�
78
+ echo ��������Modelfile�����ļ�...
79
+
80
+
81
+ :: ����
82
+ set "search=FROM ���滻��һ��Ϊģ��·��"
83
+ set "replace=FROM !full_path!"
84
+
85
+ del /q Model_install.mf
86
+ :: ��ȡ�ļ����ݵ�һ������
87
+ set "file=Model_install_backup.mf"
88
+ for /f "delims=" %%i in ('type "%file%"') do (
89
+ set "line=%%i"
90
+ :: �滻Ŀ����
91
+ if "!line!"=="%search%" (set "line=%replace%")
92
+ echo !line!>>Model_install.mf
93
+ )
94
+
95
+
96
+ echo ���ڵȴ�������ɣ����Ժ�...
97
+ timeout /t 1 >nul
98
+
99
+ :: ����ļ��Ƿ����ɳɹ�
100
+ if not exist Model_install.mf (
101
+ echo [����] �޷����������ļ���
102
+ echo ����ԭ��
103
+ echo 1. ���̿ռ䲻��
104
+ echo 2. û��дȨ��
105
+ pause
106
+ exit /b 1
107
+ )
108
+ cls
109
+ echo �����ļ�������ϣ��Ѿ�������µ������
110
+ echo �븴�������������
111
+ echo.
112
+
113
+ echo -------------------------------------------------------------------
114
+ echo �����Զ����а�װ�����ʧ�����ֶ����У�ollama create %model_name% -f "%cd%\Model_install.mf"
115
+ echo -------------------------------------------------------------------
116
+ ollama create %model_name% -f "%cd%\Model_install.mf"
117
+ echo.
118
+ echo �ȴ���װ��ɺ�����������������ģ��
119
+ echo.
120
+ echo -------------------------------------------------------------------
121
+ echo ollama run %model_name%
122
+ echo -------------------------------------------------------------------
123
+ echo.
124
+ :: ���
125
+ echo �����رձ�����
126
+ pause