MCPcopy Create free account
hub / github.com/OpenGVLab/EfficientQAT / update_dataset

Function update_dataset

quantize/block_ap.py:22–30  ·  view source on GitHub ↗
(layer, dataset, dev, attention_mask, position_ids)

Source from the content-addressed store, hash-verified

20import os
21
22def update_dataset(layer, dataset, dev, attention_mask, position_ids):
23 with torch.no_grad():
24 with torch.cuda.amp.autocast():
25 for index, inps in enumerate(dataset):
26 inps = inps.to(dev)
27 if len(inps.shape)==2:
28 inps = inps.unsqueeze(0)
29 new_data = layer(inps, attention_mask=attention_mask,position_ids=position_ids)[0].to('cpu')
30 dataset.update_data(index,new_data)
31
32
33def block_ap(

Callers 1

block_apFunction · 0.85

Calls 1

update_dataMethod · 0.80

Tested by

no test coverage detected