Comments (5)
I am not sure whether I understood the question correctly, but you can save skllm estimator as pickle the same way you would do with any other python object.
from scikit-llm.
@OKUA1
let us assume we have done this:
from skllm.datasets import get_classification_dataset
# demo sentiment analysis dataset
# labels: positive, negative, neutral
X, y = all_list,list(data.completion.values)
clf = ZeroShotGPTClassifier(openai_model = "gpt-3.5-turbo")
clf.fit(X, y)```
until here we have done training the model right ?
we can save model file as pickle file:
clf.save(model.pickle).
for testing the model:
we can load the model and we can testing something like this
clf = pickle.load(model.pickle)
clf.predit("some text") #itshould give classification
from scikit-llm.
@ChandraReddy97 please follow a general pickle guide like the one below. While we have never tested the pickling/unpickling process with skllm, it should still work. Let me know if you run into any problems.
https://practicaldatascience.co.uk/machine-learning/how-to-save-and-load-machine-learning-models-using-pickle
from scikit-llm.
I am closing the issue as it must have been resolved. Please let me know if it was not the case.
from scikit-llm.
Pickle` works well.
import Pickle
import SKLLMConfig from skllm.config
import os
pickle.dump(clf, open("data/zero_shot_gpt.pkl", "wb"))
SKLLMConfig.set_openai_key(os.getenv("OPENAI_API_KEY"))
clf_loaded = pickle.load(open("data/zero_shot_gpt.pkl", "rb"))
clf_loaded.predict([[
"The successor to the saga will have new hardware and a lower price point," according to a person familiar with the plans,
"The newly created ETF could attract up to $36 billion in inflows from other crypto products such as the Grayscale Bitcoin Trust (GBTC), a report said.",
"Bitcoin's RSI divergence signals a correction, 10x Research said."
])
from scikit-llm.
Related Issues (20)
- Error for DynamicFewShotGPTClassifier when using OpenAI Api HOT 1
- Supporting NER tasks HOT 3
- A/B Test LLMs? HOT 2
- Update Readme for Azure users HOT 3
- Prompt JSON response for DynamicFewShotGPTClassifier is blank HOT 2
- Documentation: HOT 2
- 是否支持加载本地大模型做文本向量化? HOT 2
- Integration of other LLMs HOT 2
- Long Documents for Summarization -> Zero-Shot Multi-Label Classification
- Azure OpenAI Embeddings HOT 1
- Predictions scores for the ZeroShotGPTClassifier HOT 3
- Safe openai version to work on?
- ZeroShotGPTClassifier Error HOT 1
- APIConnectionError HOT 2
- Consider updating package requirements HOT 1
- [Feature Request]: Batched Async Prediction HOT 1
- Feature request: setting seed parameter of OpenAI's chat completions API HOT 1
- can you share link to Agent Dingo HOT 1
- Is that possible not to raise error for few edge cases? HOT 2
- predict HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scikit-llm.