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

The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #524

Open
ya-stack opened this issue May 14, 2024 · 0 comments

Comments

@ya-stack
Copy link

ya-stack commented May 14, 2024

I am facing below error while training SetFit model -
I am trying to predict each pipe separated labels as a single class, this is how first record of training dataset looks like -

text: Powell Kilbuck Solid Wood 3 Doors and 2 Adjustable Shelves Accent Cabinet Navy, Elevate the ambiance of your living space with the Kilbuck Navy Solid Wood Three Door Accent Cabinet from Powell. Immerse yourself in the captivating allure of its refined bohemian style, where intricate fretwork adorns the front panels, exuding expressive charm. This cabinet isn't just a piece of furniture; it's a statement of versatile functionality. With three separate doors swinging open to reveal two spacious interiors, storage dilemmas become a thing of the past. Whether you envision it as a TV stand, dining room sideboard, or entryway lamp stand, its adaptability makes it a seamless addition to any room. Crafted with meticulous attention to detail, this accent cabinet boasts not only aesthetic appeal but also robust durability. Its solid wood frame and birch veneer construction ensure longevity, promising years of reliable service. The luminous navy finish adds a touch of timeless elegance, effortlessly blending with any color scheme or decor style. Black metal door handles not only provide ease of use but also serve as subtle accents, enhancing the cabinet's overall aesthetic. Magnetic latches keep the doors securely shut, offering peace of mind and convenience in equal measure.This versatile piece is designed to save space without compromising on functionality. Assembly is a breeze, requiring only the attachment of legs upon arrival. Whether you're seeking storage solutions for your living room, dining area, or hallway, the Kilbuck Navy Solid Wood Three Door Accent Cabinet stands ready to meet your needs with its blend of style, versatility, and durability. Redefine your living space today with this exquisite addition from Powell.Overall Width: 39” Overall Depth: 15”Overall Height: 35”

label: [1, 0]

label text: FURNITURE|cabinets, shelving and storage|Decorative Cabinets, Drawers and Trunks|Decorative Storage Cabinets

ERROR:
File ~/.local/lib/python3.10/site-packages/setfit/sampler.py:68, in ContrastiveDataset.init(self, examples, multilabel, num_iterations, sampling_strategy, max_pairs)
66 self.generate_multilabel_pairs()
67 else:
---> 68 self.generate_pairs()
70 if num_iterations is not None and num_iterations > 0:
71 self.len_pos_pairs = num_iterations * len(self.sentences)

File ~/.local/lib/python3.10/site-packages/setfit/sampler.py:91, in ContrastiveDataset.generate_pairs(self)
89 def generate_pairs(self) -> None:
90 for (_text, _label), (text, label) in shuffle_combinations(self.sentence_labels):
---> 91 if _label == label:
92 self.pos_pairs.append(InputExample(texts=[_text, text], label=1.0))
93 else:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Also, there are no duplicates across train and test dataset. I have 2 labels -
FURNITURE|cabinets, shelving and storage|Decorative Cabinets, Drawers and Trunks|Decorative Storage Cabinets 1675
HOME|BEDDING|top of bed|Bed Tents and Canopies 8

Can you please help me to resolve it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant