Skip to content

Commit f08de5a

Browse files
fixed bugs and update requirements file
1 parent 244380d commit f08de5a

File tree

5 files changed

+43
-44
lines changed

5 files changed

+43
-44
lines changed

Code/mixtral/NER.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def NER_mixtral(config):
1313
Answer:::
1414
'''
1515
for i in [2,5,6,4,12,15,13,22,17,19,20,8,25]:
16-
Answer = read_txt(f"{config.get('Paths', 'Ans_to_cq_output_folder')}Publication{pub}_CQ{i}.txt")
17-
prompt = f"Q: {CQs[i-1]}\nA: {Answer}\n"
18-
combined_prompt += prompt
19-
combined_prompt +=Answer_format
20-
#print(combined_prompt)
21-
output = llm.invoke(combined_prompt)
22-
with open(f"{config.get('Paths', 'NER_mixtral_save')}Publication{pub}_concepts.txt", 'w') as f:
23-
f.write(output)
16+
Answer = read_txt(f"{config.get('Paths', 'Ans_to_cq_output_folder')}Publication{pub}_CQ{i}.txt")
17+
prompt = f"Q: {CQs[i-1]}\nA: {Answer}\n"
18+
combined_prompt += prompt
19+
combined_prompt +=Answer_format
20+
#print(combined_prompt)
21+
output = llm.invoke(combined_prompt)
22+
with open(f"{config.get('Paths', 'NER_mixtral_save')}Publication{pub}_concepts.txt", 'w') as f:
23+
f.write(output)

Code/mixtral/Ontology_creation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def Ontology_creation(config):
2323
inverse_properties = content[inverse_properties_s_ind:].strip()
2424
base_onto_class, base_onto_property = get_base_onto_class(config.get('Paths', 'SOTAOntology_path'))
2525

26-
prompt = prompt_template.format(concepts=concepts,relations=relationships,base_onto_class=base_onto_class,base_onto_property=base_onto_property)
26+
prompt = prompt_template.format(concepts=concepts,relations=relationships,data_properties=data_properties,InverseProperties=inverse_properties,base_onto_class=base_onto_class,base_onto_property=base_onto_property)
2727

2828
with open(config.get('Paths', 'Created_onto_path'),"w") as f:
2929
f.write(llm.invoke(prompt))

Code/mixtral/RAG_CQ_answering_with_LLMs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ def RAG_CQ_answering(config):
2525
prompt = prompt_template.format(query=cq)
2626
result = chain({"query": prompt}, return_only_outputs=True)
2727
wrapped_text = textwrap.fill(result['result'], width=100)
28-
with open(f"{config.get('Paths', 'Ans_to_cq_path')}Publication{d}_CQ{p}.txt", 'w') as f:
28+
with open(f"{config.get('Paths', 'Ans_to_cq_input_folder')}Publication{d}_CQ{p}.txt", 'w') as f:
2929
f.write(wrapped_text)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The repository encompasses various components, including code for data preproces
2323
Add the Hugging face access token in the helper_functions.py in the following line:
2424
access_token_read = os.getenv('access_token_read_hf')
2525

26-
Install the prerequisite using the requirements.txt file.
26+
Create virtual environment and install the prerequisite using the requirements.txt file. The code (v2.0.1) was tested & reproduced using Python 3.10.16 on a Linux system.
2727

2828
To run the whole pipeline, submit (execute) your job using main.py and use config.ini to customise the variables and paths
2929

requirements.txt

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
accelerate==0.25.0
2-
aiohttp==3.10.11
1+
accelerate==1.3.0
2+
aiohttp==3.9.1
33
aioprometheus==23.12.0
44
aiosignal==1.3.1
55
annotated-types==0.6.0
66
antlr4-python3-runtime==4.9.3
77
anyio==4.2.0
88
appdirs==1.4.4
99
asttokens==2.4.1
10+
async-timeout==4.0.3
1011
attrs==23.1.0
1112
backoff==2.2.1
1213
beautifulsoup4==4.12.2
1314
bitsandbytes==0.41.3.post2
14-
certifi==2024.7.4
15+
certifi==2023.11.17
1516
cffi==1.16.0
1617
chardet==5.2.0
1718
charset-normalizer==3.3.2
1819
click==8.1.7
1920
coloredlogs==15.0.1
2021
comm==0.2.1
2122
contourpy==1.2.0
22-
cryptography==43.0.1
23+
cryptography==41.0.7
2324
cupy-cuda12x==12.1.0
2425
cycler==0.12.1
2526
dataclasses-json==0.6.3
@@ -32,6 +33,7 @@ distro==1.9.0
3233
effdet==0.4.1
3334
einops==0.7.0
3435
emoji==2.9.0
36+
exceptiongroup==1.2.2
3537
executing==2.0.1
3638
faiss-cpu==1.7.4
3739
fastapi==0.109.2
@@ -47,15 +49,15 @@ h11==0.14.0
4749
httpcore==1.0.3
4850
httptools==0.6.1
4951
httpx==0.26.0
50-
huggingface-hub==0.20.1
52+
huggingface-hub==0.28.1
5153
humanfriendly==10.0
52-
idna==3.7
54+
idna==3.6
5355
iopath==0.1.10
5456
ipykernel==6.29.0
5557
ipython==8.20.0
5658
isodate==0.6.1
5759
jedi==0.19.1
58-
Jinja2==3.1.5
60+
Jinja2==3.1.2
5961
joblib==1.3.2
6062
jsonpatch==1.33
6163
jsonpath-python==1.0.6
@@ -65,9 +67,9 @@ jsonschema-specifications==2023.12.1
6567
jupyter_client==8.6.0
6668
jupyter_core==5.7.1
6769
kiwisolver==1.4.5
68-
langchain-community==0.2.19
69-
langchain==0.3.0
70-
langchain-core==0.1.35
70+
langchain==0.0.352
71+
langchain-community==0.0.5
72+
langchain-core==0.1.23
7173
langchain-openai==0.0.6
7274
langdetect==1.0.9
7375
langsmith==0.0.87
@@ -85,7 +87,7 @@ mypy-extensions==1.0.0
8587
nest-asyncio==1.6.0
8688
networkx==3.2.1
8789
ninja==1.11.1.1
88-
nltk==3.9
90+
nltk==3.8.1
8991
numpy==1.26.2
9092
nvidia-cublas-cu12==12.1.3.1
9193
nvidia-cuda-cupti-cu12==12.1.105
@@ -100,11 +102,11 @@ nvidia-nccl-cu12==2.18.1
100102
nvidia-nvjitlink-cu12==12.3.101
101103
nvidia-nvtx-cu12==12.1.105
102104
omegaconf==2.3.0
103-
onnx==1.17.0
105+
onnx==1.15.0
104106
onnxruntime==1.15.1
105107
openai==1.12.0
106108
opencv-python==4.8.1.78
107-
orjson==3.9.15
109+
orjson==3.9.14
108110
packaging==23.2
109111
pandas==2.1.4
110112
parso==0.8.3
@@ -113,12 +115,11 @@ pdfminer.six==20221105
113115
pdfplumber==0.10.3
114116
pexpect==4.9.0
115117
pikepdf==8.10.1
116-
Pillow==10.3.0
117-
pip==23.3.1
118+
Pillow==10.1.0
118119
platformdirs==4.1.0
119120
portalocker==2.8.2
120121
prompt-toolkit==3.0.43
121-
protobuf==4.25.1
122+
protobuf==3.20.3
122123
psutil==5.9.7
123124
ptyprocess==0.7.0
124125
pure-eval==0.2.2
@@ -139,7 +140,7 @@ python-dateutil==2.8.2
139140
python-dotenv==1.0.1
140141
python-iso639==2023.12.11
141142
python-magic==0.4.27
142-
python-multipart==0.0.18
143+
python-multipart==0.0.6
143144
pytz==2023.3.post1
144145
PyYAML==6.0.1
145146
pyzmq==25.1.2
@@ -150,50 +151,48 @@ ray==2.9.2
150151
rdflib==7.0.0
151152
referencing==0.33.0
152153
regex==2023.10.3
153-
requests==2.32.0
154+
requests==2.31.0
154155
rpds-py==0.18.0
155-
safetensors==0.4.1
156-
scikit-learn==1.5.0
156+
safetensors==0.5.2
157+
scikit-learn==1.3.2
157158
scipy==1.11.4
158-
sentence-transformers==2.2.2
159+
sentence-transformers==3.4.1
159160
sentencepiece==0.1.99
160-
setuptools==70.0.0
161161
six==1.16.0
162162
sniffio==1.3.0
163163
soupsieve==2.5
164164
SQLAlchemy==2.0.23
165165
stack-data==0.6.3
166-
starlette==0.40.0
166+
starlette==0.36.3
167167
sympy==1.12
168168
tabulate==0.9.0
169169
tenacity==8.2.3
170170
threadpoolctl==3.2.0
171171
tiktoken==0.5.2
172172
timm==0.9.12
173-
tokenizers==0.15.0
173+
tokenizers==0.21.0
174174
tonic-validate==3.1.0
175-
torch==2.2.0
175+
torch==2.1.2
176176
torchvision==0.16.2
177-
tornado==6.4.2
178-
tqdm==4.66.3
177+
tornado==6.4
178+
tqdm==4.66.1
179179
traitlets==5.14.1
180-
transformers==4.38.0
180+
transformers==4.48.2
181181
triton==2.1.0
182-
typing_extensions==4.9.0
183182
typing-inspect==0.9.0
183+
typing_extensions==4.9.0
184184
tzdata==2023.3
185-
unstructured==0.14.3
185+
unstructured==0.11.6
186186
unstructured-client==0.15.0
187187
unstructured-inference==0.7.18
188188
unstructured.pytesseract==0.3.12
189-
urllib3==2.2.2
189+
urllib3==2.1.0
190190
uvicorn==0.27.1
191191
uvloop==0.19.0
192-
vllm==0.5.5
192+
vllm==0.3.1
193193
watchfiles==0.21.0
194194
wcwidth==0.2.13
195195
websockets==12.0
196-
wheel==0.41.2
197196
wrapt==1.16.0
198197
xformers==0.0.23.post1
199198
xxhash==3.4.1

0 commit comments

Comments
 (0)