Closed Satrat closed 6 months ago
My only suggestion is to change the recommended usage to be explicitly using import sparseml to be clear what the "session" is connected to i.e.
import sparseml
oneshot(.....)
sparseml.reset_session()
oneshot(....)
with sparseml.create_session():
oneshot(...)
Previously to create, retrieve, or reset a session we needed to import
import sparseml.core.session as session_manager
. This file is now a top level import so instead the functions can be called byfrom sparseml import create_session, reset_session, active_session
ORimport sparseml
->sparseml.create_session()
, etcExamples
Reset sessions between runs:
You can also use the create_session context manager to do this cleanup automatically. See
tests/sparseml/transformers/finetune/test_finetune.py:test_oneshot_then_finetune()
for a full example of thisGetting info from the current active session: