Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/website/http-cache-s…
Browse files Browse the repository at this point in the history
…emantics-4.1.1
  • Loading branch information
pbontrager authored Jul 17, 2023
2 parents 54ca266 + 63f76fb commit ccaffb0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
3 changes: 3 additions & 0 deletions PACKAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("@fbcode_macros//build_defs/lib:third_party.bzl", "third_party")

third_party.gen_overrides({"pypi/transformers": "3.4.0-transitional"})
1 change: 1 addition & 0 deletions mmf/modules/vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def custom_forward(*inputs):
hidden_states,
attention_mask,
layer_head_mask,
use_reentrant=True,
)
else:
layer_outputs = layer_module(
Expand Down
5 changes: 4 additions & 1 deletion mmf/trainers/core/profiling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Facebook, Inc. and its affiliates.

import logging
import threading
from abc import ABC
from typing import Type

Expand All @@ -16,5 +17,7 @@ class TrainerProfilingMixin(ABC):
def profile(self, text: str) -> None:
if self.training_config.logger_level != "debug":
return
logging.debug(f"{text}: {self.profiler.get_time_since_start()}")
logging.debug(
f"tid={threading.current_thread().ident}, {text}: {self.profiler.get_time_since_start()}"
)
self.profiler.reset()
3 changes: 2 additions & 1 deletion mmf/utils/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ def distributed_init(config):
os.environ["MASTER_PORT"] = split[1]

# perform a dummy all-reduce to initialize the NCCL communicator
dist.all_reduce(torch.zeros(1).cuda())
dummpy_tensor = torch.zeros(1)
dist.all_reduce(dummpy_tensor.cuda())

suppress_output(is_main())
config.distributed.rank = dist.get_rank()
Expand Down
10 changes: 7 additions & 3 deletions mmf/utils/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ def patch_transformers(log_incompatible=False):
for module in model_lib._modules:
if not module or module == "." or module[0] == ".":
continue
sys.modules[f"transformers.{module}"] = importlib.import_module(
f"transformers.models.{key}.{module}"
)
try:
sys.modules[f"transformers.{module}"] = importlib.import_module(
f"transformers.models.{key}.{module}"
)
except ImportError:
logger.info(f"Failed to import transformers.models.{key}.{module}")
continue
sys.path = [sys.path[-1]] + sys.path[:-1]


Expand Down

0 comments on commit ccaffb0

Please sign in to comment.