WebGPU (Python) strategy

This commit is contained in:
josc146
2023-12-14 20:39:42 +08:00
parent 2f45e9c33a
commit 18d4b2304e
2 changed files with 10 additions and 5 deletions

View File

@@ -12,8 +12,13 @@ except ModuleNotFoundError:
class RWKV:
def __init__(self, model_path: str, strategy=None):
self.model = wrp.v5.Model(model_path, turbo=False)
def __init__(self, model_path: str, strategy: str = None):
self.model = wrp.v5.Model(
model_path,
turbo=False,
quant=32 if "i8" in strategy else None,
quant_nf4=26 if "i4" in strategy else None,
)
self.w = {} # fake weight
self.w["emb.weight"] = [0] * wrp.peek_info(model_path).num_vocab