You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
how can i use the“from langchain_openai import ChatOpenAI” by connect GPT4 and chemlift?when I run the example code by my API key,it always shows this error“ValueError: Sample larger than population or is negative”
ValueError Traceback (most recent call last)
Cell In[6], line 24
21 fsc = FewShotClassifier(client, property_name='bandgap')
23 # Train on a few examples
---> 24 fsc.fit(['ethane', 'propane', 'butane'], [0,1,0])
26 # Predict on a few more
27 fsc.predict(['pentane', 'hexane', 'heptane'])
File c:\Users\19341.conda\envs\agents20240401\Lib\site-packages\chemlift\icl\fewshotpredictor.py:238, in FewShotPredictor.fit(self, X, y)
231 def fit(self, X: ArrayLike, y: ArrayLike):
232 """Fit the model to a support set.
233
234 Args:
235 X: A list of examples.
236 y: A list of targets.
237 """
--> 238 support_indices = self._pick_support_indices(X)
239 self._support_set = (np.array(X)[support_indices], np.array(y)[support_indices])
240 self._allowed_values = set(y)
File c:\Users\19341.conda\envs\agents20240401\Lib\random.py:456, in Random.sample(self, population, k, counts)
454 randbelow = self._randbelow
455 if not 0 <= k <= n:
--> 456 raise ValueError("Sample larger than population or is negative")
457 result = [None] * k
458 setsize = 21 # size of a small set minus size of an empty list
ValueError: Sample larger than population or is negative
The text was updated successfully, but these errors were encountered:
how can i use the“from langchain_openai import ChatOpenAI” by connect GPT4 and chemlift?when I run the example code by my API key,it always shows this error“ValueError: Sample larger than population or is negative”
ValueError Traceback (most recent call last)
Cell In[6], line 24
21 fsc = FewShotClassifier(client, property_name='bandgap')
23 # Train on a few examples
---> 24 fsc.fit(['ethane', 'propane', 'butane'], [0,1,0])
26 # Predict on a few more
27 fsc.predict(['pentane', 'hexane', 'heptane'])
File c:\Users\19341.conda\envs\agents20240401\Lib\site-packages\chemlift\icl\fewshotpredictor.py:238, in FewShotPredictor.fit(self, X, y)
231 def fit(self, X: ArrayLike, y: ArrayLike):
232 """Fit the model to a support set.
233
234 Args:
235 X: A list of examples.
236 y: A list of targets.
237 """
--> 238 support_indices = self._pick_support_indices(X)
239 self._support_set = (np.array(X)[support_indices], np.array(y)[support_indices])
240 self._allowed_values = set(y)
File c:\Users\19341.conda\envs\agents20240401\Lib\site-packages\chemlift\icl\fewshotpredictor.py:118, in FewShotPredictor._pick_support_indices(self, examples)
116 random.seed(self._seed)
117 if self._strategy == Strategy.RANDOM:
--> 118 return random.sample(range(len(examples)), self._n_support)
119 elif self._strategy == Strategy.FIRST:
120 return list(range(self._n_support))
File c:\Users\19341.conda\envs\agents20240401\Lib\random.py:456, in Random.sample(self, population, k, counts)
454 randbelow = self._randbelow
455 if not 0 <= k <= n:
--> 456 raise ValueError("Sample larger than population or is negative")
457 result = [None] * k
458 setsize = 21 # size of a small set minus size of an empty list
ValueError: Sample larger than population or is negative
The text was updated successfully, but these errors were encountered: