MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / main

Function main

quantization/autoclip.py:209–232  ·  view source on GitHub ↗
(args, q_config)

Source from the content-addressed store, hash-verified

207
208
209def main(args, q_config):
210 if args.dump_clip and os.path.exists(args.dump_clip):
211 print(f"Found existing AWQ results {args.dump_clip}, exit.")
212 exit()
213
214 model, enc = build_model_and_enc(args.model_path)
215
216 if args.run_clip:
217 assert args.dump_clip, "Please save the awq results with --dump_awq"
218
219 clip_results = run_clip(
220 model, enc,
221 w_bit=args.w_bit, q_config=q_config,
222 n_samples=args.n_samples, seqlen=args.seqlen, datasets=args.calib_dataset
223 )
224
225 if args.dump_clip:
226 dirpath = os.path.dirname(args.dump_clip)
227 os.makedirs(dirpath, exist_ok=True)
228
229 torch.save(clip_results, args.dump_clip)
230 print("Clipping results saved at", args.dump_clip)
231
232 exit(0)
233
234if __name__ == '__main__':
235 parser = argparse.ArgumentParser()

Callers 1

autoclip.pyFile · 0.70

Calls 2

run_clipFunction · 0.85
build_model_and_encFunction · 0.70

Tested by

no test coverage detected