|
11 | 11 |
|
12 | 12 | import torch |
13 | 13 | import torch.nn as nn |
14 | | -import torchao |
15 | 14 | from torch.nn.parallel.distributed import DistributedDataParallel |
16 | 15 |
|
17 | 16 | _EXPORT_UTILS_AVAIL = True |
18 | 17 | try: |
| 18 | + from torchao.quantization.pt2e import ( |
| 19 | + move_exported_model_to_eval, |
| 20 | + move_exported_model_to_train, |
| 21 | + ) |
19 | 22 | from torchao.quantization.pt2e.export_utils import model_is_exported |
20 | 23 | except Exception: |
21 | 24 | _EXPORT_UTILS_AVAIL = False |
22 | 25 |
|
| 26 | + def model_is_exported(model: nn.Module) -> bool: |
| 27 | + return False |
| 28 | + |
| 29 | + def move_exported_model_to_eval(model: nn.Module) -> None: |
| 30 | + pass |
| 31 | + |
| 32 | + def move_exported_model_to_train(model: nn.Module) -> None: |
| 33 | + pass |
| 34 | + |
| 35 | + |
23 | 36 | from torchtnt.utils.progress import Progress |
24 | 37 |
|
25 | 38 | _logger: logging.Logger = logging.getLogger(__name__) |
@@ -102,9 +115,7 @@ def _set_module_training_mode( |
102 | 115 | else module |
103 | 116 | ): |
104 | 117 | move_fn = ( |
105 | | - torchao.quantization.pt2e.move_exported_model_to_train |
106 | | - if mode |
107 | | - else torchao.quantization.pt2e.move_exported_model_to_eval |
| 118 | + move_exported_model_to_train if mode else move_exported_model_to_eval |
108 | 119 | ) |
109 | 120 | # pyre-fixme[6]: For 1st argument expected `GraphModule` but got |
110 | 121 | # `Union[Module, Tensor]`. |
@@ -137,9 +148,9 @@ def _reset_module_training_mode( |
137 | 148 | else module |
138 | 149 | ): |
139 | 150 | move_fn = ( |
140 | | - torchao.quantization.pt2e.move_exported_model_to_train |
| 151 | + move_exported_model_to_train |
141 | 152 | if prior_modes[name] |
142 | | - else torchao.quantization.pt2e.move_exported_model_to_eval |
| 153 | + else move_exported_model_to_eval |
143 | 154 | ) |
144 | 155 | # pyre-fixme[6]: For 1st argument expected `GraphModule` but got |
145 | 156 | # `Union[Module, Tensor]`. |
|
0 commit comments