File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
examples/models/llama/source_transformation Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -205,8 +205,11 @@ def replace_kv_cache_with_quantized_kv_cache(module):
205205 # This is needed to ensure that custom ops are registered
206206 from executorch .extension .llm .custom_ops import custom_ops # noqa: F401
207207
208+ import resource
209+ maxrss = resource .getrusage (resource .RUSAGE_SELF ).ru_maxrss
210+ nswap = resource .getrusage (resource .RUSAGE_SELF ).ru_nswap
208211 logging .warning (
209- "Replacing KVCache with QuantizedKVCache. This modifies the model in place."
212+ f "Replacing KVCache with QuantizedKVCache. This modifies the model in place. (HACK: maxrss: { maxrss } nswap: { nswap } ) "
210213 )
211214 for name , child in module .named_children ():
212215 if isinstance (child , KVCache ) or isinstance (child , CustomKVCache ):
@@ -270,8 +273,11 @@ def replace_kv_cache_with_custom_kv_cache(module):
270273 This is because the custom op treats second dim as sequence dim.
271274 Future work: support [B, H, S, D]
272275 """
276+ import resource
277+ maxrss = resource .getrusage (resource .RUSAGE_SELF ).ru_maxrss
278+ nswap = resource .getrusage (resource .RUSAGE_SELF ).ru_nswap
273279 logging .warning (
274- "Replacing KVCache with CustomKVCache. This modifies the model in place."
280+ f "Replacing KVCache with CustomKVCache. This modifies the model in place. (HACK: maxrss: { maxrss } nswap: { nswap } ) "
275281 )
276282 for name , child in module .named_children ():
277283 if isinstance (child , KVCache ):
You can’t perform that action at this time.
0 commit comments