Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Alternate simpler fix for jailbreak model loading issue - #75

Merged
rootfs merged 1 commit into
redhat-et:classifyfrom
srampal:torch_loading_fix
Aug 26, 2025
Merged

Alternate simpler fix for jailbreak model loading issue#75
rootfs merged 1 commit into
redhat-et:classifyfrom
srampal:torch_loading_fix

Conversation

@srampal

@srampal srampal commented Aug 23, 2025

Copy link
Copy Markdown
Contributor

Strip _orig_mod when saving instead of during retrieval as done in prior fix attempt
Alternate fix for #54

@srampal

srampal commented Aug 24, 2025

Copy link
Copy Markdown
Contributor Author

This fix also includes a self-test that ensures the correct model parameters are saved.

This was verified by fine tuning a model and verifying that the model parameters saved are the same as the original ones without the torch compile prefixes as seen in the output of training below.

{'train_runtime': 131505.762, 'train_samples_per_second': 81.284, 'train_steps_per_second': 3.695, 'train_loss': 0.0005007739498931483, 'epoch': 10.0}
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████| 485870/485870 [36:31:45<00:00, 3.69it/s]
INFO:main:Training completed successfully!
INFO:main:Detected torch.compile wrapper, extracting original model for saving...
INFO:main:Parameter verification: True
INFO:main:Model and tokenizer saved to jailbreak_classifier_modernbert-base_model without compile prefixes
INFO:main:Evaluating on validation set...
W0824 14:11:52.817000 82749 torch/fx/experimental/symbolic_shapes.py:6823] [2/3] _maybe_guard_rel() was called on non-relation expression Eq(s53, 1) | Eq(s70, s53)
INFO:main:Validation accuracy: 0.9998
INFO:main:Evaluating on test set...
INFO:main:Test accuracy: 0.9998

==================================================
Jailbreak Classification Fine-tuning Completed!

Validation Accuracy: 0.9998
Test Accuracy: 0.9998

@srampal
srampal marked this pull request as ready for review August 24, 2025 21:05
@srampal
srampal force-pushed the torch_loading_fix branch from 2af71d6 to 97d8985 Compare August 24, 2025 21:11
@srampal

srampal commented Aug 24, 2025

Copy link
Copy Markdown
Contributor Author

Someone with admin privileges needs to address the workflow permissions error (Owner Notification ...), I believe.

@Xunzhuo

Xunzhuo commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

Author

/cc @rootfs

@rootfs
rootfs merged commit aef795d into redhat-et:classify Aug 26, 2025
3 of 4 checks passed
@srampal
srampal deleted the torch_loading_fix branch August 26, 2025 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants