Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickstartguided #416

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions examples/quickstart_guided.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
client = Client(big_model='pythia', small_model='pythia')

# Put in your prompt and go!
# response = client.complete(prompt = 'Is 1+1=10000?',
# context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False, regex=r"\s*([Yy]es|[Nn]o|[Nn]ever|[Aa]lways)")
#response = client.complete(prompt = 'Is 1+1=10000?', context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False, regex=r"\s*([Yy]es|[Nn]o|[Nn]ever|[Aa]lways)")
# print(response)
# response = client.complete(prompt = 'Did MJ win 6 titles with the Bulls',
# context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False,choices=["Hell yeah dude that's correct","No way, that's hella false"])
#response = client.complete(prompt = 'Did MJ win 6 titles with the Bulls', context='', openai_key=settings.openai_api_key, finetune = False, data_synthesis = False,choices=["Hell yeah dude that's correct","No way, that's hella false"])
# print(response)
response = client.complete(prompt = 'What does 1+1 equal?',
context='', openai_key=settings.openai_api_key, finetune = True, data_synthesis = True, type="integer")
response = client.complete(prompt = 'What does 1+1 equal?',context='', openai_key=settings.openai_api_key, finetune = True, data_synthesis = True, type="integer")
print(response)

18 changes: 16 additions & 2 deletions src/llm_vm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ def complete(self, prompt,
stoptoken = None,
tools = None,
openai_kwargs = {},
hf_kwargs = {}):
hf_kwargs = {},
type = None,
choices = None,
regex = None):
"""
This function is Anarchy's completion entry point

Expand Down Expand Up @@ -143,12 +146,23 @@ def complete(self, prompt,
kwargs.update({"temperature":temperature})
if stoptoken is not None:
kwargs.update({"stop":stoptoken})

if regex is not None:
kwargs.update({"regex":regex})
if type is not None:
kwargs.update({"type":type})
if choices is not None:
kwargs.update({"choices":choices})
else:
kwargs = hf_kwargs
if temperature > 0:
kwargs.update({"do_sample": True})
kwargs.update({"temperature":temperature})
if regex is not None:
kwargs.update({"regex":regex})
if type is not None:
kwargs.update({"type":type})
if choices is not None:
kwargs.update({"choices":choices})

if openai_key is not None:
self.openai_key = openai_key
Expand Down