Skip to content

Commit

Permalink
Merge pull request #331 from ndif-team/fix-remote-logging
Browse files Browse the repository at this point in the history
REMOTE_LOGGING toggle takes affect
  • Loading branch information
JadenFiotto-Kaufman authored Feb 18, 2025
2 parents 9327c05 + 3ca9721 commit 95ea5ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nnsight/intervention/backends/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests
import socketio
import torch
from tqdm import tqdm
from tqdm.auto import tqdm

from ... import __IPYTHON__, CONFIG, remote_logger
from ...schema.request import RequestModel, StreamValueModel
Expand Down
12 changes: 12 additions & 0 deletions src/nnsight/schema/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import yaml
from pydantic import BaseModel

from ..logger import remote_logger


class ApiConfigModel(BaseModel):
HOST: str = "ndif.dev"
Expand All @@ -22,6 +24,16 @@ class AppConfigModel(BaseModel):
FRAME_INJECTION: bool = True
GLOBAL_TRACING: bool = True

def __setattr__(self, name, value):
if name == "REMOTE_LOGGING":
self.on_remote_logging_change(value)
super().__setattr__(name, value)

def on_remote_logging_change(self, value: bool):
if value != self.REMOTE_LOGGING:
remote_logger.disabled = (not value)
self.__dict__["REMOTE_LOGGING"] = value


class ConfigModel(BaseModel):
API: ApiConfigModel = ApiConfigModel()
Expand Down

0 comments on commit 95ea5ea

Please sign in to comment.