manu02 commited on
Commit
07dc9e2
·
1 Parent(s): 28755c0

Restore CXR Transformers 4 compatibility

Browse files
Files changed (3) hide show
  1. README.md +2 -1
  2. requirements.txt +2 -1
  3. utils/modifiedGPT2.py +2 -2
README.md CHANGED
@@ -4,6 +4,7 @@ emoji: 🫁
4
  colorFrom: blue
5
  colorTo: indigo
6
  sdk: gradio
 
7
  app_file: app.py
8
  license: mit
9
  pinned: true
@@ -200,4 +201,4 @@ Ideal for research in:
200
  * Powered by **Gradio** and **Hugging Face Transformers**
201
  * Based on and expanded from the **Token-Attention-Viewer** project
202
  🔗 [https://github.com/devMuniz02/Image-Attention-Visualizer](https://github.com/devMuniz02/Image-Attention-Visualizer)
203
- * Created as part of a thesis on **efficient and explainable multimodal medical AI**
 
4
  colorFrom: blue
5
  colorTo: indigo
6
  sdk: gradio
7
+ sdk_version: 5.49.1
8
  app_file: app.py
9
  license: mit
10
  pinned: true
 
201
  * Powered by **Gradio** and **Hugging Face Transformers**
202
  * Based on and expanded from the **Token-Attention-Viewer** project
203
  🔗 [https://github.com/devMuniz02/Image-Attention-Visualizer](https://github.com/devMuniz02/Image-Attention-Visualizer)
204
+ * Created as part of a thesis on **efficient and explainable multimodal medical AI**
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
- transformers==5.8.0
 
2
  torch==2.9.0
3
  torchvision==0.24.0
4
  fsspec==2025.10.0
 
1
+ transformers==4.57.1
2
+ gradio==5.49.1
3
  torch==2.9.0
4
  torchvision==0.24.0
5
  fsspec==2025.10.0
utils/modifiedGPT2.py CHANGED
@@ -359,7 +359,7 @@ class GPT2ModelModified(GPT2Model):
359
 
360
  causal_mask = create_causal_mask(
361
  config=self.config_causal,
362
- inputs_embeds=inputs_embeds,
363
  attention_mask=attention_mask,
364
  cache_position=cache_position,
365
  past_key_values=past_key_values,
@@ -709,4 +709,4 @@ def create_decoder(attention = "sdpa"):
709
  decoder = GPT2LMHeadModelModified.from_pretrained("gpt2", config=config)
710
  decoder.config._attn_implementation = attention
711
  decoder = expand_gpt2_positional_embeddings(decoder, new_max_positions=new_max_positions, mode="linear")
712
- return decoder
 
359
 
360
  causal_mask = create_causal_mask(
361
  config=self.config_causal,
362
+ input_embeds=inputs_embeds,
363
  attention_mask=attention_mask,
364
  cache_position=cache_position,
365
  past_key_values=past_key_values,
 
709
  decoder = GPT2LMHeadModelModified.from_pretrained("gpt2", config=config)
710
  decoder.config._attn_implementation = attention
711
  decoder = expand_gpt2_positional_embeddings(decoder, new_max_positions=new_max_positions, mode="linear")
712
+ return decoder