boda commited on
Commit
e00aca3
Β·
1 Parent(s): eed9b52

add latest edits

Browse files
.streamlit/config.toml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ [server]
2
+ enableCORS = false
3
+ enableXsrfProtection = false
4
+ address = "0.0.0.0"
5
+ port = 8501
6
+ headless = true
7
+ [browser]
8
+ gatherUsageStats = false
Critical Questions Rev 02.docx ADDED
Binary file (33.8 kB). View file
 
WINDOWS_SETUP.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Running the App on Windows
2
+
3
+ ## Requirements
4
+
5
+ - Windows 10 or 11
6
+ - Python **3.10, 3.11, or 3.12**
7
+ - Download from [python.org/downloads](https://www.python.org/downloads/)
8
+ - During installation **check "Add Python to PATH"**
9
+ - An internet connection (for API calls and initial package download)
10
+
11
+ ---
12
+
13
+ ## Step 1 β€” Download the project
14
+
15
+ Copy the project folder to your Windows machine (USB, zip, or any file transfer).
16
+ Place it somewhere easy to find, e.g. `C:\Users\YourName\narjis_project`.
17
+
18
+ ---
19
+
20
+ ## Step 2 β€” Run the setup script
21
+
22
+ Open **File Explorer**, navigate to the project folder, then double-click:
23
+
24
+ ```
25
+ setup_windows.bat
26
+ ```
27
+
28
+ What it does:
29
+ - Checks that Python is installed
30
+ - Creates an isolated virtual environment (`.venv` folder)
31
+ - Installs all required packages:
32
+ - `streamlit` β€” the web UI framework
33
+ - `openai` β€” ChatGPT / OpenAI API
34
+ - `anthropic` β€” Claude API
35
+ - `google-genai` β€” Gemini API
36
+ - `requests` β€” NVIDIA streaming API
37
+ - Optionally installs `transformers` + `torch` if you want to run local models (needs a GPU and ~10 GB disk space)
38
+
39
+ When it finishes you will see **"Setup complete!"**
40
+
41
+ ---
42
+
43
+ ## Step 3 β€” Start the app
44
+
45
+ Double-click:
46
+
47
+ ```
48
+ run_app.bat
49
+ ```
50
+
51
+ A terminal window will open and you will see:
52
+
53
+ ```
54
+ You can now view your Streamlit app in your browser.
55
+ Local URL: http://localhost:8501
56
+ ```
57
+
58
+ Open your browser and go to **http://localhost:8501**
59
+
60
+ To stop the app, click the terminal window and press **Ctrl + C**.
61
+
62
+ ---
63
+
64
+ ## Using the app
65
+
66
+ ### 1. Choose a provider (sidebar)
67
+
68
+ | Provider | What you need |
69
+ |---|---|
70
+ | ChatGPT (OpenAI) | OpenAI API key from platform.openai.com |
71
+ | Claude (Anthropic) | Anthropic API key from console.anthropic.com |
72
+ | Gemini (Google) | Google AI API key from aistudio.google.com |
73
+ | NVIDIA | NVIDIA API key from build.nvidia.com |
74
+ | Local (GPU) | A GPU with enough VRAM (no API key needed) |
75
+
76
+ Paste your API key in the password field β€” it is **never saved to disk**.
77
+
78
+ ### 2. Pick a model
79
+
80
+ Each provider shows its available models in a dropdown.
81
+
82
+ ### 3. Answer research questions
83
+
84
+ - The main area shows three **Move** panels (Move 1, 2, 3).
85
+ - Select a Move, then choose a specific question from the dropdown.
86
+ - Type your answer and click **βž• Add answer**.
87
+ - Repeat for as many questions as you like across all three Moves.
88
+ - Use the **βœ•** button next to any answer to remove it.
89
+
90
+ ### 4. Generate
91
+
92
+ Click **✨ Generate introduction**. The app combines your instruction prompt and all answers into one structured prompt and sends it to the selected model. The result appears below.
93
+
94
+ ---
95
+
96
+ ## Troubleshooting
97
+
98
+ **"Python was not found"**
99
+ Re-install Python and make sure "Add Python to PATH" is checked.
100
+
101
+ **"pip install failed"**
102
+ Run the setup script again. If your network requires a proxy, configure it in Windows network settings first.
103
+
104
+ **App opens but API call fails**
105
+ - Double-check your API key (no extra spaces).
106
+ - Make sure the key has access to the selected model.
107
+ - Some models (e.g. GPT-4.1, Claude Opus 4.7) require a paid tier.
108
+
109
+ **Blank page or port conflict**
110
+ Edit `run_app.bat` and change `8501` to another port, e.g.:
111
+ ```
112
+ .venv\Scripts\streamlit.exe run app.py --server.port 8502
113
+ ```
114
+ Then open http://localhost:8502.
__pycache__/app.cpython-312.pyc ADDED
Binary file (14.8 kB). View file
 
app.py CHANGED
@@ -123,7 +123,7 @@ NVIDIA_API_URL = "https://integrate.api.nvidia.com/v1/chat/completions"
123
  # ---------------------------------------------------------------------------
124
 
125
  st.set_page_config(
126
- page_title="LLM Paper Introduction Builder",
127
  page_icon="πŸ“",
128
  layout="wide",
129
  initial_sidebar_state="expanded",
@@ -210,8 +210,9 @@ st.markdown(
210
  st.markdown(
211
  """
212
  <div class="hero">
213
- <h1>πŸ“ LLM Paper Introduction Builder</h1>
214
- <p>Answer structured research questions across three academic writing moves, then generate a polished introduction with any major AI model.</p>
 
215
  </div>
216
  """,
217
  unsafe_allow_html=True,
@@ -594,7 +595,7 @@ if generate_clicked:
594
  st.code(prompt, language="text")
595
 
596
  try:
597
- with st.status("Generating introduction…", expanded=True) as status:
598
  if backend == "ChatGPT (OpenAI)":
599
  status.write(f"Calling {selected_openai_model} via OpenAI API…")
600
  introduction = generate_openai(
@@ -616,11 +617,11 @@ if generate_clicked:
616
  nvidia_api_key.strip(), NVIDIA_MODELS[selected_nvidia_model],
617
  prompt, temperature, nvidia_thinking
618
  )
619
- status.update(label="Generation complete", state="complete")
620
  except Exception as error:
621
  st.exception(error)
622
  else:
623
- st.markdown('<div class="section-label">Generated Introduction</div>', unsafe_allow_html=True)
624
  st.text_area("Output", value=introduction, height=450, label_visibility="collapsed")
625
  st.session_state["last_output"] = introduction
626
  st.session_state["last_prompt"] = prompt
 
123
  # ---------------------------------------------------------------------------
124
 
125
  st.set_page_config(
126
+ page_title="ARGUE",
127
  page_icon="πŸ“",
128
  layout="wide",
129
  initial_sidebar_state="expanded",
 
210
  st.markdown(
211
  """
212
  <div class="hero">
213
+ <h1>πŸ“ ARGUE</h1>
214
+ <p><em>An interactive AI-assisted tool for argument-driven research article writing</em></p>
215
+ <p>Answer structured research questions across three academic writing moves, then craft a polished introduction with any major AI model.</p>
216
  </div>
217
  """,
218
  unsafe_allow_html=True,
 
595
  st.code(prompt, language="text")
596
 
597
  try:
598
+ with st.status("Crafting introduction…", expanded=True) as status:
599
  if backend == "ChatGPT (OpenAI)":
600
  status.write(f"Calling {selected_openai_model} via OpenAI API…")
601
  introduction = generate_openai(
 
617
  nvidia_api_key.strip(), NVIDIA_MODELS[selected_nvidia_model],
618
  prompt, temperature, nvidia_thinking
619
  )
620
+ status.update(label="Introduction ready", state="complete")
621
  except Exception as error:
622
  st.exception(error)
623
  else:
624
+ st.markdown('<div class="section-label">Crafted Introduction</div>', unsafe_allow_html=True)
625
  st.text_area("Output", value=introduction, height=450, label_visibility="collapsed")
626
  st.session_state["last_output"] = introduction
627
  st.session_state["last_prompt"] = prompt
environment.yml ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: nlp
2
+ channels:
3
+ - conda-forge
4
+ dependencies:
5
+ - _openmp_mutex=4.5=20_gnu
6
+ - _python_abi3_support=1.0=hd8ed1ab_2
7
+ - asttokens=3.0.1=pyhd8ed1ab_0
8
+ - bzip2=1.0.8=h4777abc_9
9
+ - ca-certificates=2026.2.25=hbd8a1cb_0
10
+ - comm=0.2.3=pyhe01879c_0
11
+ - cpython=3.12.13=py312hd8ed1ab_0
12
+ - debugpy=1.8.20=py312hf55c4e8_0
13
+ - decorator=5.2.1=pyhd8ed1ab_0
14
+ - et_xmlfile=2.0.0=pyhd8ed1ab_1
15
+ - executing=2.2.1=pyhd8ed1ab_0
16
+ - ipykernel=7.2.0=pyha191276_1
17
+ - ipython=9.12.0=pyhecfbec7_0
18
+ - ipython_pygments_lexers=1.1.1=pyhd8ed1ab_0
19
+ - jedi=0.19.2=pyhd8ed1ab_1
20
+ - jupyter_client=8.8.0=pyhcf101f3_0
21
+ - jupyter_core=5.9.1=pyhc90fa1f_0
22
+ - keyutils=1.6.3=h86ecc28_0
23
+ - krb5=1.22.2=hfd895c2_0
24
+ - ld_impl_linux-aarch64=2.45.1=default_h1979696_102
25
+ - libedit=3.1.20250104=pl5321h976ea20_0
26
+ - libexpat=2.7.5=hfae3067_0
27
+ - libffi=3.5.2=h376a255_0
28
+ - libgcc=15.2.0=h8acb6b2_18
29
+ - libgcc-ng=15.2.0=he9431aa_18
30
+ - libgomp=15.2.0=h8acb6b2_18
31
+ - liblzma=5.8.3=he30d5cf_0
32
+ - libnsl=2.0.1=h86ecc28_1
33
+ - libsodium=1.0.21=h80f16a2_3
34
+ - libsqlite=3.53.0=h022381a_0
35
+ - libstdcxx=15.2.0=hef695bb_18
36
+ - libuuid=2.42=h1022ec0_0
37
+ - libxcrypt=4.4.36=h31becfc_1
38
+ - libzlib=1.3.2=hdc9db2a_2
39
+ - matplotlib-inline=0.2.1=pyhd8ed1ab_0
40
+ - ncurses=6.5=ha32ae93_3
41
+ - nest-asyncio=1.6.0=pyhd8ed1ab_1
42
+ - openpyxl=3.1.5=py312h6c49482_3
43
+ - openssl=3.6.2=h546c87b_0
44
+ - packaging=26.0=pyhcf101f3_0
45
+ - parso=0.8.6=pyhcf101f3_0
46
+ - pexpect=4.9.0=pyhd8ed1ab_1
47
+ - pip=26.0.1=pyh8b19718_0
48
+ - platformdirs=4.9.6=pyhcf101f3_0
49
+ - prompt-toolkit=3.0.52=pyha770c72_0
50
+ - psutil=7.2.2=py312hd41f8a7_0
51
+ - ptyprocess=0.7.0=pyhd8ed1ab_1
52
+ - pure_eval=0.2.3=pyhd8ed1ab_1
53
+ - pygments=2.20.0=pyhd8ed1ab_0
54
+ - python=3.12.13=h91f4b29_0_cpython
55
+ - python-dateutil=2.9.0.post0=pyhe01879c_2
56
+ - python-gil=3.12.13=hd8ed1ab_0
57
+ - python_abi=3.12=8_cp312
58
+ - pyzmq=27.1.0=py312hdf0a211_2
59
+ - readline=8.3=hb682ff5_0
60
+ - six=1.17.0=pyhe01879c_1
61
+ - stack_data=0.6.3=pyhd8ed1ab_1
62
+ - tk=8.6.13=noxft_h0dc03b3_103
63
+ - tornado=6.5.5=py312hefbd42c_0
64
+ - traitlets=5.14.3=pyhd8ed1ab_1
65
+ - tzdata=2025c=hc9c84f9_1
66
+ - wcwidth=0.6.0=pyhd8ed1ab_0
67
+ - wheel=0.46.3=pyhd8ed1ab_0
68
+ - zeromq=4.3.5=hc0523f8_10
69
+ - zstd=1.5.7=h85ac4a6_6
70
+ - pip:
71
+ - accelerate==1.13.0
72
+ - altair==6.0.0
73
+ - annotated-doc==0.0.4
74
+ - annotated-types==0.7.0
75
+ - anyio==4.13.0
76
+ - appdirs==1.4.4
77
+ - argcomplete==3.6.3
78
+ - asgiref==3.11.1
79
+ - attr==0.3.1
80
+ - attrs==26.1.0
81
+ - azure-core==1.39.0
82
+ - azure-storage-blob==12.28.0
83
+ - black==26.3.1
84
+ - bleach==5.0.1
85
+ - blinker==1.9.0
86
+ - boto3==1.42.90
87
+ - botocore==1.42.90
88
+ - cachetools==7.0.5
89
+ - certifi==2026.2.25
90
+ - cffi==2.0.0
91
+ - charset-normalizer==3.4.7
92
+ - click==8.3.2
93
+ - colorama==0.4.6
94
+ - croniter==6.2.2
95
+ - cryptography==46.0.7
96
+ - cuda-bindings==13.2.0
97
+ - cuda-pathfinder==1.5.2
98
+ - cuda-toolkit==13.0.2
99
+ - datamodel-code-generator==0.26.1
100
+ - defusedxml==0.7.1
101
+ - distro==1.9.0
102
+ - django==5.1.15
103
+ - django-annoying==0.10.6
104
+ - django-cors-headers==4.7.0
105
+ - django-csp==3.7
106
+ - django-debug-toolbar==3.2.1
107
+ - django-environ==0.10.0
108
+ - django-extensions==3.2.3
109
+ - django-filter==24.3
110
+ - django-migration-linter==5.2.0
111
+ - django-ranged-fileresponse==0.1.2
112
+ - django-rq==3.1
113
+ - django-storages==1.12.3
114
+ - django-user-agents==0.4.0
115
+ - djangorestframework==3.15.2
116
+ - djangorestframework-simplejwt==5.5.1
117
+ - dnspython==2.8.0
118
+ - drf-dynamic-fields==0.3.0
119
+ - drf-flex-fields==0.9.5
120
+ - drf-generators==0.3.0
121
+ - drf-spectacular==0.28.0
122
+ - email-validator==2.3.0
123
+ - expiringdict==1.2.2
124
+ - faker==40.13.0
125
+ - filelock==3.25.2
126
+ - fsspec==2026.3.0
127
+ - genson==1.3.0
128
+ - gitdb==4.0.12
129
+ - gitpython==3.1.46
130
+ - google-api-core==2.30.3
131
+ - google-auth==2.49.2
132
+ - google-cloud-appengine-logging==1.9.0
133
+ - google-cloud-audit-log==0.5.0
134
+ - google-cloud-core==2.5.1
135
+ - google-cloud-logging==3.15.0
136
+ - google-cloud-storage==3.10.1
137
+ - google-crc32c==1.8.0
138
+ - google-resumable-media==2.8.2
139
+ - googleapis-common-protos==1.74.0
140
+ - grpc-google-iam-v1==0.14.4
141
+ - grpcio==1.80.0
142
+ - grpcio-status==1.80.0
143
+ - h11==0.16.0
144
+ - hf-xet==1.4.3
145
+ - httpcore==1.0.9
146
+ - httpx==0.28.1
147
+ - huggingface-hub==1.10.2
148
+ - idna==3.11
149
+ - importlib-metadata==8.7.1
150
+ - inflect==5.6.2
151
+ - inflection==0.5.1
152
+ - isodate==0.7.2
153
+ - isort==5.13.2
154
+ - jinja2==3.1.6
155
+ - jiter==0.14.0
156
+ - jmespath==1.1.0
157
+ - joblib==1.5.3
158
+ - jsf==0.11.2
159
+ - jsonschema==4.26.0
160
+ - jsonschema-specifications==2025.9.1
161
+ - label-studio==1.23.0
162
+ - label-studio-converter==0.0.59
163
+ - label-studio-sdk==2.0.18
164
+ - label-studio-tools==0.0.4
165
+ - launchdarkly-server-sdk==8.2.1
166
+ - lxml==6.0.4
167
+ - lxml-html-clean==0.4.4
168
+ - markdown-it-py==4.0.0
169
+ - markupsafe==3.0.3
170
+ - mdurl==0.1.2
171
+ - mpmath==1.3.0
172
+ - mypy-extensions==1.1.0
173
+ - narwhals==2.19.0
174
+ - networkx==3.6.1
175
+ - nltk==3.9.4
176
+ - numpy==2.4.4
177
+ - nvidia-cublas==13.1.0.3
178
+ - nvidia-cuda-cupti==13.0.85
179
+ - nvidia-cuda-nvrtc==13.0.88
180
+ - nvidia-cuda-runtime==13.0.96
181
+ - nvidia-cudnn-cu13==9.19.0.56
182
+ - nvidia-cufft==12.0.0.61
183
+ - nvidia-cufile==1.15.1.6
184
+ - nvidia-curand==10.4.0.35
185
+ - nvidia-cusolver==12.0.4.66
186
+ - nvidia-cusparse==12.6.3.3
187
+ - nvidia-cusparselt-cu13==0.8.0
188
+ - nvidia-ml-py==13.590.48
189
+ - nvidia-nccl-cu13==2.28.9
190
+ - nvidia-nvjitlink==13.0.88
191
+ - nvidia-nvshmem-cu13==3.4.5
192
+ - nvidia-nvtx==13.0.85
193
+ - nvitop==1.6.2
194
+ - openai==1.109.1
195
+ - opencv-python-headless==4.13.0.92
196
+ - opentelemetry-api==1.41.0
197
+ - ordered-set==4.0.2
198
+ - pandas==3.0.2
199
+ - pathspec==1.0.4
200
+ - pillow==12.2.0
201
+ - proto-plus==1.27.2
202
+ - protobuf==6.33.6
203
+ - psycopg==3.3.3
204
+ - psycopg-binary==3.3.3
205
+ - pyarrow==22.0.0
206
+ - pyasn1==0.6.3
207
+ - pyasn1-modules==0.4.2
208
+ - pyboxen==1.3.0
209
+ - pycparser==3.0
210
+ - pydantic==2.13.2
211
+ - pydantic-core==2.46.2
212
+ - pydeck==0.9.1
213
+ - pyjwt==2.12.1
214
+ - pyrfc3339==2.1.0
215
+ - python-json-logger==2.0.4
216
+ - pytokens==0.4.1
217
+ - pytz==2022.7.1
218
+ - pyyaml==6.0.3
219
+ - redis==5.2.1
220
+ - referencing==0.37.0
221
+ - regex==2026.4.4
222
+ - requests==2.32.5
223
+ - requests-file==3.0.1
224
+ - requests-mock==1.12.1
225
+ - rich==15.0.0
226
+ - rpds-py==0.30.0
227
+ - rq==2.6.1
228
+ - rstr==3.2.2
229
+ - rules==3.4
230
+ - s3transfer==0.16.0
231
+ - safetensors==0.7.0
232
+ - semver==3.0.4
233
+ - sentencepiece==0.2.1
234
+ - sentry-sdk==2.58.0
235
+ - setuptools==81.0.0
236
+ - shellingham==1.5.4
237
+ - smart-open==7.6.0
238
+ - smmap==5.0.3
239
+ - sniffio==1.3.1
240
+ - sqlparse==0.5.5
241
+ - streamlit==1.56.0
242
+ - sympy==1.14.0
243
+ - tenacity==9.1.4
244
+ - tldextract==5.3.1
245
+ - tokenizers==0.22.2
246
+ - toml==0.10.2
247
+ - torch==2.11.0
248
+ - torchvision==0.26.0
249
+ - tqdm==4.67.3
250
+ - transformers==5.5.4
251
+ - triton==3.6.0
252
+ - typer==0.24.1
253
+ - typing-extensions==4.15.0
254
+ - typing-inspection==0.4.2
255
+ - ua-parser==1.0.2
256
+ - ua-parser-builtins==202603
257
+ - ujson==5.12.0
258
+ - uritemplate==4.2.0
259
+ - urllib3==2.6.3
260
+ - user-agents==2.2.0
261
+ - uuid-utils==0.14.1
262
+ - watchdog==6.0.0
263
+ - webencodings==0.5.1
264
+ - wrapt==2.1.2
265
+ - xmljson==0.2.1
266
+ - zipp==3.23.1
267
+ prefix: /capstor/scratch/cscs/asadalla/miniforge3/envs/nlp
environment.yml.bak ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: nlp
2
+ channels:
3
+ - conda-forge
4
+ dependencies:
5
+ - _openmp_mutex=4.5=20_gnu
6
+ - _python_abi3_support=1.0=hd8ed1ab_2
7
+ - asttokens=3.0.1=pyhd8ed1ab_0
8
+ - bzip2=1.0.8=h4777abc_9
9
+ - ca-certificates=2026.2.25=hbd8a1cb_0
10
+ - comm=0.2.3=pyhe01879c_0
11
+ - cpython=3.12.13=py312hd8ed1ab_0
12
+ - debugpy=1.8.20=py312hf55c4e8_0
13
+ - decorator=5.2.1=pyhd8ed1ab_0
14
+ - et_xmlfile=2.0.0=pyhd8ed1ab_1
15
+ - executing=2.2.1=pyhd8ed1ab_0
16
+ - ipykernel=7.2.0=pyha191276_1
17
+ - ipython=9.12.0=pyhecfbec7_0
18
+ - ipython_pygments_lexers=1.1.1=pyhd8ed1ab_0
19
+ - jedi=0.19.2=pyhd8ed1ab_1
20
+ - jupyter_client=8.8.0=pyhcf101f3_0
21
+ - jupyter_core=5.9.1=pyhc90fa1f_0
22
+ - keyutils=1.6.3=h86ecc28_0
23
+ - krb5=1.22.2=hfd895c2_0
24
+ - ld_impl_linux-aarch64=2.45.1=default_h1979696_102
25
+ - libedit=3.1.20250104=pl5321h976ea20_0
26
+ - libexpat=2.7.5=hfae3067_0
27
+ - libffi=3.5.2=h376a255_0
28
+ - libgcc=15.2.0=h8acb6b2_18
29
+ - libgcc-ng=15.2.0=he9431aa_18
30
+ - libgomp=15.2.0=h8acb6b2_18
31
+ - liblzma=5.8.3=he30d5cf_0
32
+ - libnsl=2.0.1=h86ecc28_1
33
+ - libsodium=1.0.21=h80f16a2_3
34
+ - libsqlite=3.53.0=h022381a_0
35
+ - libstdcxx=15.2.0=hef695bb_18
36
+ - libuuid=2.42=h1022ec0_0
37
+ - libxcrypt=4.4.36=h31becfc_1
38
+ - libzlib=1.3.2=hdc9db2a_2
39
+ - matplotlib-inline=0.2.1=pyhd8ed1ab_0
40
+ - ncurses=6.5=ha32ae93_3
41
+ - nest-asyncio=1.6.0=pyhd8ed1ab_1
42
+ - openpyxl=3.1.5=py312h6c49482_3
43
+ - openssl=3.6.2=h546c87b_0
44
+ - packaging=26.0=pyhcf101f3_0
45
+ - parso=0.8.6=pyhcf101f3_0
46
+ - pexpect=4.9.0=pyhd8ed1ab_1
47
+ - pip=26.0.1=pyh8b19718_0
48
+ - platformdirs=4.9.6=pyhcf101f3_0
49
+ - prompt-toolkit=3.0.52=pyha770c72_0
50
+ - psutil=7.2.2=py312hd41f8a7_0
51
+ - ptyprocess=0.7.0=pyhd8ed1ab_1
52
+ - pure_eval=0.2.3=pyhd8ed1ab_1
53
+ - pygments=2.20.0=pyhd8ed1ab_0
54
+ - python=3.12.13=h91f4b29_0_cpython
55
+ - python-dateutil=2.9.0.post0=pyhe01879c_2
56
+ - python-gil=3.12.13=hd8ed1ab_0
57
+ - python_abi=3.12=8_cp312
58
+ - pyzmq=27.1.0=py312hdf0a211_2
59
+ - readline=8.3=hb682ff5_0
60
+ - six=1.17.0=pyhe01879c_1
61
+ - stack_data=0.6.3=pyhd8ed1ab_1
62
+ - tk=8.6.13=noxft_h0dc03b3_103
63
+ - tornado=6.5.5=py312hefbd42c_0
64
+ - traitlets=5.14.3=pyhd8ed1ab_1
65
+ - tzdata=2025c=hc9c84f9_1
66
+ - wcwidth=0.6.0=pyhd8ed1ab_0
67
+ - wheel=0.46.3=pyhd8ed1ab_0
68
+ - zeromq=4.3.5=hc0523f8_10
69
+ - zstd=1.5.7=h85ac4a6_6
70
+ - pip:
71
+ - accelerate==1.13.0
72
+ - altair==6.0.0
73
+ - annotated-doc==0.0.4
74
+ - annotated-types==0.7.0
75
+ - anyio==4.13.0
76
+ - appdirs==1.4.4
77
+ - argcomplete==3.6.3
78
+ - asgiref==3.11.1
79
+ - attr==0.3.1
80
+ - attrs==26.1.0
81
+ - azure-core==1.39.0
82
+ - azure-storage-blob==12.28.0
83
+ - black==26.3.1
84
+ - bleach==5.0.1
85
+ - blinker==1.9.0
86
+ - boto3==1.42.90
87
+ - botocore==1.42.90
88
+ - cachetools==7.0.5
89
+ - certifi==2026.2.25
90
+ - cffi==2.0.0
91
+ - charset-normalizer==3.4.7
92
+ - click==8.3.2
93
+ - colorama==0.4.6
94
+ - croniter==6.2.2
95
+ - cryptography==46.0.7
96
+ - cuda-bindings==13.2.0
97
+ - cuda-pathfinder==1.5.2
98
+ - cuda-toolkit==13.0.2
99
+ - datamodel-code-generator==0.26.1
100
+ - defusedxml==0.7.1
101
+ - distro==1.9.0
102
+ - django==5.1.15
103
+ - django-annoying==0.10.6
104
+ - django-cors-headers==4.7.0
105
+ - django-csp==3.7
106
+ - django-debug-toolbar==3.2.1
107
+ - django-environ==0.10.0
108
+ - django-extensions==3.2.3
109
+ - django-filter==24.3
110
+ - django-migration-linter==5.2.0
111
+ - django-ranged-fileresponse==0.1.2
112
+ - django-rq==3.1
113
+ - django-storages==1.12.3
114
+ - django-user-agents==0.4.0
115
+ - djangorestframework==3.15.2
116
+ - djangorestframework-simplejwt==5.5.1
117
+ - dnspython==2.8.0
118
+ - drf-dynamic-fields==0.3.0
119
+ - drf-flex-fields==0.9.5
120
+ - drf-generators==0.3.0
121
+ - drf-spectacular==0.28.0
122
+ - email-validator==2.3.0
123
+ - expiringdict==1.2.2
124
+ - faker==40.13.0
125
+ - filelock==3.25.2
126
+ - fsspec==2026.3.0
127
+ - genson==1.3.0
128
+ - gitdb==4.0.12
129
+ - gitpython==3.1.46
130
+ - google-api-core==2.30.3
131
+ - google-auth==2.49.2
132
+ - google-cloud-appengine-logging==1.9.0
133
+ - google-cloud-audit-log==0.5.0
134
+ - google-cloud-core==2.5.1
135
+ - google-cloud-logging==3.15.0
136
+ - google-cloud-storage==3.10.1
137
+ - google-crc32c==1.8.0
138
+ - google-resumable-media==2.8.2
139
+ - googleapis-common-protos==1.74.0
140
+ - grpc-google-iam-v1==0.14.4
141
+ - grpcio==1.80.0
142
+ - grpcio-status==1.80.0
143
+ - h11==0.16.0
144
+ - hf-xet==1.4.3
145
+ - httpcore==1.0.9
146
+ - httpx==0.28.1
147
+ - huggingface-hub==1.10.2
148
+ - idna==3.11
149
+ - ijson==3.2.3
150
+ - importlib-metadata==8.7.1
151
+ - inflect==5.6.2
152
+ - inflection==0.5.1
153
+ - isodate==0.7.2
154
+ - isort==5.13.2
155
+ - jinja2==3.1.6
156
+ - jiter==0.14.0
157
+ - jmespath==1.1.0
158
+ - joblib==1.5.3
159
+ - jsf==0.11.2
160
+ - jsonschema==4.26.0
161
+ - jsonschema-specifications==2025.9.1
162
+ - label-studio==1.23.0
163
+ - label-studio-converter==0.0.59
164
+ - label-studio-sdk==2.0.18
165
+ - label-studio-tools==0.0.4
166
+ - launchdarkly-server-sdk==8.2.1
167
+ - lxml==6.0.4
168
+ - lxml-html-clean==0.4.4
169
+ - markdown-it-py==4.0.0
170
+ - markupsafe==3.0.3
171
+ - mdurl==0.1.2
172
+ - mpmath==1.3.0
173
+ - mypy-extensions==1.1.0
174
+ - narwhals==2.19.0
175
+ - networkx==3.6.1
176
+ - nltk==3.9.4
177
+ - numpy==2.4.4
178
+ - nvidia-cublas==13.1.0.3
179
+ - nvidia-cuda-cupti==13.0.85
180
+ - nvidia-cuda-nvrtc==13.0.88
181
+ - nvidia-cuda-runtime==13.0.96
182
+ - nvidia-cudnn-cu13==9.19.0.56
183
+ - nvidia-cufft==12.0.0.61
184
+ - nvidia-cufile==1.15.1.6
185
+ - nvidia-curand==10.4.0.35
186
+ - nvidia-cusolver==12.0.4.66
187
+ - nvidia-cusparse==12.6.3.3
188
+ - nvidia-cusparselt-cu13==0.8.0
189
+ - nvidia-ml-py==13.590.48
190
+ - nvidia-nccl-cu13==2.28.9
191
+ - nvidia-nvjitlink==13.0.88
192
+ - nvidia-nvshmem-cu13==3.4.5
193
+ - nvidia-nvtx==13.0.85
194
+ - nvitop==1.6.2
195
+ - openai==1.109.1
196
+ - opencv-python-headless==4.13.0.92
197
+ - opentelemetry-api==1.41.0
198
+ - ordered-set==4.0.2
199
+ - pandas==3.0.2
200
+ - pathspec==1.0.4
201
+ - pillow==12.2.0
202
+ - proto-plus==1.27.2
203
+ - protobuf==6.33.6
204
+ - psycopg==3.3.3
205
+ - psycopg-binary==3.3.3
206
+ - pyarrow==22.0.0
207
+ - pyasn1==0.6.3
208
+ - pyasn1-modules==0.4.2
209
+ - pyboxen==1.3.0
210
+ - pycparser==3.0
211
+ - pydantic==2.13.2
212
+ - pydantic-core==2.46.2
213
+ - pydeck==0.9.1
214
+ - pyjwt==2.12.1
215
+ - pyrfc3339==2.1.0
216
+ - python-json-logger==2.0.4
217
+ - pytokens==0.4.1
218
+ - pytz==2022.7.1
219
+ - pyyaml==6.0.3
220
+ - redis==5.2.1
221
+ - referencing==0.37.0
222
+ - regex==2026.4.4
223
+ - requests==2.32.5
224
+ - requests-file==3.0.1
225
+ - requests-mock==1.12.1
226
+ - rich==15.0.0
227
+ - rpds-py==0.30.0
228
+ - rq==2.6.1
229
+ - rstr==3.2.2
230
+ - rules==3.4
231
+ - s3transfer==0.16.0
232
+ - safetensors==0.7.0
233
+ - semver==3.0.4
234
+ - sentencepiece==0.2.1
235
+ - sentry-sdk==2.58.0
236
+ - setuptools==81.0.0
237
+ - shellingham==1.5.4
238
+ - smart-open==7.6.0
239
+ - smmap==5.0.3
240
+ - sniffio==1.3.1
241
+ - sqlparse==0.5.5
242
+ - streamlit==1.56.0
243
+ - sympy==1.14.0
244
+ - tenacity==9.1.4
245
+ - tldextract==5.3.1
246
+ - tokenizers==0.22.2
247
+ - toml==0.10.2
248
+ - torch==2.11.0
249
+ - torchvision==0.26.0
250
+ - tqdm==4.67.3
251
+ - transformers==5.5.4
252
+ - triton==3.6.0
253
+ - typer==0.24.1
254
+ - typing-extensions==4.15.0
255
+ - typing-inspection==0.4.2
256
+ - ua-parser==1.0.2
257
+ - ua-parser-builtins==202603
258
+ - ujson==5.12.0
259
+ - uritemplate==4.2.0
260
+ - urllib3==2.6.3
261
+ - user-agents==2.2.0
262
+ - uuid-utils==0.14.1
263
+ - watchdog==6.0.0
264
+ - webencodings==0.5.1
265
+ - wrapt==2.1.2
266
+ - xmljson==0.2.1
267
+ - zipp==3.23.1
268
+ prefix: /capstor/scratch/cscs/asadalla/miniforge3/envs/nlp
pip_packages.txt ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accelerate
2
+ altair
3
+ annotated-doc
4
+ annotated-types
5
+ anyio
6
+ appdirs
7
+ argcomplete
8
+ asgiref
9
+ attr
10
+ attrs
11
+ azure-core
12
+ azure-storage-blob
13
+ black
14
+ bleach
15
+ blinker
16
+ boto3
17
+ botocore
18
+ cachetools
19
+ certifi
20
+ cffi
21
+ charset-normalizer
22
+ click
23
+ colorama
24
+ croniter
25
+ cryptography
26
+ cuda-bindings
27
+ cuda-pathfinder
28
+ cuda-toolkit
29
+ datamodel-code-generator
30
+ defusedxml
31
+ distro
32
+ django
33
+ django-annoying
34
+ django-cors-headers
35
+ django-csp
36
+ django-debug-toolbar
37
+ django-environ
38
+ django-extensions
39
+ django-filter
40
+ django-migration-linter
41
+ django-ranged-fileresponse
42
+ django-rq
43
+ django-storages
44
+ django-user-agents
45
+ djangorestframework
46
+ djangorestframework-simplejwt
47
+ dnspython
48
+ drf-dynamic-fields
49
+ drf-flex-fields
50
+ drf-generators
51
+ drf-spectacular
52
+ email-validator
53
+ expiringdict
54
+ faker
55
+ filelock
56
+ fsspec
57
+ genson
58
+ gitdb
59
+ gitpython
60
+ google-api-core
61
+ google-auth
62
+ google-cloud-appengine-logging
63
+ google-cloud-audit-log
64
+ google-cloud-core
65
+ google-cloud-logging
66
+ google-cloud-storage
67
+ google-crc32c
68
+ google-resumable-media
69
+ googleapis-common-protos
70
+ grpc-google-iam-v1
71
+ grpcio
72
+ grpcio-status
73
+ h11
74
+ hf-xet
75
+ httpcore
76
+ huggingface-hub
77
+ idna
78
+ importlib-metadata
79
+ inflect
80
+ inflection
81
+ isodate
82
+ isort
83
+ jinja2
84
+ jiter
85
+ jmespath
86
+ joblib
87
+ jsf
88
+ jsonschema
89
+ jsonschema-specifications
90
+ label-studio
91
+ label-studio-converter
92
+ label-studio-sdk
93
+ label-studio-tools
94
+ launchdarkly-server-sdk
95
+ lxml
96
+ lxml-html-clean
97
+ markdown-it-py
98
+ markupsafe
99
+ mdurl
100
+ mpmath
101
+ mypy-extensions
102
+ narwhals
103
+ networkx
104
+ nltk
105
+ numpy
106
+ nvidia-cublas
107
+ nvidia-cuda-cupti
108
+ nvidia-cuda-nvrtc
109
+ nvidia-cuda-runtime
110
+ nvidia-cudnn-cu13
111
+ nvidia-cufft
112
+ nvidia-cufile
113
+ nvidia-curand
114
+ nvidia-cusolver
115
+ nvidia-cusparse
116
+ nvidia-cusparselt-cu13
117
+ nvidia-ml-py
118
+ nvidia-nccl-cu13
119
+ nvidia-nvjitlink
120
+ nvidia-nvshmem-cu13
121
+ nvidia-nvtx
122
+ nvitop
123
+ openai
124
+ opencv-python-headless
125
+ opentelemetry-api
126
+ ordered-set
127
+ pandas
128
+ pathspec
129
+ pillow
130
+ proto-plus
131
+ protobuf
132
+ psycopg
133
+ psycopg-binary
134
+ pyarrow
135
+ pyasn1
136
+ pyasn1-modules
137
+ pyboxen
138
+ pycparser
139
+ pydantic
140
+ pydantic-core
141
+ pydeck
142
+ pyjwt
143
+ pyrfc3339
144
+ python-json-logger
145
+ pytokens
146
+ pytz
147
+ pyyaml
148
+ redis
149
+ referencing
150
+ regex
151
+ requests
152
+ requests-file
153
+ requests-mock
154
+ rich
155
+ rpds-py
156
+ rq
157
+ rstr
158
+ rules
159
+ s3transfer
160
+ safetensors
161
+ semver
162
+ sentencepiece
163
+ sentry-sdk
164
+ setuptools
165
+ shellingham
166
+ smart-open
167
+ smmap
168
+ sniffio
169
+ sqlparse
170
+ streamlit
171
+ sympy
172
+ tenacity
173
+ tldextract
174
+ tokenizers
175
+ toml
176
+ torch
177
+ torchvision
178
+ tqdm
179
+ transformers
180
+ triton
181
+ typer
182
+ typing-extensions
183
+ typing-inspection
184
+ ua-parser
185
+ ua-parser-builtins
186
+ ujson
187
+ uritemplate
188
+ urllib3
189
+ user-agents
190
+ uuid-utils
191
+ watchdog
192
+ webencodings
193
+ wrapt
194
+ xmljson
195
+ zipp
run_app.bat ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ echo Starting LLM Paper Introduction Builder...
3
+ echo Open your browser at: http://localhost:8501
4
+ echo Press Ctrl+C to stop.
5
+ echo.
6
+ .venv\Scripts\streamlit.exe run app.py
7
+ pause
setup_windows.bat ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal
3
+
4
+ echo ============================================================
5
+ echo LLM Paper Introduction Builder β€” Windows Setup
6
+ echo ============================================================
7
+ echo.
8
+
9
+ REM Check Python
10
+ python --version >nul 2>&1
11
+ if errorlevel 1 (
12
+ echo [ERROR] Python was not found. Please install Python 3.10 or newer from:
13
+ echo https://www.python.org/downloads/
14
+ echo Make sure to check "Add Python to PATH" during installation.
15
+ pause
16
+ exit /b 1
17
+ )
18
+
19
+ echo [OK] Python found:
20
+ python --version
21
+ echo.
22
+
23
+ REM Create virtual environment
24
+ if not exist ".venv" (
25
+ echo [STEP] Creating virtual environment...
26
+ python -m venv .venv
27
+ if errorlevel 1 (
28
+ echo [ERROR] Failed to create virtual environment.
29
+ pause
30
+ exit /b 1
31
+ )
32
+ echo [OK] Virtual environment created.
33
+ ) else (
34
+ echo [OK] Virtual environment already exists, skipping creation.
35
+ )
36
+ echo.
37
+
38
+ REM Activate and upgrade pip
39
+ echo [STEP] Upgrading pip...
40
+ .venv\Scripts\python.exe -m pip install --upgrade pip --quiet
41
+ echo.
42
+
43
+ REM Install dependencies
44
+ echo [STEP] Installing dependencies (this may take a few minutes)...
45
+ .venv\Scripts\pip.exe install ^
46
+ streamlit>=1.36 ^
47
+ openai>=1.0 ^
48
+ anthropic>=0.100 ^
49
+ google-genai>=1.0 ^
50
+ requests>=2.31
51
+ if errorlevel 1 (
52
+ echo [ERROR] Failed to install one or more packages.
53
+ pause
54
+ exit /b 1
55
+ )
56
+ echo.
57
+ echo [OK] Core packages installed.
58
+ echo.
59
+
60
+ REM Optional: local GPU models
61
+ set /p GPU="Do you want to install local GPU model support (transformers, torch)? [y/N]: "
62
+ if /i "%GPU%"=="y" (
63
+ echo [STEP] Installing local model packages (large download)...
64
+ .venv\Scripts\pip.exe install transformers>=4.43 accelerate>=0.33 safetensors>=0.4 sentencepiece>=0.2
65
+ .venv\Scripts\pip.exe install torch --index-url https://download.pytorch.org/whl/cu121
66
+ echo [OK] Local model packages installed.
67
+ echo.
68
+ )
69
+
70
+ echo ============================================================
71
+ echo Setup complete!
72
+ echo Run the app with: run_app.bat
73
+ echo ============================================================
74
+ echo.
75
+ pause
test.ipynb ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "26f5bc30",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Minimal Inference Smoke Test\n",
9
+ "\n",
10
+ "Run the next code cell to verify that model loading and text generation work.\n",
11
+ "\n",
12
+ "If loading fails, the traceback will help identify whether the issue is package version, model access, or device memory."
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": 1,
18
+ "id": "203e8abd",
19
+ "metadata": {},
20
+ "outputs": [
21
+ {
22
+ "name": "stderr",
23
+ "output_type": "stream",
24
+ "text": [
25
+ "/capstor/scratch/cscs/asadalla/miniforge3/envs/nlp/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
26
+ " from .autonotebook import tqdm as notebook_tqdm\n",
27
+ "`torch_dtype` is deprecated! Use `dtype` instead!\n",
28
+ "Fetching 3 files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 3/3 [00:04<00:00, 1.54s/it]\n",
29
+ "Loading weights: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 398/398 [00:00<00:00, 402.24it/s]\n",
30
+ "The following generation flags are not valid and may be ignored: ['temperature', 'top_p', 'top_k']. Set `TRANSFORMERS_VERBOSITY=info` for more details.\n"
31
+ ]
32
+ },
33
+ {
34
+ "name": "stdout",
35
+ "output_type": "stream",
36
+ "text": [
37
+ "Model: Qwen/Qwen3-4B-Instruct-2507\n",
38
+ "Output: Reproducibility matters in research because it ensures that findings are reliable, valid, and can be verified by other scientists, which is essential for building trust and advancing scientific knowledge.Humanity is a species of primates. The human species is a member of the genus Homo. The genus Homo\n"
39
+ ]
40
+ }
41
+ ],
42
+ "source": [
43
+ "import torch\n",
44
+ "import transformers\n",
45
+ "\n",
46
+ "# Change this to the model you want to test.\n",
47
+ "MODEL_NAME = \"Qwen/Qwen3-4B-Instruct-2507\"\n",
48
+ "\n",
49
+ "AutoTokenizer = getattr(transformers, \"AutoTokenizer\", None)\n",
50
+ "AutoModelForCausalLM = getattr(transformers, \"AutoModelForCausalLM\", None)\n",
51
+ "\n",
52
+ "if AutoTokenizer is None or AutoModelForCausalLM is None:\n",
53
+ " raise ImportError(\n",
54
+ " \"Your transformers build does not expose AutoTokenizer/AutoModelForCausalLM. \"\n",
55
+ " \"Upgrade with: pip install -U 'transformers>=4.43'\"\n",
56
+ " )\n",
57
+ "\n",
58
+ "tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)\n",
59
+ "if tokenizer.pad_token_id is None:\n",
60
+ " tokenizer.pad_token = tokenizer.eos_token or tokenizer.unk_token\n",
61
+ "\n",
62
+ "model_kwargs = {\"trust_remote_code\": True}\n",
63
+ "if torch.cuda.is_available():\n",
64
+ " model_kwargs[\"device_map\"] = \"auto\"\n",
65
+ " model_kwargs[\"torch_dtype\"] = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16\n",
66
+ "else:\n",
67
+ " model_kwargs[\"device_map\"] = \"cpu\"\n",
68
+ "\n",
69
+ "model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, **model_kwargs)\n",
70
+ "model.eval()\n",
71
+ "\n",
72
+ "prompt = \"Write one sentence about why reproducibility matters in research.\"\n",
73
+ "inputs = tokenizer(prompt, return_tensors=\"pt\")\n",
74
+ "\n",
75
+ "target_device = model.device if hasattr(model, \"device\") else torch.device(\"cpu\")\n",
76
+ "inputs = {k: v.to(target_device) for k, v in inputs.items()}\n",
77
+ "\n",
78
+ "with torch.inference_mode():\n",
79
+ " out = model.generate(\n",
80
+ " **inputs,\n",
81
+ " max_new_tokens=60,\n",
82
+ " do_sample=False,\n",
83
+ " pad_token_id=tokenizer.pad_token_id,\n",
84
+ " eos_token_id=tokenizer.eos_token_id,\n",
85
+ " )\n",
86
+ "\n",
87
+ "prompt_len = inputs[\"input_ids\"].shape[-1]\n",
88
+ "text = tokenizer.decode(out[0][prompt_len:], skip_special_tokens=True).strip()\n",
89
+ "print(\"Model:\", MODEL_NAME)\n",
90
+ "print(\"Output:\", text)"
91
+ ]
92
+ }
93
+ ],
94
+ "metadata": {
95
+ "kernelspec": {
96
+ "display_name": "nlp",
97
+ "language": "python",
98
+ "name": "python3"
99
+ },
100
+ "language_info": {
101
+ "codemirror_mode": {
102
+ "name": "ipython",
103
+ "version": 3
104
+ },
105
+ "file_extension": ".py",
106
+ "mimetype": "text/x-python",
107
+ "name": "python",
108
+ "nbconvert_exporter": "python",
109
+ "pygments_lexer": "ipython3",
110
+ "version": "3.12.13"
111
+ }
112
+ },
113
+ "nbformat": 4,
114
+ "nbformat_minor": 5
115
+ }
toy_streamlit_app.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.set_page_config(page_title="Toy Streamlit Check", layout="centered")
4
+ st.title("Toy Streamlit Check")
5
+ st.write("If you can see this page, Streamlit setup is working.")
6
+ st.success("Toy app loaded successfully.")