globals¶ globals ¶ Object ¶ Bases: Tensor save ¶ save(_=0) Save an object to be accessable after the trace context is exited. Example: model = LanguageModel("gpt2", device_map='auto', dispatch=True) with model.trace("Hello World"): attn_0 = model.transformer.h[0].attn.output.save() print(attn_0) stop ¶ stop(_=0) Stop the trace context. __getattr__ ¶ __getattr__(name: str) -> Self __getitem__ ¶ __getitem__(key: Any) -> Self __call__ ¶ __call__(*args: Any, **kwargs: Any) -> Self TracingCache ¶ TracingCache() cache instance-attribute ¶ cache = {} get ¶ get(cache_key: Tuple) Check if the given filename and lineno is in the cache. add ¶ add(cache_key: Tuple, value: Any) Add the given value to the cache. Globals ¶ stack class-attribute instance-attribute ¶ stack = 0 saves class-attribute instance-attribute ¶ saves = set() cache class-attribute instance-attribute ¶ cache = TracingCache() enter staticmethod ¶ enter() exit staticmethod ¶ exit() save ¶ save(object: Any)