add infill example

This commit is contained in:
Michael Yang
2023-12-21 09:17:08 -08:00
parent 20db23d932
commit 83295d9c2d
+22
View 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'])