Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release readme #70

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/Mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,19 @@ cd base_miner/UCF/ && python train_detector.py
```
The model with the lowest validation accuracy will be saved to `base_miner/UCF/logs/training/<experiment_name>/`.<br>

In this directory, you will find your model weights (`ckpt_best.pth`) and training configuration (`config.yaml`).
In this directory, you will find your model weights (`ckpt_best.pth`) and training configuration (`config.yaml`). Note that
the training config, e.g. `config.yaml`, is different from the detector config, e.g. `ucf.yaml`.


## Deploy Your Model

Once you've trained your own detector model, you can simply update the configuration file for your miner to point to your new `.pth` file.
- Your detector type and associated config file are set in `miner.env`.
- The detector config file (e.g., `ucf.yaml`) live in `base_miner/deepfake_detectors/configs/`.
Whether you have trained your own model, designed your own ``DeepfakeDetector`` subclass, or want to deploy a base miner using provided detectors in ``base_miner/deepfake_detectors/``, you can simply update the `miner.env` file to point to the desired detector class and config.

We recommend consulting the `README` in `base_miner/` to learn about the extensibility and modular design of our base miner detectors.

- The detector type (e.g. `UCF`) corresponds to the module name of the ``DeepfakeDetector`` subclass registered in ``base_miner/registry.py``'s ``DETECTOR_REGISTRY``.
- The associated detector config file (e.g., `ucf.yaml`) lives in `base_miner/deepfake_detectors/configs/`.
- *For UCF only:* You will need to set the `train_config` field in the detector configuration file (`base_miner/deepfake_detectors/configs/ucf.yaml`) to point to the training configuration file. This allows the instantiation of `UCFDetector` to use the settings from training time to reconstruct the correct model architecture. After training a model, the training config can be found in `base_miner/UCF/logs/<your_training_run>/config.yaml`. Feel free to move this to a different location, as long as the `train_config` field in `configs/ucf.yaml` reflects this.
- The model weights file (e.g., `ckpt_best.pth`) should be placed in `base_miner/<detector_type>/weights`.
- If the weights specified in the config file do not exist, the miner will attempt to automatically download them from Hugging Face as specified by the `hf_repo` field in the config file. Feel free to use your own Hugging Face repository for hosting your model weights, and update the config file accordingly.

Expand Down
Loading