MCPcopy
hub / github.com/z-lab/dflash / _patch_model

Function _patch_model

dflash/model_mlx.py:284–290  ·  view source on GitHub ↗
(model, layer_ids)

Source from the content-addressed store, hash-verified

282
283
284def _patch_model(model, layer_ids):
285 if hasattr(model, "_hidden_states"):
286 return
287 model._hidden_states = [None] * len(layer_ids)
288 layers = _get_layers(model)
289 for i, lid in enumerate(layer_ids):
290 layers[lid] = _LayerHook(layers[lid], i, model._hidden_states)
291
292
293class _GDNStateCapture:

Callers 1

stream_generateFunction · 0.85

Calls 2

_get_layersFunction · 0.85
_LayerHookClass · 0.85

Tested by

no test coverage detected