Giter Club home page Giter Club logo

Comments (5)

OKUA1 avatar OKUA1 commented on May 13, 2024

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.

ChandraReddy97 avatar ChandraReddy97 commented on May 13, 2024

@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.

OKUA1 avatar OKUA1 commented on May 13, 2024

@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.

OKUA1 avatar OKUA1 commented on May 13, 2024

I am closing the issue as it must have been resolved. Please let me know if it was not the case.

from scikit-llm.

mrchaos avatar mrchaos commented on May 13, 2024

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."
    ])

image

from scikit-llm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.