lamini-ai / llm-classifier

Classify data instantly using an LLM
Other
212 stars 20 forks source link

Error while training... i have tried to train as given in the doc but facing error #1

Open mohamednihal opened 7 months ago

mohamednihal commented 7 months ago

I am giving the same samples of cats and dogs but I'm getting the following error ValueError: Expected 2D array, got 1D array instead: array=[]. Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

in this llm.prompt_train(prompts)

what mistake am I doing ? any help would be nice :)

viswanath27 commented 7 months ago

image

same it there tried to add the key as the env variable and in the configure.yaml but still there seems to be error

viswanath27 commented 7 months ago

When I run ./train.sh or run the below code its the same error

image

lilywchen commented 7 months ago

I also got the same error when trying to run the examples.

farnazgh commented 7 months ago

As far as I understood, you have to set the Lamini_api_key before any usage. The KEY is available from this link, after signing in: https://app.lamini.ai/account And there are only 200 inference calls for each account.

sv2441 commented 7 months ago
import lamini
from lamini import LaminiClassifier
lamini.api_key = "Your_API"

# Create a new classifier
llm = LaminiClassifier()

#prompts
prompts={
  "cat": "Cats are generally more independent and aloof than dogs, who are often more social and affectionate. Cats are also more territorial and may be more aggressive when defending their territory.  Cats are self-grooming animals, using their tongues to keep their coats clean and healthy. Cats use body language and vocalizations, such as meowing and purring, to communicate.",
  "dog": "Dogs are more pack-oriented and tend to be more loyal to their human family.  Dogs, on the other hand, often require regular grooming from their owners, including brushing and bathing. Dogs use body language and barking to convey their messages. Dogs are also more responsive to human commands and can be trained to perform a wide range of tasks.",
}

llm.prompt_train(prompts)

You Need to Upload the APi Key from the https://app.lamini.ai/account

mohamednihal commented 7 months ago
import lamini
from lamini import LaminiClassifier
lamini.api_key = "Your_API"

# Create a new classifier
llm = LaminiClassifier()

#prompts
prompts={
  "cat": "Cats are generally more independent and aloof than dogs, who are often more social and affectionate. Cats are also more territorial and may be more aggressive when defending their territory.  Cats are self-grooming animals, using their tongues to keep their coats clean and healthy. Cats use body language and vocalizations, such as meowing and purring, to communicate.",
  "dog": "Dogs are more pack-oriented and tend to be more loyal to their human family.  Dogs, on the other hand, often require regular grooming from their owners, including brushing and bathing. Dogs use body language and barking to convey their messages. Dogs are also more responsive to human commands and can be trained to perform a wide range of tasks.",
}

llm.prompt_train(prompts)

You Need to Upload the APi Key from the https://app.lamini.ai/account

okay got it, thank you !