(self)
| 174 | exists('transformers<5.0'), |
| 175 | 'Skip test because transformers version is too high.') |
| 176 | def test_train_visualization(self): |
| 177 | json_cfg = { |
| 178 | 'task': Tasks.image_classification, |
| 179 | 'train': { |
| 180 | 'work_dir': |
| 181 | self.tmp_dir, |
| 182 | 'dataloader': { |
| 183 | 'batch_size_per_gpu': 2, |
| 184 | 'workers_per_gpu': 1 |
| 185 | }, |
| 186 | 'optimizer': { |
| 187 | 'type': 'SGD', |
| 188 | 'lr': 0.01, |
| 189 | 'options': { |
| 190 | 'grad_clip': { |
| 191 | 'max_norm': 2.0 |
| 192 | } |
| 193 | } |
| 194 | }, |
| 195 | 'lr_scheduler': { |
| 196 | 'type': 'StepLR', |
| 197 | 'step_size': 2, |
| 198 | 'options': { |
| 199 | 'warmup': { |
| 200 | 'type': 'LinearWarmup', |
| 201 | 'warmup_iters': 2 |
| 202 | } |
| 203 | } |
| 204 | }, |
| 205 | 'hooks': [{ |
| 206 | 'type': 'CheckpointHook', |
| 207 | 'interval': 1 |
| 208 | }, { |
| 209 | 'type': 'TextLoggerHook', |
| 210 | 'interval': 1 |
| 211 | }, { |
| 212 | 'type': 'IterTimerHook' |
| 213 | }, { |
| 214 | 'type': 'EvaluationHook', |
| 215 | 'interval': 1 |
| 216 | }, { |
| 217 | 'type': 'TensorboardHook', |
| 218 | 'interval': 1 |
| 219 | }] |
| 220 | }, |
| 221 | 'evaluation': { |
| 222 | 'dataloader': { |
| 223 | 'batch_size_per_gpu': 2, |
| 224 | 'workers_per_gpu': 1, |
| 225 | 'shuffle': False |
| 226 | }, |
| 227 | 'metrics': [Metrics.seq_cls_metric], |
| 228 | 'visualization': {}, |
| 229 | } |
| 230 | } |
| 231 | config_path = os.path.join(self.tmp_dir, ModelFile.CONFIGURATION) |
| 232 | with open(config_path, 'w') as f: |
| 233 | json.dump(json_cfg, f) |
nothing calls this directly
no test coverage detected