-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for Ollama and adds examples of using various LM providers. This adds a `hf_name` parameter to the `OpenAIModel` class which is helpful when the model name and tokenizer name differ. So we don't need to do this weird hardcoded mapping thing for Databricks models anymore. Tested Ollama by running the operator examples with Ollama running Llama 3B locally on MacBook. Verified that OAI examples still work.
- Loading branch information
Showing
4 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pandas as pd | ||
|
||
import lotus | ||
from lotus.models import OpenAIModel | ||
|
||
lm = OpenAIModel() | ||
|
||
lotus.settings.configure(lm=lm) | ||
data = { | ||
"Course Name": [ | ||
"Probability and Random Processes", | ||
"Optimization Methods in Engineering", | ||
"Digital Design and Integrated Circuits", | ||
"Computer Security", | ||
] | ||
} | ||
df = pd.DataFrame(data) | ||
user_instruction = "{Course Name} requires a lot of math" | ||
df = df.sem_filter(user_instruction) | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pandas as pd | ||
|
||
import lotus | ||
from lotus.models import OpenAIModel | ||
|
||
lm = OpenAIModel( | ||
api_base="http://localhost:11434/v1", | ||
model="llama3.2", | ||
hf_name="meta-llama/Llama-3.2-3B-Instruct", | ||
provider="ollama", | ||
) | ||
|
||
lotus.settings.configure(lm=lm) | ||
data = { | ||
"Course Name": [ | ||
"Probability and Random Processes", | ||
"Optimization Methods in Engineering", | ||
"Digital Design and Integrated Circuits", | ||
"Computer Security", | ||
] | ||
} | ||
df = pd.DataFrame(data) | ||
user_instruction = "{Course Name} requires a lot of math" | ||
df = df.sem_filter(user_instruction) | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pandas as pd | ||
|
||
import lotus | ||
from lotus.models import OpenAIModel | ||
|
||
lm = OpenAIModel( | ||
model="meta-llama/Meta-Llama-3.1-70B-Instruct", | ||
api_base="http://localhost:8000/v1", | ||
provider="vllm", | ||
) | ||
|
||
lotus.settings.configure(lm=lm) | ||
data = { | ||
"Course Name": [ | ||
"Probability and Random Processes", | ||
"Optimization Methods in Engineering", | ||
"Digital Design and Integrated Circuits", | ||
"Computer Security", | ||
] | ||
} | ||
df = pd.DataFrame(data) | ||
user_instruction = "{Course Name} requires a lot of math" | ||
df = df.sem_filter(user_instruction) | ||
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters