Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def apply_weight_standardization(module: torch.nn.Module, n_last_layers_ignore:
# Attempt to symbolically trace a module, so the results of .modules() will be in the order of execution
try:
module_trace = symbolic_trace(module)
except:
except Exception:
if n_last_layers_ignore > 0:
log.warning(
textwrap.dedent(
Expand Down
2 changes: 1 addition & 1 deletion composer/cli/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def main():
processes=processes,
)
_monitor_processes(processes)
except:
except Exception:
# Print the exception first, then kill the training processes, since killing
# may take up to CLEANUP_TIMEOUT seconds, and the user should know immediately
# what failed. No need to re-raise the exception, as `aggregate_process_returncode`
Expand Down
2 changes: 1 addition & 1 deletion composer/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def _close(state: State, logger: Logger):
# Try to shut down any persistent workers
try:
state.train_dataloader._iterator._shutdown_workers() # type: ignore [reportGeneralTypeIssues]
except:
except Exception:
pass

log.debug('Engine closed.')
2 changes: 1 addition & 1 deletion composer/core/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ def _apply_required_algorithms(
if exclude_algorithms is None or algo_name not in exclude_algorithms:
try:
algo = eval(f"algorithms.{serialized_value['repr']}")
except:
except Exception:
warnings.warn(
textwrap.dedent(
f"required_on_load algorithm {serialized_value['repr']} was enabled when training the "
Expand Down
2 changes: 1 addition & 1 deletion composer/models/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
try:
from peft import PeftModel, get_peft_model
peft_installed = True
except:
except Exception:
peft_installed = False

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion composer/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2256,7 +2256,7 @@ def fit(
optimizer.zero_grad(set_to_none=True)
except TypeError:
optimizer.zero_grad()
except:
except Exception:
log.exception('Failed to zero out optimizer at end of fit')

def close(self):
Expand Down
2 changes: 1 addition & 1 deletion composer/utils/file_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def _get_file(
callback=_get_callback(f'Downloading {path}') if progress_bar else None,
):
f.write(data)
except:
except Exception:
# The download failed for some reason. Make a best-effort attempt to remove the temporary file.
try:
os.remove(tmp_path)
Expand Down
2 changes: 1 addition & 1 deletion composer/utils/object_store/gcs_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def download_object(
blob.download_to_filename(tmp_path)
except Exception as e:
_reraise_gcs_errors(self.get_uri(src), e)
except:
except Exception:
# Make a best effort attempt to clean up the temporary file
try:
os.remove(tmp_path)
Expand Down
2 changes: 1 addition & 1 deletion composer/utils/object_store/s3_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def download_object(
)
except Exception as e:
_ensure_not_found_errors_are_wrapped(self.get_uri(object_name), e)
except:
except Exception:
# Make a best effort attempt to clean up the temporary file
try:
os.remove(tmp_path)
Expand Down
2 changes: 1 addition & 1 deletion composer/utils/object_store/uc_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def download_object(
f.write(chunk)
except Exception as e:
_wrap_errors(self.get_uri(object_name), e)
except:
except Exception:
# Make best effort attempt to clean up the temporary file
try:
os.remove(tmp_path)
Expand Down
2 changes: 1 addition & 1 deletion tests/algorithms/test_progressive_resizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_without_target(self, X, y):
"""Test that resizing works properly with no target present."""
try:
resize_batch(X, y, 1.0, 'crop', resize_targets=False)
except:
except Exception:
pytest.fail('apply_progressive_resizing failed with y == None')

@pytest.mark.parametrize('Wx,Hx', [(31, 31), (32, 32), (32, 16)])
Expand Down
2 changes: 1 addition & 1 deletion tests/loggers/test_cometml_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_cometml_log_table(comet_logger: CometMLLogger, comet_offline_directory:
# Check to see if this is the logged table
if 'columns' in table and 'data' in table:
found_table = table['columns'] == columns and table['data'] == rows
except:
except Exception:
pass # If there's a file that is not a json, just continue

# Assert that we have found the logged table
Expand Down
Loading