Skip to content

Commit

Permalink
Removed model state recovering after model tracing (openvinotoolkit#2419
Browse files Browse the repository at this point in the history
)

### Changes
Removed model state recovering after model tracing

### Reason for changes

Reduce memory usage

### Related tickets

N/A

### Tests

e2e_pytorch_full 578
  • Loading branch information
alexsu52 authored Feb 1, 2024
1 parent 9c008ad commit efc05f2
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions nncf/torch/dynamic_graph/graph_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from copy import deepcopy
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar

import torch
Expand All @@ -35,8 +34,6 @@ def trace_graph(
as_eval: bool = False,
trace_parameters: bool = False,
) -> DynamicGraph:
sd = deepcopy(model.state_dict())

if context_to_use is None:
context_to_use = TracingContext()

Expand All @@ -54,7 +51,6 @@ def trace_graph(
self.custom_forward_fn(model)
else:
self.custom_forward_fn(model)
model.load_state_dict(sd)

context_to_use.disable_trace_dynamic_graph()
return context_to_use.graph
Expand Down

0 comments on commit efc05f2

Please sign in to comment.