Skip to content

Bugfix/97 crashes when processing directory#110

Open
melane6 wants to merge 6 commits into
devfrom
bugfix/97-crashes-when-processing-directory
Open

Bugfix/97 crashes when processing directory#110
melane6 wants to merge 6 commits into
devfrom
bugfix/97-crashes-when-processing-directory

Conversation

@melane6
Copy link
Copy Markdown
Collaborator

@melane6 melane6 commented Aug 12, 2025

The pull request adds support for processing entire directories of input files in ReX, The main changes enable users to specify a directory as input, which will trigger ReX to process all files within that directory. Additionally, there are updates to how output paths are handled when working with directories.

Directory processing support:

  • Added a directory boolean attribute to the CausalArgs configuration, set automatically if the input path is a directory, allowing ReX to process all files in the directory (rex_xai/input/config.py, rex_xai/rex_wrapper.py).
  • Updated the main entry point to iterate over all files in a directory when args.directory is set, running the explanation pipeline on each file (rex_xai/rex_wrapper.py).

Output path handling improvements:

  • Modified output path logic in the explanation function to generate unique output file names when processing directories, preventing file overwrites (rex_xai/explanation/rex.py).

Minor Changes

  • Reformatted code with ruff

@melane6 melane6 linked an issue Aug 12, 2025 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py00100% 
lib.py99990%1, 3, 5–6, 8–15, 18–19, 27–36, 38–39, 41–46, 54–56, 58–60, 62–68, 70–72, 74, 76–77, 79–81, 84, 86–87, 89–95, 98–100, 102–104, 111, 113–115, 117, 119–122, 124–127, 129–130, 132–133, 135–139, 142–143, 146–147, 153, 155–156
rex_wrapper.py26260%3, 5–7, 9–11, 14, 16–18, 20, 22, 24–26, 28–36, 38
explanation
   evaluation.py105991%29, 49–53, 55–56, 78
   explanation.py31116048%38, 45, 54, 95, 98, 101, 112–113, 121, 177, 206, 243, 247–248, 253–254, 259–261, 263–267, 269, 273, 287, 314, 327, 329–330, 332–333, 339, 347–351, 354, 358–359, 361, 372–373, 376–380, 382–385, 387–388, 390, 394–395, 397–399, 403, 405–406, 413–415, 419, 423–424, 426–427, 429–431, 433, 437, 443–444, 448, 451–454, 463, 466–467, 469–470, 472, 474, 477, 479–481, 483–484, 486–487, 489–492, 494, 498–499, 509, 511–514, 516, 519, 523, 533–536, 541, 544, 552–553, 557–559, 561–563, 568, 571, 574, 578, 587, 590, 594–595, 598, 600–601, 608, 610–612, 625, 628, 643, 651, 662–663, 670, 681–682, 685, 692, 695–697, 703, 705
   multi_explanation.py1675268%51, 71, 97–99, 101–103, 105–108, 110–113, 116, 118–119, 126, 128–129, 131, 159, 203, 205–210, 213–220, 233, 249, 268–271, 277–280, 283–285
   rex.py26810062%59–60, 74, 88, 115, 119, 126, 129–130, 145, 147, 149, 155, 160, 198–199, 235–236, 241, 336–337, 399, 424–426, 428–431, 433–434, 439–440, 445–447, 457–460, 463–465, 467–469, 472–473, 475–477, 479, 481–482, 485–486, 488–490, 492, 494–495, 497, 500–502, 504–505, 508–509, 511–512, 540, 546, 554, 556, 580, 582–583, 586, 589–596, 598–605, 613–615, 619
input
   config.py3657878%112, 119, 124, 161, 168, 173, 178, 180, 184–185, 375–377, 387, 389, 391, 405, 407, 434, 448, 450–452, 454–456, 458, 460, 473, 583–585, 594–596, 605–607, 620, 634–640, 644–645, 647–648, 650–653, 656–661, 664, 666–668, 673, 675–677, 679, 681, 683, 685–686, 688, 700, 704, 708, 783
   input_data.py1704573%61–68, 70, 73, 76, 79, 89, 103, 105, 113, 129, 139–140, 142–143, 146–151, 160, 163, 167, 199, 205–206, 226, 228, 233–240, 243–244
   onnx.py974058%41, 48, 61–62, 64–65, 83–85, 98, 100–102, 105, 108–110, 112–113, 122, 124, 126, 135–138, 151–152, 177–178, 180–184, 187, 189–191, 194
mutants
   box.py1672485%69–73, 106, 113, 166, 176, 253, 264, 276, 345–346, 357, 368, 388, 446–447, 462, 478, 488–489, 515
   distributions.py501374%28, 39, 62, 68, 82, 93–96, 98, 100–102
   mutant.py1054359%11–12, 54–56, 82, 93, 102, 122, 125–127, 129, 131–132, 134–135, 137–141, 143, 145–150, 152–155, 157–158, 161–163, 165–167, 169–170
   occlusions.py28582%65–68, 71
output
   database.py2101791%28, 118–121, 128–130, 135–138, 206, 237, 285–286, 311
   visualisation.py41219951%29–31, 33–47, 49–57, 59–65, 67–68, 70–71, 73, 89, 113, 124, 128–131, 133–139, 141, 143–145, 149–157, 159–160, 162–164, 168, 170, 172–173, 175, 177, 179–180, 182–183, 238–239, 241, 244–245, 251, 256, 263, 265–267, 269–271, 273–274, 276–278, 280, 282, 291, 293, 325, 373, 378, 382, 425, 435–436, 438–440, 442–443, 445–446, 448–449, 451, 453–457, 460–461, 463–464, 482, 488, 490–492, 494, 496, 498–502, 504–505, 507, 511, 513–516, 518, 520, 522–526, 528–529, 531, 538–539, 548–550, 560, 566–567, 570–579, 586–589, 592, 596, 608, 611, 616, 645, 651–661
responsibility
   prediction.py44588%28, 35, 37, 40, 43
   resp_maps.py1082180%8–9, 41–42, 46, 49, 61, 64, 76, 84–86, 89, 102, 128, 136, 147, 157–158, 164–165
   responsibility.py1484370%15–16, 45, 76, 78–90, 96, 98, 120–121, 123–124, 126–128, 131–132, 135–136, 260–262, 266, 296–297, 300–301, 304, 316–317, 319–320
utils
   _utils.py1785469%29, 49, 57, 80–81, 84–85, 90, 95–96, 99, 104, 114–116, 120–121, 129, 138, 142–143, 151, 171, 176–177, 180, 185–186, 189, 198, 203–204, 207, 211–212, 216–217, 219, 226, 236, 238, 240, 266–268, 274–276, 288, 291, 294–295, 297, 305
   logger.py14750%11–16, 18
TOTAL3072104066% 

@melane6 melane6 requested a review from kellino December 10, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashes when processing directory

1 participant