|
10 | 10 | import json |
11 | 11 | import logging |
12 | 12 | import re |
13 | | -import types |
14 | 13 |
|
15 | 14 | from functools import partial |
16 | 15 | from typing import Any, Dict, List |
|
106 | 105 | from executorch.extension.llm.custom_ops import model_sharding |
107 | 106 | from executorch.extension.llm.export.builder import DType |
108 | 107 | from torch.utils.data import DataLoader |
109 | | -from torchao.prototype.spinquant import apply_spinquant |
110 | 108 | from torchao.quantization.pt2e import MinMaxObserver |
111 | 109 | from torchao.quantization.pt2e.quantize_pt2e import convert_pt2e, prepare_pt2e |
112 | 110 | from transformers import AutoModel, AutoModelForSpeechSeq2Seq |
@@ -290,21 +288,10 @@ def permute(w, heads, partial_rotary_dim): |
290 | 288 |
|
291 | 289 | decoder.load_state_dict(state_dict, strict=True, assign=True) |
292 | 290 |
|
293 | | - # apply spin quant if required |
294 | 291 | if any([self.config.r1, self.config.r2]): |
295 | | - decoder.config = types.SimpleNamespace( |
296 | | - dim=decoder.dim, |
297 | | - head_dim=decoder.dim // decoder.n_heads, |
298 | | - n_local_heads=decoder.n_heads, |
299 | | - intermediate_size=4 * decoder.dim, |
300 | | - ) |
301 | | - apply_spinquant( |
302 | | - decoder, |
303 | | - use_r1=self.config.r1, |
304 | | - use_r2=self.config.r2, |
305 | | - use_r4=False, |
306 | | - pretrained_rotation_path=None, |
307 | | - qkv_split=True, |
| 292 | + raise RuntimeError( |
| 293 | + "SpinQuant (r1/r2) is no longer supported: the " |
| 294 | + "torchao.prototype.spinquant module has been deleted." |
308 | 295 | ) |
309 | 296 |
|
310 | 297 | # perform model transformation |
|
0 commit comments