File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
examples/models/llama/source_transformation Expand file tree Collapse file tree 2 files changed +12
-3
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 ):
Original file line number Diff line number Diff line change @@ -156,7 +156,10 @@ def source_transform(
156156
157157 if self .verbose :
158158 logging .info (f"Applied source transforms: { self .applied_source_transforms } " )
159- logging .info (f"Model after source transforms: { self .model } " )
159+ import resource
160+ maxrss = resource .getrusage (resource .RUSAGE_SELF ).ru_maxrss
161+ nswap = resource .getrusage (resource .RUSAGE_SELF ).ru_nswap
162+ logging .info (f"Model after source transforms: { self .model } (HACK: maxrss: { maxrss } nswap: { nswap } )" )
160163 return self
161164
162165 def _get_dynamic_shape (self ) -> Any :
You can’t perform that action at this time.
0 commit comments