| """ | |
| Copyright $today.year LY Corporation | |
| LY Corporation licenses this file to you under the Apache License, | |
| version 2.0 (the "License"); you may not use this file except in compliance | |
| with the License. You may obtain a copy of the License at: | |
| https://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software | |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |
| License for the specific language governing permissions and limitations | |
| under the License. | |
| Moment-DETR (https://github.com/jayleicn/moment_detr) | |
| Copyright (c) 2021 Jie Lei | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all | |
| copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| SOFTWARE. | |
| """ | |
| from transformers import PretrainedConfig | |
| class AMDETRConfig(PretrainedConfig): | |
| model_type = "amdetr" | |
| def __init__( | |
| self, | |
| seed: int = 2023, | |
| device: str = "cuda", | |
| num_workers: int = 4, | |
| lr: float = 0.0001, | |
| lr_drop: int = 400, | |
| wd: float = 0.0001, | |
| n_epoch: int = 100, | |
| max_es_cnt: int = 200, | |
| bsz: int = 32, | |
| eval_bsz: int = 100, | |
| grad_clip: float = 0.1, | |
| max_q_l: int = 32, | |
| max_v_l: int = 75, | |
| max_windows: int = 5, | |
| clip_length: int = 1, | |
| eval_epoch_interval: int = 1, | |
| position_embedding: str = "sine", | |
| enc_layers: int = 2, | |
| dec_layers: int = 2, | |
| dim_feedforward: int = 1024, | |
| hidden_dim: int = 256, | |
| input_dropout: float = 0.5, | |
| dropout: float = 0.1, | |
| nheads: int = 8, | |
| num_queries: int = 10, | |
| n_input_proj: int = 2, | |
| saliency_margin: float = 0.2, | |
| span_loss_type: str = "l1", | |
| set_cost_span: int = 10, | |
| set_cost_giou: int = 1, | |
| set_cost_class: int = 4, | |
| span_loss_coef: int = 10, | |
| giou_loss_coef: int = 1, | |
| label_loss_coef: int = 4, | |
| eos_coef: float = 0.1, | |
| lw_saliency: int = 1, | |
| ckpt_filename: str = "best.ckpt", | |
| train_log_filename: str = "train.log", | |
| eval_log_filename: str = "val.log", | |
| eval_split_name: str = "val", | |
| aux_loss: bool = True, | |
| model_ema: bool = False, | |
| ema_decay: float = 0.9, | |
| results_dir: str = "results/qd_detr/clotho-moment/clap", | |
| ctx_mode: str = "audio_tef", | |
| v_feat_types: None = None, | |
| a_feat_types: str = "clap", | |
| t_feat_type: str = "clap", | |
| v_feat_dim: int = 2, | |
| a_feat_dim: int = 768, | |
| t_feat_dim: int = 768, | |
| model_name: str = "qd_detr", | |
| dset_name: str = "clotho-moment", | |
| train_path: str = "data/clotho_moment/clotho_moment_train_release.jsonl", | |
| eval_path: str = "data/clotho_moment/clotho_moment_val_release.jsonl", | |
| ckpt_filepath: str = "results/qd_detr/clotho-moment/clap/best.ckpt", | |
| train_log_filepath: str = "results/qd_detr/clotho-moment/clap/train.log", | |
| eval_log_filepath: str = "results/qd_detr/clotho-moment/clap/val.log", | |
| v_feat_dirs: None = None, | |
| t_feat_dir: str = "features/clotho-moment/clap_text", | |
| a_feat_dirs: list = ['features/clotho-moment/clap'], | |
| t_feat_dir_pretrain_eval: None = None, | |
| train_log_txt_formatter: str = "{time_str} [Epoch] {epoch:03d} [Loss] {loss_str}\n", | |
| eval_log_txt_formatter: str = "{time_str} [Epoch] {epoch:03d} [Loss] {loss_str} [Metrics] {eval_metrics_str}\n", | |
| **kwargs | |
| ) -> None: | |
| args_and_values = locals() | |
| for arg_name, arg_value in args_and_values.items(): | |
| if arg_name != 'self': | |
| setattr(self, arg_name, arg_value) | |
| super().__init__(**kwargs) | |
| if __name__ == "__main__": | |
| cfg = AMDETRConfig() | |
| print(cfg) | |