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
Description:
A ValueError occurs during the execution of the run_article_generation_module in the knowledge_storm library. The error message indicates that a 1D array was provided where a 2D array was expected. Specifically, the error arises when attempting to compute cosine similarity using the cosine_similarity function from sklearn.metrics.pairwise. The error suggests that the input array is empty or improperly shaped.
Steps to Reproduce:
Input Topic Name: [Provide the topic name used for the article generation]
Execution Command: Run the script run_storm_wiki_deepseek.py with the appropriate arguments.
Error Encountered: The script fails with the following error traceback:
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.
Output Files: [Attach all output files generated for this topic as a zip file]
Expected Behavior:
The article generation module should successfully generate the article sections without encountering any array shape-related errors.
Actual Behavior:
The script fails with a ValueError due to an unexpected array shape during the cosine similarity computation.
Screenshots:
[If applicable, add screenshots of the error message or any relevant UI elements]
Environment:
OS: macOS (as inferred from the file paths)
Python Version: 3.11
Libraries/Packages:
knowledge_storm
sentence_transformers
scikit-learn
Hardware: [If relevant, specify the hardware, e.g., M1 chip]
Additional Context:
The error occurs in the retrieve_information method of the storm_dataclass.py file, specifically when trying to compute the cosine similarity between an encoded query and encoded snippets. The issue seems to be related to the shape of the input arrays passed to the cosine_similarity function.
Possible Fix:
Ensure that the input arrays to the cosine_similarity function are properly reshaped to 2D arrays before computation. For example:
Description:
A ValueError occurs during the execution of the run_article_generation_module in the knowledge_storm library. The error message indicates that a 1D array was provided where a 2D array was expected. Specifically, the error arises when attempting to compute cosine similarity using the cosine_similarity function from sklearn.metrics.pairwise. The error suggests that the input array is empty or improperly shaped.
Steps to Reproduce:
Input Topic Name: [Provide the topic name used for the article generation]
Execution Command: Run the script run_storm_wiki_deepseek.py with the appropriate arguments.
Error Encountered: The script fails with the following error traceback:
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.
Output Files: [Attach all output files generated for this topic as a zip file]
Expected Behavior:
The article generation module should successfully generate the article sections without encountering any array shape-related errors.
Actual Behavior:
The script fails with a ValueError due to an unexpected array shape during the cosine similarity computation.
Screenshots:
[If applicable, add screenshots of the error message or any relevant UI elements]
Environment:
OS: macOS (as inferred from the file paths)
Python Version: 3.11
Libraries/Packages:
knowledge_storm
sentence_transformers
scikit-learn
Hardware: [If relevant, specify the hardware, e.g., M1 chip]
Additional Context:
The error occurs in the retrieve_information method of the storm_dataclass.py file, specifically when trying to compute the cosine similarity between an encoded query and encoded snippets. The issue seems to be related to the shape of the input arrays passed to the cosine_similarity function.
Possible Fix:
Ensure that the input arrays to the cosine_similarity function are properly reshaped to 2D arrays before computation. For example:
python
encoded_query = encoded_query.reshape(1, -1) # Reshape to 2D array
sim = cosine_similarity(encoded_query, self.encoded_snippets)[0]
Attachments:
[Output files as a zip file]
[Relevant code snippets or logs]
Note: Please provide the input topic name and any generated output files to help further diagnose the issue.
The text was updated successfully, but these errors were encountered: