| 137 | |
| 138 | |
| 139 | class InputListParser: |
| 140 | def __init__(self, input_list): |
| 141 | self.input_list = input_list |
| 142 | |
| 143 | def __iter__(self): |
| 144 | with open(self.input_list, "r") as f: |
| 145 | for line in re.split(r"\r?\n", f.read()): |
| 146 | if not line: |
| 147 | continue |
| 148 | split_line = line.strip().split(" ") |
| 149 | inputs = {} |
| 150 | if ":=" in line: |
| 151 | for input_assignment in split_line: |
| 152 | name, path = input_assignment.split(":=") |
| 153 | inputs[name] = torch.load(path, weights_only=True) |
| 154 | else: |
| 155 | inputs = [torch.load(t, weights_only=True) for t in split_line] |
| 156 | yield inputs |
| 157 | |
| 158 | |
| 159 | def quantize(args): |