
phind-codellama AI Models
Phind CodeLlama 是一个基于 CodeLlama 34B 的代码生成模型,并针对指令用例进行了微调。该模型有两个版本:v1 和 v2。v1 基于 CodeLlama 34B 和 CodeLlama-Python 34B。v2 是在 v1 基础上的迭代,基于额外的 15 亿 个高质量编程相关数据进行训练。
ollama run phind-codellama ----------------- ollama run codellama "Write me a function that outputs the fibonacci sequence"
curl -X POST http://localhost:11434/api/generate -d '{
"model": "codellama",
"prompt": "Write me a function that outputs the fibonacci sequence"
}'
指令 - instruct 经过微调,能够以自然语言生成有用且安全的答案python Code Llama 的专门变体,基于 1000 亿个 Python 代码标记进行进一步微调code 代码补全的基础模型
# Ask questions
ollama run codellama:7b-instruct 'You are an expert programmer that writes simple, concise code and explanations. Write a python function to generate the nth fibonacci number.'
# Fill-in-the-middle (FIM) or infill
ollama run codellama:7b-code '<PRE> def compute_gcd(x, y): <SUF>return result <MID>'
# 中间填充 (FIM) 是代码补全模型支持的一种特殊提示格式,可以在两个已编写的代码块之间补全代码。Code Llama 要求使用特定的格式来填充代码:
<PRE> {prefix} <SUF>{suffix}
<PRE>, <SUF> 和 <MID> 是指导模型的特殊标记。
# codellama - Code Review
ollama run codellama '
Where is the bug in this code?
def fib(n):
if n <= 0:
return n
else:
return fib(n-1) + fib(n-2)
'
# codellama - Writing tests
ollama run codellama "write a unit test for this function: $(cat example.py)"
# codellama - Code completion
ollama run codellama:7b-code '# A simple python function to remove whitespace from a string:'
AI 扩展阅读: