Spaces:
Sleeping
Sleeping
Download src/prompts.py from cschen/Material-AI: direct link, hf CLI and curl.
- Browser
- Download file 14 kB
-
https://huggingface.co/spaces/cschen/Material-AI/resolve/main/src/prompts.py
- Command line
-
hf download hf://spaces/cschen/Material-AI/src/prompts.py
-
curl -L -o prompts.py https://huggingface.co/spaces/cschen/Material-AI/resolve/main/src/prompts.py
14 kB
| Data_Dir = "./data" | |
| HEA_SYSTEM_PROMPT = """ | |
| ๐ **System Prompt for HEA alloy knownledge book generation:** <span style="font-size: 14px; color:blue;">You are a expert in the HEA alloy research. </span> | |
| """ | |
| AL_SYSTEM_PROMPT = """ | |
| ๐ **System Prompt for AL alloy knownledge book generation:** <span style="font-size: 14px; color:blue;">You are a expert in the Al alloy research. </span> | |
| """ | |
| HEA_GENERATE_KNOWLEDGE_PROMPT = """The following is offline HEA alloy data composed of compositions and fitness values. | |
| The fitness values include: | |
| - Yield strength (YS): Enhancing load-bearing capacity. | |
| - Ultimate tensile strength (UTS): Increasing material performance under extreme conditions. | |
| - Elongation: Ensuring toughness and deformability. | |
| Your task: | |
| 1. Gather relevant knowledge about HEA alloys. | |
| 2. Compute the correlation between each composition and each fitness value. | |
| 3. Perform multiple regression analysis and combine knowledge about HEA alloys to evaluate its impact on each fitness value. | |
| 4. Use SHAP values and combine knowledge about HEA alloys to further quantify every compositions' contribution. | |
| Your response **must** contain only the **quantitative and qualitative analysis of every components' impact on fitness values including *specific SHAP value* **, strictly within **500 words**. **Do not** generate any additional statements or explanations. | |
| Compositions: 'C', 'Al', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Mo', 'Ti' | |
| Output format example--[composition]: [qualitative analysis to 'YS', 'UTS', 'Elongation']. Correlation coefficients: YS (number), UTS (number), elongation (number). SHAP values: YS (number), UTS (number), elongation (number). | |
| """ | |
| AL_GENERATE_KNOWLEDGE_PROMPT = """The following is offline Al alloy data composed of compositions and fitness values. | |
| The fitness values include: | |
| - Yield strength (YS): Enhancing load-bearing capacity. | |
| - Ultimate tensile strength (UTS): Increasing material performance under extreme conditions. | |
| - Elongation: Ensuring toughness and deformability. | |
| Your task: | |
| 1. Gather relevant knowledge about Al alloys. | |
| 2. Compute the correlation between each composition and each fitness value. | |
| 3. Perform multiple regression analysis and combine knowledge about Al alloys to evaluate its impact on each fitness value. | |
| 4. Use SHAP values and combine knowledge about Al alloys to further quantify every compositions' contribution. | |
| Your response **must** contain only the **quantitative and qualitative analysis of every components' impact on fitness values including *specific SHAP value* **, strictly within **500 words**. **Do not** generate any additional statements or explanations. | |
| Compositions: 'Al', 'Co', 'Cr', 'Cu', 'Fe', 'Mg', 'Mn', 'Ni', 'Si', 'Ti', 'V', 'Zn' | |
| Output format example--[composition]: [qualitative analysis to 'YS', 'UTS', 'Elongation']. Correlation coefficients: YS (number), UTS (number), elongation (number). SHAP values: YS (number), UTS (number), elongation (number). | |
| """ | |
| HEA_EVALUATE_CANDIDATE_PROMPT = """The following are the offline HEA alloy data composed by the HEA compositions and the Fitness value. | |
| The corresponding fitness values includes: yield strength (YS: enhancing load-bearing capacity), ultimate tensile strength (UTS: increasing material performance under extreme conditions), and elongation (Elongation: ensuring toughness and deformability) to meet the diverse demands of various applications. | |
| Firstly, you need to think about the impact of the proportion of different compositions on fitness values from the perspective of a materials expert. | |
| The relationship between each component of HEA data and the objective value is: {HEA_knowledge} | |
| Then, you need to analyze the relationship between different compositions and Fitness values based on offline HEA alloy data, and then perform the regression. | |
| Based on the material analysis and regression analysis mentioned above, you need predict the Fitness values of the following alloy: | |
| {Re_X} | |
| Your response must only contain the predicted Fitness value, in the format of ## [YS=, UTS=, Elongation=] ##. Do not generate other statement. | |
| {examples} | |
| """ | |
| AL_EVALUATE_CANDIDATE_PROMPT = """The following are the offline Al alloy data composed by the Al compositions and the Fitness value. | |
| The corresponding fitness values includes: yield strength (YS: enhancing load-bearing capacity), ultimate tensile strength (UTS: increasing material performance under extreme conditions), and elongation (Elongation: ensuring toughness and deformability) to meet the diverse demands of various applications. | |
| Firstly, you need to think about the impact of the proportion of different compositions on fitness values from the perspective of a materials expert. | |
| The relationship between each component of Al data and the objective value is: {AL_knowledge} | |
| Then, you need to analyze the relationship between different compositions and Fitness values based on offline Al alloy data, and then perform the regression. | |
| Based on the material analysis and regression analysis mentioned above, you need predict the Fitness values of the following alloy: | |
| {Re_X} | |
| Your response must only contain the predicted Fitness value, in the format of ## [YS=, UTS=, Elongation=] ##. Do not generate other statement. | |
| {examples} | |
| """ | |
| HEA_UPDATE_KNOWLEDGE_PROMPT = """The following is offline HEA alloy data composed of compositions and fitness values. | |
| The fitness values include: | |
| - Yield strength (YS): Enhancing load-bearing capacity. | |
| - Ultimate tensile strength (UTS): Increasing material performance under extreme conditions. | |
| - Elongation: Ensuring toughness and deformability. | |
| Composition analysis: | |
| {HEA_knowledge} | |
| Your task: | |
| 1. Gather relevant knowledge about HEA alloys. | |
| 2. Combine knowledge about HEA and offline HEA alloy data to compute the correlation between each component and each fitness value. | |
| 3. Compute the SHAP values using the offline HEA alloy data. | |
| 4. Perform multiple regression analysis and combine knowledge about HEA alloys to evaluate its impact on each fitness value. | |
| 5. Use correlation values, SHAP values, and combine knowledge about HEA alloys to further quantify every component's contribution. | |
| 6. **Update the composition analysis** based on the offline HEA alloy data and test dataset (Test dataset includes test data, ground truth fitness values, and LLM-predicted fitness values): | |
| - Assess the consistency of LLM predictions with the actual values. | |
| - Identify discrepancies and refine correlation and SHAP value estimations. | |
| - Adjust regression analysis results by incorporating insights from test performance. | |
| - Reassess the quantitative impact of each component considering test set predictions. | |
| - Test dataset: {Test_data} | |
| Your response **must** contain: | |
| 1. The **quantitative and qualitative analysis of every component's impact on fitness values to **update the composition analysis**, including **specific SHAP values**, strictly within **400 words**. **Do not** generate any additional statements or explanations. | |
| Format example--[composition]: [composition] (degree) positively/negatively impacts YS, (degree) positively/negatively impacts UTS, and (degree) positively/negatively affects elongation. Correlation coefficients: YS (number), UTS (number), elongation (number). SHAP values: YS (number), UTS (number), elongation (number). | |
| 2. Provide considerations for subsequent **LLM regression process** based on test data errors within **100 words**. **Do not** generate any additional statements or explanations. | |
| {examples} | |
| """ | |
| AL_UPDATE_KNOWLEDGE_PROMPT = """The following is offline al alloy data composed of compositions and fitness values. | |
| The fitness values include: | |
| - Yield strength (YS): Enhancing load-bearing capacity. | |
| - Ultimate tensile strength (UTS): Increasing material performance under extreme conditions. | |
| - Elongation: Ensuring toughness and deformability. | |
| Composition analysis: | |
| {AL_knowledge} | |
| Your task: | |
| 1. Gather relevant knowledge about Al alloys. | |
| 2. Combine knowledge about Al and offline Al alloy data to compute the correlation between each component and each fitness value. | |
| 3. Compute the SHAP values using the offline Al alloy data. | |
| 4. Perform multiple regression analysis and combine knowledge about Al alloys to evaluate its impact on each fitness value. | |
| 5. Use correlation values, SHAP values, and combine knowledge about Al alloys to further quantify every component's contribution. | |
| 6. **Update the composition analysis** based on the offline Al alloy data and test dataset (Test dataset includes test data, ground truth fitness values, and LLM-predicted fitness values): | |
| - Assess the consistency of LLM predictions with the actual values. | |
| - Identify discrepancies and refine correlation and SHAP value estimations. | |
| - Adjust regression analysis results by incorporating insights from test performance. | |
| - Reassess the quantitative impact of each component considering test set predictions. | |
| - Test dataset: {Test_data} | |
| Your response **must** contain: | |
| 1. The **quantitative and qualitative analysis of every component's impact on fitness values to **update the composition analysis**, including **specific SHAP values**, strictly within **400 words**. **Do not** generate any additional statements or explanations. | |
| Format example--[composition]: [composition] (degree) positively/negatively impacts YS, (degree) positively/negatively impacts UTS, and (degree) positively/negatively affects elongation. Correlation coefficients: YS (number), UTS (number), elongation (number). SHAP values: YS (number), UTS (number), elongation (number). | |
| 2. Provide considerations for subsequent **LLM regression process** based on test data errors within **100 words**. **Do not** generate any additional statements or explanations. | |
| {examples} | |
| """ | |
| PREDICT_PROMPT = """The following are the offline alloy data composed by the Alloy compositions and the Fitness value. | |
| These offline data are divided into two parts, the first 30 data are High Entropy Alloys, and the rest data are Aluminum Alloys. | |
| The corresponding fitness values includes: yield strength (YS: enhancing load-bearing capacity), ultimate tensile strength (UTS: increasing material performance under extreme conditions), and elongation (Elongation: ensuring toughness and deformability) to meet the diverse demands of various applications. | |
| Firstly, you need to think about the impact of the proportion of different compositions on fitness values from the perspective of a materials expert. | |
| The relationship between each component of HEA data and the objective value is: {self.HEA_knowledge} | |
| The relationship between each component of Aluminum data and the objective value is: {self.AL_knowledge} | |
| Then, you need to analyze the relationship between different compositions and Fitness values based on offline alloy data, and then perform the regression. | |
| Now we need to merge High Entropy Alloys with Aluminum Alloys. \n' | |
| Based on the material analysis and regression analysis mentioned above, you need predict the Fitness values of the following alloy: | |
| {self.x} | |
| Your response must only contain the predicted Fitness value, in the format of ## [YS=, UTS=, Elongation=] ##. Do not generate other statement. | |
| {examples} | |
| """ | |
| ACTIVE_FRAME_COLOR = "#4CAF50" | |
| DEFAULT_FRAME_COLOR = "#a19b9a" | |
| ACTIVE_TEXT_COLOR = "#4CAF50" | |
| DEFAULT_TEXT_COLOR = "#333" | |
| PROCESSING_TEXT = """ | |
| <div style="text-align: center; margin-bottom: 20px;"> | |
| <h2 style="color: #333;">๐ Evaluate and Update Knowledge Books Process: Iteration {index}</h2> | |
| </div> | |
| <div style="display: flex; justify-content: space-between; gap: 6px;"> | |
| <div style="border: 2px solid {color1}; padding: 15px; border-radius: 8px; background-color: #f9f9f9; width: 32.5%; font-family: Arial, sans-serif;"> | |
| <h3><span style="color:{text_color1}">{icon1} Cluster and Select Candidates</span></h3> | |
| <ul> | |
| <li>The remaining dominated solutions (HEA: R1, AL: R2) are clustered using K-means (K=5), and two candidates per cluster are selected: one closest to the cluster center and one farthest from the non-dominated set (T1, T2).</li> | |
| <li><b>Input:</b> HEA remaining dominated solutions (R1), AL remaining dominated solutions (R2), Number of clusters (K=5)</li> | |
| <li><b>Output:</b> Candidate solutions (C1 for HEA, C2 for AL)</li> | |
| </ul> | |
| </div> | |
| <div style="border: 2px solid {color2}; padding: 15px; border-radius: 8px; background-color: #f9f9f9; width: 32.5%; font-family: Arial, sans-serif;"> | |
| <h3><span style="color:{text_color2}">{icon2} Evaluate and Update Non-Dominated Sets</span></h3> | |
| <ul> | |
| <li>The LLM evaluates candidates (C1, C2) based on prediction error, selecting those with the highest error for inclusion in the non-dominated sets (T1, T2), and removing them from the remaining solutions (R1, R2).</li> | |
| <li><b>Input:</b> Candidate solutions (C1, C2), Non-dominated solution sets (T1, T2), Knowledge Books (K1_{prev_index}, K2_{prev_index})</li> | |
| <li><b>Output:</b> Updated non-dominated solution sets (T1, T2), Updated remaining solutions (R1, R2)</li> | |
| </ul> | |
| </div> | |
| <div style="border: 2px solid {color3}; padding: 15px; border-radius: 8px; background-color: #f9f9f9; width: 32.5%; font-family: Arial, sans-serif;"> | |
| <h3><span style="color:{text_color3}">{icon3} Update Knowledge Books</span></h3> | |
| <ul> | |
| <li>The LLM updates the Knowledge Books (K1_{prev_index}, K2_{prev_index}) by incorporating newly added solutions (T1, T2), adjusting based on prediction errors on test data, and refining knowledge from the previous iteration of Knowledge Books.</li> | |
| <li><b>Input:</b> Updated non-dominated solution sets (T1, T2), Candidate solutions (C1, C2), Previous Knowledge Books (K1_{prev_index}, K2_{prev_index})</li> | |
| <li><b>Output:</b> Updated Knowledge Books (K1_{index}, K2_{index})</li> | |
| </ul> | |
| </div> | |
| </div> | |
| """ |