
ClineïŒããŒã«ã«çDeepSeek R1ã§AIã³ãŒãã£ã³ã°ãäœ¿ãæŸé¡ã«ããïŒé«ã¹ããã¯ãã·ã³åãïŒ
ããŽãŽãŽïŒ
Vtuberã®ããŽã¡ãã (https://www.youtube.com/@CP-chan) ã§ãã
é
ä¿¡ã§ã¯ã²ãŒã ã®è©±ããããŠãŸããããä»åã¯AIã«é¢ããé£èŒãšããããšã§ããŒã«ã«ç°å¢ïŒæå
ã®ãã·ã³ïŒã§åãããAIã®è©±ãããŠãããŸãã
第äžåŒŸãDeepSeek R1ãã»ãŒæºåãªãããããŒã«ã«GPUã§åãã
第äºåŒŸãæ¬èšäºãClineïŒããŒã«ã«çDeepSeek R1ã§AIã³ãŒãã£ã³ã°ãäœ¿ãæŸé¡ã«ããïŒé«ã¹ããã¯ãã·ã³åãïŒ
第äžåŒŸãGPUãªãã§ãåãïŒããŒã«ã«LLMãšllama.vscodeã§ã³ãŒãè£å®
ä»åã¯é£èŒã®ç¬¬äºåŒŸã§ãã
LLMãããŒã«ã«ã«ã€ã³ã¹ããŒã«ãã倧ããªã¡ãªãããšããŠãAPIå¶éãåŸé課éããè§£æŸãããŠLLMããäœ¿ãæŸé¡ãã«ãªããšããç¹ããããŸãã
DeepSeekã¯äžäžä»£åã®V3ãªãWebã§äœ¿ã£ãŠããããªã«é«ããªãã®ã§ãã (https://api-docs.deepseek.com/quick_start/pricing) ããã£ããäœ¿ãæŸé¡ãªã®ã§ããããAIã³ãŒãã£ã³ã°ãšãŒãžã§ã³ãã®Clineãå©çšããŠããŒã«ã«ã§ã³ãŒããçæã§ããããã«ããŸãããã
泚æç¹
æ¬èšäºã¯ãã€ãšã³ãPCåãã§ãã
èªåã®ç°å¢ (RTX 3080 + 32GB RAM) ã§ã¯åããã©ã¹ã ãŒãºã§ã¯ãªãããããã§ãã
7Bã®ã¢ãã«ã ãšæ¬åœã«å
šç¶åœ¹ã«ç«ããªãã®ã§ãæäœã§ã倧ããã³ã³ããã¹ããŠã£ã³ããŠã§14Bã¢ãã«ãåãããªããã·ã³ã®å Žåã¯çŽ çŽã«OpenAI, Anthropic, DeepSeekçã®å¥œããªAPIã«èª²éããæ¹ã幞ãã ãšæããŸãã
第äžåŒŸã®èšäºã§ç޹ä»ããŠãã llama.vscode ãªããã³ãŒãè£å®ããã§ããŸãããã¡ãã£ãšããããŒãPCãããã®ã¹ããã¯ã§ãåãããŸãã
Clineãšã¯
Clineã¯VSCodeã®æ¡åŒµæ©èœãšããŠå©çšã§ããAIããŒã«ã§ãLLMãèªåã§æ¹éãæ€èšããã³ãŒãããã¡ã€ã«ãäœæã»ç·šéããã¢ããªã±ãŒã·ã§ã³ãäœæããŠããã倢ã®ããŒã«ã§ãã
ãã¡ããéäžã§äººéãæ¹éãæç€ºããããœãŒã¹ã³ãŒããçŽæ¥ç·šéãããããããšãã§ããŸãã詳ããã¯ãã®ãããã®èšäºãèªãã§ãã ããã
ä»åã¯åã®ããŽã¡ããã®èšäºãå®è¡æžã¿ã§ããç¶æ ãæ³å®ããClineã®ã€ã³ã¹ããŒã«ãšããŒã«ã«ã¢ãã«ãžã®å¯Ÿå¿ãè¡ããŸãã
ç°å¢
Windows 11
ã¡ã€ã³ã¡ã¢ãª 32GBïŒãã£ãšå°ãªããŠãåããã©é ããªãïŒ
GPU NVIDIA RTX 3080 VRAM 10GBïŒãã£ãšäœã¹ããã¯ã§ãåããã©é ããªãïŒ
llama.cppãã€ã³ã¹ããŒã«ããŠãã
ã¢ãã«ã®ggufãã¡ã€ã«ãå ¥æã§ãã
æ¬èšäºã§ã¯ DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.gguf ã䜿ããŸãã
ä»ã®ã¢ãã«ã§ãçè«äžã¯åäœããã®ã§ããã7Bã®ã¢ãã«ã ãšLLMãClineã®åºåãã©ãŒããããå®ããªãããã§æ£ããåããŠãããŸããã
ååã®èšäºãããããªãéãèšå®ã§åããã®ã§ãã®ãªã®ãªã®ã¢ãã«ãµã€ãºã§åãããŠãã人ã¯éååã®ã¬ãã«ã調æŽããŠãã ããã
1. VSCodeã®ã€ã³ã¹ããŒã«
ããããããŠã³ããŒãã§ããŸãããã§ã«ã€ã³ã¹ããŒã«æžã¿ã®äººã¯é£ã°ããŠãã ããã
2. Ollama ã®ã€ã³ã¹ããŒã«
Ollama ã¯LLMãåãããšã³ãžã³ã§ããClineã¯Ollamaãšã³ãžã³ã«å¯Ÿå¿ããŠãããOllama ãéããŠããŒã«ã«ã¢ãã«ãèªã¿èŸŒãããšã§ããŒã«ã«LLMã«ã³ãŒããæžãããããšãã§ããŸãã
ããããã€ã³ã¹ããŒã«ã§ããŸãã

3. ã¢ãã«ãOllamaã«ç»é²
Ollama ã䜿ãããã«ãææã¡ã®ggufã¢ãã«ãèªã¿èŸŒãã§ç»é²ããŸãã
ãŸããggufãã¡ã€ã«ãšåããã©ã«ãã«ã¢ãã«ã®å®çŸ©ãšãªãã¢ãã«ãã¡ã€ã«ãäœæããŸãã
ä»åã¯DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.model ãšããååã«ããŸããæ¡åŒµåã¯äœã§ããããäžèº«ã¯ä»¥äžã®éãã®ããã¹ããã¡ã€ã«ã§ãã
FROM DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.gguf
PARAMETER temperature 0.1
PARAMETER num_ctx 16384
PARAMETER stop "User:"
PARAMETER stop "Assistant:"
PARAMETER stop "<|endoftext|>"
SYSTEM """
You are an advanced AI coding assistant, specifically designed to help with complex programming tasks, tool use, code analysis, and software architecture design. Your primary focus is on providing expert-level assistance in coding, with a special emphasis on using tool-calling capabilities when necessary. Here are your key characteristics and instructions:
1. Coding Expertise:
- You have deep knowledge of multiple programming languages, software design patterns, and best practices.
- Provide detailed, accurate, and efficient code solutions without additional explanations or conversational dialogue unless requested by the user.
- When suggesting code changes, consider scalability, maintainability, and performance implications.
2. Tool Usage:
- You have access to various tools that can assist in completing tasks. Always consider if a tool can help in your current task.
- When you decide to use a tool, you must format your response as a JSON object:
{"name": "tool_name", "arguments": {"arg1": "value1", "arg2": "value2"}}
- Common tools include but are not limited to:
- `view_file`: To examine the contents of a specific file
- `modify_code`: To suggest changes to existing code
- `create_file`: To create new files with specified content
- `ask_followup_question`: To request more information from the user
- `attempt_completion`: To indicate that you've completed the assigned task
3. Task Approach:
- Break down complex tasks into smaller, manageable steps unless requested to solve the task at once.
- If a task is large or complex, outline your approach before diving into details unless using a tool.
- Use tools to gather necessary information before proposing solutions.
4. Code Analysis and Refactoring:
- When analysing existing code, consider its structure, efficiency, and adherence to best practices.
- Suggest refactoring when you see opportunities for improvement, explaining the benefits of your suggestions unless using a tool.
- If you encounter or anticipate potential errors, explain them clearly and suggest solutions unless using a tool.
- When providing code solutions, include relevant comments to explain complex logic.
- Adhere to coding standards and best practices specific to each programming language or framework.
- Suggest optimisations and improvements where applicable.
5. Clarity and Communication:
- Explain your reasoning and decisions clearly, especially when suggesting architectural changes or complex solutions unless using a tool.
- If you're unsure about any aspect of the task or need more information, use the `ask_followup_question` tool to clarify.
Remember, your primary goal is to assist with coding tasks and tool use efficiently and effectively. Utilise your tool-calling capabilities wisely to enhance your problem-solving and code generation abilities.
"""
TEMPLATE """
{{- if .Suffix }}<|fim_prefix|>{{ .Prompt }}<|fim_suffix|>{{ .Suffix }}<|fim_middle|>
{{- else if .Messages }}
{{- if or .System .Tools }}<|im_start|>system
{{- if .System }}
{{ .System }}
{{- end }}
{{- if .Tools }}
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{{- range .Tools }}
{"type": "function", "function": {{ .Function }}}
{{- end }}
</tools>
For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{"name": <function-name>, "arguments": <args-json-object>}
</tool_call>
{{- end }}<|im_end|>
{{ end }}
{{- range $i, $_ := .Messages }}
{{- $last := eq (len (slice $.Messages $i)) 1 -}}
{{- if eq .Role "user" }}<|im_start|>user
{{ .Content }}<|im_end|>
{{ else if eq .Role "assistant" }}<|im_start|>assistant
{{ if .Content }}{{ .Content }}
{{- else if .ToolCalls }}<tool_call>
{{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
{{ end }}</tool_call>
{{- end }}{{ if not $last }}<|im_end|>
{{ end }}
{{- else if eq .Role "tool" }}<|im_start|>user
<tool_response>
{{ .Content }}
</tool_response><|im_end|>
{{ end }}
{{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
{{ end }}
{{- end }}
{{- else }}
{{- if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}
"""
èšäºã®æåŸã«ã¢ãã«ãã¡ã€ã«ã®ç°¡åãªèª¬æãä»ããŠãããŸãã
Ollama ã«ç»é²ãããã«ã¯ãååã€ã³ã¹ããŒã«ããw64devkitãèµ·åããã¢ãã«ãã¡ã€ã«ãããå Žæã«ç§»åããŸãã
ollama create DeepSeek-R1-14B-Q4_K_M -f DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.modelDeepSeek-R1-14B-Q4_K_M ã¯ã¢ãã«åã§ãã奜ããªååãä»ããããšãã§ããŸãã -f ã§ ã¢ãã«ãã¡ã€ã«ãæå®ããŸãã
success ãšè¡šç€ºããããæåã§ããç¶ããŠã
ollama serveã§OllamaãµãŒããŒãèµ·åããŠãããŸãã ããã©ã«ãã§ã¯ localhost:11434 ã§èµ·åããŸããç°å¢å€æ°OLLAMA_HOSTã§å¥ã®ãã¹ãã§èµ·åã§ããŸãã
4. Clineã®ã€ã³ã¹ããŒã«
VSCodeãèµ·åããããå·Šã®ã¿ãã®æ¡åŒµæ©èœ/Extensions ïŒâ¡ã4åãããã€ïŒ ããæ¡åŒµæ©èœãæ€çŽ¢ããŸããCline ãšæ€çŽ¢ããŠã€ã³ã¹ããŒã«ããŸãã

ã€ã³ã¹ããŒã«ãããšãå·ŠåŽã«ããã¿ãããªClineã®ã¢ã€ã³ã³ã®ã¿ããåºãŠããŸããClineã®ã¢ã€ã³ã³ãæŒããŠèšå®ã«é²ã¿ãŸãã

èšå®ç»é¢ã§ã¯ããŸã API Providerã«Ollamaãéžã³ãŸãã
Ollama ãããã©ã«ãèšå®ã§èµ·åããŠããã°ãBase URLã¯å€æŽããå¿
èŠã¯ãããŸããã
Model IDããDeepSeek-R1-14B-Q4_K_M:latestãªã©ãèªåãç»é²ããã¢ãã«ãéžã³ãŸããèšå®ãçµãã£ããDoneãæŒããèšå®ãçµäºããŸãã
ç¶ããŠãäžã« Auto-approve: None ããããŸããããã©ã«ãã§ã¯ã»ãšãã©ããããæäœã«å¯ŸããŠäººéã«èš±å¯ãæ±ããŠããŸããããããæŒããŠåèšå®ã«ãã§ãã¯ãå
¥ãããšãèªåã§æ¿èªã§ããŸãã
å®å
šã«èªååãããå Žåã¯ãã¹ãŠã«ãã§ãã¯ãå
¥ããã°ããã®ã§ãããLLMã誀ã£ãã³ãŒããã³ãã³ããå®è¡ãããšPCã®ããŒã¿ãç Žå£ãããå¯èœæ§ããããŸãã䜿ãå Žåã¯æ³šæããŠãã ããã
ãŸããäžã«ã¯Max Requests: 20 ãšããèšå®ããããŸããé£ç¶ããŠå®è¡ããAPIãªã¯ãšã¹ãã®åæ°ã§ããããè¶
ãããšãã®ãŸãŸç¶è¡ããŠãããèš±å¯ãæ±ããŠããŸããé«é¡ãªAPIå©çšæãè«æ±ãããªãããã®èšå®ã§ãããããŒã«ã«LLMã¯äœ¿ãæŸé¡ãªã®ã§ãæ°åãã100ãããã«èšå®ããŠã¿ãŠãããã§ãããã
Enable Notificationsã«ãã§ãã¯ãå
¥ãããšãå®è¡çµäºæãLLMãå®è¡ã®èš±å¯ãæ±ããŠããæã«éç¥ãéã£ãŠããŸãã奜ã¿ã§ONã«ããŠãã ããã
å人çãªåå¿è
åãããããèšå®ãäžã«ç€ºããŠãããŸãã
Edit filesãšUse MCP serversãOFFããã以å€ONã§ãã

5. 䜿ã£ãŠã¿ã
å·Šäžã®+ãã¿ã³ãNew Taskããã¿ã¹ã¯ãäœæã§ããŸããèšå®ã®æ¯è»ã®å·Šã«ããåè§+å³äžç¢å°ã¿ãããªã¢ã€ã³ã³ãã¯ãªãã¯ãããšãå³åŽã®æ ã§å®è¡ç¶æ³ãèŠãããšãã§ããŸãã
ã¢ãŒãã«ã¯PlanãšActããããPlanã§ã¯æœè±¡çãªã¿ã¹ã¯ãèšèªåãããèšèšããŸãšãããããããšãã§ããŸããActã§ã¯å®éã«éçºãè¡ããŸãã

äŸãã°ã
"çŸåšã®ãã£ã¬ã¯ããªã« test.py ãäœæããpythonã§Hello Worldãèšè¿°ããŠãã ãããtest.py ãå®è¡ããå®è¡çµæãoutput.txt ã«æ ŒçŽããŠãã ããã"
ãªã©ã®æä»€ãActã¢ãŒãã§è¡ããšãæ©èœãã¡ãããšåããŠããã確èªããããšãã§ããŸãããã ããè€éãªã¿ã¹ã¯ãå®è¡ãããšè¶
äœéã«ãªã£ãããã¢ãã«ãClineã®åºå圢åŒãå¿ããŠãšã©ãŒã«ãªã£ããããŸãã
PCãé«ã¹ããã¯ãªã32Bã®ã¢ãã«ã«ãããéååã¬ãã«ãæ¹åãããã³ã³ããã¹ããŠã£ã³ããŠã20480ã«ãããããããšã§è§£æ±ºããå¯èœæ§ã¯ãããŸãããã¹ããã¯äžè¶³ã®å Žåã¯çŽ çŽã«OpenAI, Anthropic, DeepSeekçã®å¥œããªAPIã«èª²éããæ¹ã幞ãã ãšæããŸãã
ã¢ãã«ãã¡ã€ã«ã®èª¬æ
FROM è¡ã§ .ggufãã¡ã€ã«ãæå®ããŸããéããã¡ã€ã«åã®å ŽåãããæžãæããŸãã
Clineã¯å éšã§ããªãé·ãããã³ãããå®è¡ããããã§ãã³ã³ããã¹ããŠã£ã³ããŠïŒåæã«èŠããŠãããããŒã¯ã³æ°ïŒã16384ã«èšå®ããŸãã
RTX4090ãšããæã£ãŠã人ã§ããšã©ãŒçãæžãããããªã20480ããããããããŸããããã¶ã3080ã§ã¯20480ã¯ç¡çã§ããã·ã¹ãã ããã³ãããštemplateïŒClineã®ããŒã«ã®äœ¿ãæ¹ïŒãtemperatureãªã©ã¯ãClineåãã®qwen2.5-coderãåèã«èšå®ããŸãã (hhao/qwen2.5-coder-tools)