mirror of
https://github.com/ollama/ollama-python.git
synced 2026-04-25 08:48:18 +08:00
add infill example
This commit is contained in:
parent
20db23d932
commit
83295d9c2d
22
examples/simple-fill-in-middle/main.py
Normal file
22
examples/simple-fill-in-middle/main.py
Normal file
@ -0,0 +1,22 @@
|
||||
from ollama import generate
|
||||
|
||||
prefix = '''def remove_non_ascii(s: str) -> str:
|
||||
""" '''
|
||||
|
||||
suffix = '''
|
||||
return result
|
||||
'''
|
||||
|
||||
|
||||
response = generate(
|
||||
model='codellama:7b-code',
|
||||
prompt=f'<PRE> {prefix} <SUF>{suffix} <MID>',
|
||||
options={
|
||||
'num_predict': 128,
|
||||
'temperature': 0,
|
||||
'top_p': 0.9,
|
||||
'stop': ['<EOT>'],
|
||||
},
|
||||
)
|
||||
|
||||
print(response['response'])
|
||||
Loading…
Reference in New Issue
Block a user