This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "model_name": "Crossformer", | |
| "use_decoder": true, | |
| "model_type": "PyTorch", | |
| "model_params": { | |
| "n_time_series": 4, | |
| "forecast_history":6, | |
| "forecast_length": 4, | |
| "seg_len": 6 | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wandb_version: 1 | |
| GCS: | |
| desc: null | |
| value: true | |
| _wandb: | |
| desc: null | |
| value: | |
| cli_version: 0.10.17 | |
| framework: torch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| class TransformerXCBasic(torch.nn.Module): | |
| """ Transformer model """ | |
| def __init__(self, n_time_series, out_seq_len, device, d_model=128, dropout=.5, n_head=8): | |
| super(TransformerXCBasic, self).__init__() | |
| self.input_dim = n_time_series | |
| self.n_head = n_head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model = model_class.from_pretrained(self.args.model_path, | |
| config=config, | |
| # SpERT model parameters | |
| cls_token=self._tokenizer.convert_tokens_to_ids('[CLS]'), | |
| relation_types=input_reader.relation_type_count - 1, | |
| entity_types=input_reader.entity_type_count, | |
| max_pairs=self.args.max_pairs, | |
| prop_drop=self.args.prop_drop, | |
| size_embedding=self.args.size_embedding, | |
| freeze_transformer=self.args.freeze_transformer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _column_definition = [ | |
| ('id', DataTypes.REAL_VALUED, InputTypes.ID), | |
| ('hours_from_start', DataTypes.REAL_VALUED, InputTypes.TIME), | |
| ('power_usage', DataTypes.REAL_VALUED, InputTypes.TARGET), | |
| ('hour', DataTypes.REAL_VALUED, InputTypes.KNOWN_INPUT), | |
| ('day_of_week', DataTypes.REAL_VALUED, InputTypes.KNOWN_INPUT), | |
| ('hours_from_start', DataTypes.REAL_VALUED, InputTypes.KNOWN_INPUT), | |
| ('categorical_id', DataTypes.CATEGORICAL, InputTypes.STATIC_INPUT), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| label = conll04_eval | |
| model_type = spert | |
| model_path = data/models/ade | |
| tokenizer_path = data/models/ade | |
| dataset_path = data/datasets/ade/ade_split_0_test.json | |
| types_path = data/datasets/ade/ade_types.json | |
| eval_batch_size = 1 | |
| rel_filter_threshold = 0.4 | |
| size_embedding = 25 | |
| prop_drop = 0.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| label = ade_eval | |
| model_type = spert | |
| model_path = data/models/ade | |
| tokenizer_path = data/models/ade | |
| dataset_path = data/datasets/conll04/conll04_test.json | |
| types_path = data/datasets/conll04/conll04_types.json | |
| eval_batch_size = 1 | |
| rel_filter_threshold = 0.4 | |
| size_embedding = 25 | |
| prop_drop = 0.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def train_epoch_loop(data_loader:DataLoader, opt:torch.optim, model:PyTorchForecast, takes_target:bool, forward_params={}) | |
| i = 0 | |
| running_loss = 0.0 | |
| for src, trg in data_loader: | |
| opt.zero_grad() | |
| # Convert to CPU/GPU/TPU | |
| src = src.to(model.device) | |
| trg = trg.to(model.device) | |
| # TODO figure how to avoid | |
| if takes_target: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM pytorch/pytorch:1.4-cuda10.1-cudnn7-devel | |
| COPY requirements.txt /tmp/ | |
| RUN pip install -r /tmp/requirements.txt | |
| ARG url | |
| RUN git clone -n https://github.com/example/example_repo | |
| RUN git checkout 543231 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @TrainerBase.register('metatrainer') | |
| class MetaTrainer(Trainer): | |
| def __init__(self, | |
| model: Model, | |
| meta_model: MetaModel, | |
| optimizer: torch.optim.Optimizer, | |
| iterator: DataIterator, | |
| train_datasets: List[Iterable[Instance]], | |
| validation_datasets: Optional[Iterable[Instance]] = None, |
NewerOlder