(self)
| 111 | |
| 112 | class TestPostTrainingQuantization(unittest.TestCase): |
| 113 | def setUp(self): |
| 114 | self.int8_download = "int8/download" |
| 115 | self.cache_folder = os.path.expanduser( |
| 116 | "~/.cache/paddle/dataset/" + self.int8_download |
| 117 | ) |
| 118 | self.data_cache_folder = "" |
| 119 | data_urls = [] |
| 120 | data_md5s = [] |
| 121 | if os.environ.get("DATASET") == "full": |
| 122 | data_urls.append( |
| 123 | "https://paddle-inference-dist.bj.bcebos.com/int8/ILSVRC2012_img_val.tar.gz.partaa" |
| 124 | ) |
| 125 | data_md5s.append("60f6525b0e1d127f345641d75d41f0a8") |
| 126 | data_urls.append( |
| 127 | "https://paddle-inference-dist.bj.bcebos.com/int8/ILSVRC2012_img_val.tar.gz.partab" |
| 128 | ) |
| 129 | data_md5s.append("1e9f15f64e015e58d6f9ec3210ed18b5") |
| 130 | self.data_cache_folder = self.download_data( |
| 131 | data_urls, data_md5s, "full_data", False |
| 132 | ) |
| 133 | else: |
| 134 | data_urls.append( |
| 135 | "http://paddle-inference-dist.bj.bcebos.com/int8/calibration_test_data.tar.gz" |
| 136 | ) |
| 137 | data_md5s.append("1b6c1c434172cca1bf9ba1e4d7a3157d") |
| 138 | self.data_cache_folder = self.download_data( |
| 139 | data_urls, data_md5s, "small_data", False |
| 140 | ) |
| 141 | |
| 142 | # reader/decorator.py requires the relative path to the data folder |
| 143 | if not os.path.exists("./data/ILSVRC2012"): |
| 144 | cmd = "rm -rf {0} && ln -s {1} {0}".format("data", self.data_cache_folder) |
| 145 | os.system(cmd) |
| 146 | |
| 147 | self.batch_size = 1 if os.environ.get("DATASET") == "full" else 50 |
| 148 | self.sample_iterations = 50 if os.environ.get("DATASET") == "full" else 2 |
| 149 | self.infer_iterations = 50000 if os.environ.get("DATASET") == "full" else 2 |
| 150 | |
| 151 | self.int8_model = "./post_training_quantize_model/" |
| 152 | |
| 153 | def tearDown(self): |
| 154 | pass |
nothing calls this directly
no test coverage detected