diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9c1492fd03a..3312ce287ce 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,14 +7,12 @@ on: pull_request: jobs: - # TODO(roller): uncomment this. it drifted due to click versioning. - # see #4481 for details - # pre-commit: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - uses: actions/setup-python@v2 - # - uses: pre-commit/action@v2.0.0 + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 lint: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85a90cda7b8..357757fccc0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 19.3b0 + rev: 22.3.0 hooks: - id: black language_version: python3 diff --git a/parlai/agents/hugging_face/t5.py b/parlai/agents/hugging_face/t5.py index 331a97ec43c..7f73ab1a55f 100644 --- a/parlai/agents/hugging_face/t5.py +++ b/parlai/agents/hugging_face/t5.py @@ -345,7 +345,7 @@ def output(self, tensor): # Taken directly from HuggingFace # Rescale output before projecting on vocab # See https://github.com/tensorflow/mesh/blob/fa19d69eafc9a482aff0b59ddd96b025c0cb207d/mesh_tensorflow/transformer/transformer.py#L586 - tensor = tensor * (self.t5.model_dim ** -0.5) + tensor = tensor * (self.t5.model_dim**-0.5) lm_logits = self.t5.lm_head(tensor) return lm_logits diff --git a/parlai/agents/rag/indexers.py b/parlai/agents/rag/indexers.py index 522135bbee6..493454d7023 100644 --- a/parlai/agents/rag/indexers.py +++ b/parlai/agents/rag/indexers.py @@ -211,7 +211,7 @@ def index_data(self, tensors: List[torch.Tensor]): 'HNSW index needs to index all data at once, results will be unpredictable otherwise.' ) phi = 0 - norms = (data ** 2).sum(dim=1) + norms = (data**2).sum(dim=1) max_norms = norms.max().item() phi = max(phi, max_norms) logging.info(f'HNSWF DotProduct -> L2 space phi={phi}') diff --git a/parlai/agents/rag/modules.py b/parlai/agents/rag/modules.py index 4f4a0bc4f0b..2be14d22e0b 100644 --- a/parlai/agents/rag/modules.py +++ b/parlai/agents/rag/modules.py @@ -578,6 +578,6 @@ def reorder_decoder_incremental_state( @set_device def decoder_output(self, latent: torch.Tensor): - tensor = latent * (self.t5.model_dim ** -0.5) + tensor = latent * (self.t5.model_dim**-0.5) logits = self.t5.lm_head(tensor) return logits diff --git a/parlai/agents/transformer/modules/decoder.py b/parlai/agents/transformer/modules/decoder.py index 1f4b0dfe87a..7cb367c1ff4 100644 --- a/parlai/agents/transformer/modules/decoder.py +++ b/parlai/agents/transformer/modules/decoder.py @@ -270,7 +270,7 @@ def _default(val, default): ) else: nn.init.normal_( - self.position_embeddings.weight, 0, self.embedding_size ** -0.5 + self.position_embeddings.weight, 0, self.embedding_size**-0.5 ) # build the model diff --git a/parlai/agents/transformer/modules/encoder.py b/parlai/agents/transformer/modules/encoder.py index a25ca60a05a..872003dfe98 100644 --- a/parlai/agents/transformer/modules/encoder.py +++ b/parlai/agents/transformer/modules/encoder.py @@ -191,7 +191,7 @@ def _default(val, default): self.embeddings = nn.Embedding( vocabulary_size, self.embedding_size, padding_idx=padding_idx ) - nn.init.normal_(self.embeddings.weight, 0, self.embedding_size ** -0.5) + nn.init.normal_(self.embeddings.weight, 0, self.embedding_size**-0.5) # create the positional embeddings self.position_embeddings = nn.Embedding(self.n_positions, self.embedding_size) @@ -203,7 +203,7 @@ def _default(val, default): ) else: nn.init.normal_( - self.position_embeddings.weight, 0, self.embedding_size ** -0.5 + self.position_embeddings.weight, 0, self.embedding_size**-0.5 ) # embedding normalization @@ -220,7 +220,7 @@ def _default(val, default): if self.n_segments >= 1: self.segment_embeddings = nn.Embedding(self.n_segments, self.dim) - nn.init.normal_(self.segment_embeddings.weight, 0, self.dim ** -0.5) + nn.init.normal_(self.segment_embeddings.weight, 0, self.dim**-0.5) # build the model self.layers = self.build_layers() diff --git a/parlai/agents/transformer/modules/functions.py b/parlai/agents/transformer/modules/functions.py index 8dfc4730c5f..f003ab93144 100644 --- a/parlai/agents/transformer/modules/functions.py +++ b/parlai/agents/transformer/modules/functions.py @@ -36,7 +36,7 @@ def create_embeddings(dictionary, embedding_size, padding_idx): Create and initialize word embeddings. """ e = nn.Embedding(len(dictionary), embedding_size, padding_idx) - nn.init.normal_(e.weight, mean=0, std=embedding_size ** -0.5) + nn.init.normal_(e.weight, mean=0, std=embedding_size**-0.5) nn.init.constant_(e.weight[padding_idx], 0) return e diff --git a/parlai/agents/transformer/polyencoder.py b/parlai/agents/transformer/polyencoder.py index 19c9155eacc..dbfaca7cb05 100644 --- a/parlai/agents/transformer/polyencoder.py +++ b/parlai/agents/transformer/polyencoder.py @@ -404,7 +404,7 @@ def _get_embeddings(self, dict_, null_idx, embedding_size): embeddings = torch.nn.Embedding( len(dict_), embedding_size, padding_idx=null_idx ) - torch.nn.init.normal_(embeddings.weight, 0, embedding_size ** -0.5) + torch.nn.init.normal_(embeddings.weight, 0, embedding_size**-0.5) return embeddings def attend(self, attention_layer, queries, keys, values, mask): diff --git a/parlai/core/build_data.py b/parlai/core/build_data.py index 4ad70494c88..9cc422f4deb 100644 --- a/parlai/core/build_data.py +++ b/parlai/core/build_data.py @@ -175,7 +175,7 @@ def download(url, path, fname, redownload=False, num_retries=5): download = not PathManager.exists(outfile) or redownload logging.info(f"Downloading {url} to {outfile}") retry = num_retries - exp_backoff = [2 ** r for r in reversed(range(retry))] + exp_backoff = [2**r for r in reversed(range(retry))] pbar = tqdm.tqdm(unit='B', unit_scale=True, desc='Downloading {}'.format(fname)) diff --git a/parlai/core/torch_classifier_agent.py b/parlai/core/torch_classifier_agent.py index 1bc6a91bcbe..786e79607de 100644 --- a/parlai/core/torch_classifier_agent.py +++ b/parlai/core/torch_classifier_agent.py @@ -231,7 +231,7 @@ def update_raw( assert self._class_name == class_name assert len(true_labels) == len(pos_probs) - TO_INT_FACTOR = 10 ** self._max_bucket_dec_places + TO_INT_FACTOR = 10**self._max_bucket_dec_places # add the upper and lower bound of the values for label, prob in zip(true_labels, pos_probs): # calculate the upper and lower bound of the values diff --git a/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py b/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py index a976a8d4264..3225a8cb633 100644 --- a/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py +++ b/parlai/crowdsourcing/tasks/turn_annotations_static/analysis/compile_results.py @@ -513,10 +513,10 @@ def compute_fleiss_kappa( except Exception: n_ij = 0.0 p_j[j] += n_ij - P_bar_sum_term += n_ij ** 2 + P_bar_sum_term += n_ij**2 p_j = [tmp / (N * number_of_raters) for tmp in p_j] - P_e_bar = sum([tmp ** 2 for tmp in p_j]) + P_e_bar = sum([tmp**2 for tmp in p_j]) P_bar = (P_bar_sum_term - N * number_of_raters) / ( N * number_of_raters * (number_of_raters - 1) diff --git a/parlai/tasks/casino/agents.py b/parlai/tasks/casino/agents.py index eb286ba3c56..e25613ca82d 100644 --- a/parlai/tasks/casino/agents.py +++ b/parlai/tasks/casino/agents.py @@ -95,17 +95,13 @@ def _setup_data(self, data_path): episode = copy.deepcopy(dialogue) episode[ 'perspective' - ] = ( - 'mturk_agent_1' - ) # id of the agent whose perspective will be used in this dialog + ] = 'mturk_agent_1' # id of the agent whose perspective will be used in this dialog episodes.append(episode) episode = copy.deepcopy(dialogue) episode[ 'perspective' - ] = ( - 'mturk_agent_2' - ) # id of the agent whose perspective will be used in this dialog + ] = 'mturk_agent_2' # id of the agent whose perspective will be used in this dialog episodes.append(episode) self.episodes = episodes diff --git a/parlai/tasks/multiwoz_v22/agents.py b/parlai/tasks/multiwoz_v22/agents.py index 33eec3ed443..063661f1a3b 100644 --- a/parlai/tasks/multiwoz_v22/agents.py +++ b/parlai/tasks/multiwoz_v22/agents.py @@ -315,9 +315,7 @@ def setup_episodes(self, fold): if raw_episode["dialogue_id"] != self.opt["dialogue_id"]: continue - skip = ( - False - ) # need to skip outer for loop while in `for domains` inner for loop + skip = False # need to skip outer for loop while in `for domains` inner for loop if self.opt.get("well_formatted_domains_only", True): if len(domains) == 0: skip = True diff --git a/parlai/utils/bpe.py b/parlai/utils/bpe.py index e9ff3b5df69..063601963df 100644 --- a/parlai/utils/bpe.py +++ b/parlai/utils/bpe.py @@ -608,10 +608,10 @@ def bytes_to_unicode(self) -> Dict[int, str]: ) cs: List[int] = bs[:] n = 0 - for b in range(2 ** 8): + for b in range(2**8): if b not in bs: bs.append(b) - cs.append(2 ** 8 + n) + cs.append(2**8 + n) n += 1 str_cs: List[str] = [chr(n) for n in cs] return dict(zip(bs, str_cs)) diff --git a/parlai/utils/distributed.py b/parlai/utils/distributed.py index d2e2b3ba0ce..c6b9041c38a 100644 --- a/parlai/utils/distributed.py +++ b/parlai/utils/distributed.py @@ -212,7 +212,7 @@ def sync_parameters(model: torch.nn.Module) -> bool: dist.all_reduce(p.data, dist.ReduceOp.SUM) # double check everything synced correctly - norm2 = sum((p.data ** 2).sum().float().item() for p in model.parameters()) + norm2 = sum((p.data**2).sum().float().item() for p in model.parameters()) all_versions = all_gather_list(norm2) if not all(n == norm2 for n in all_versions): raise AssertionError( diff --git a/parlai/utils/fp16.py b/parlai/utils/fp16.py index 86a00d9daaf..157a57042ef 100644 --- a/parlai/utils/fp16.py +++ b/parlai/utils/fp16.py @@ -122,8 +122,8 @@ def __init__(self, optimizer, aggregate_gnorms=False): raise NotImplementedError("Need to implement the parameter group transfer.") optimizer.param_groups[0]['params'] = self.fp32_params - self.scaler = DynamicLossScaler(2.0 ** 15) - self.min_loss_scale = 2 ** -5 + self.scaler = DynamicLossScaler(2.0**15) + self.min_loss_scale = 2**-5 self._aggregate_gnorms = aggregate_gnorms @classmethod @@ -318,7 +318,7 @@ class DynamicLossScaler(object): def __init__( self, - init_scale: float = 2.0 ** 15, + init_scale: float = 2.0**15, scale_factor: float = 2.0, scale_window: int = 2000, tolerance: float = 0.00, @@ -415,7 +415,7 @@ def __init__( self, init_optimizer: torch.optim.Optimizer, # type: ignore aggregate_gnorms: bool = False, - loss_initial_scale: float = 2.0 ** 17, + loss_initial_scale: float = 2.0**17, min_loss_scale: float = 1e-4, ): self.optimizer = init_optimizer @@ -832,7 +832,7 @@ def step(self, closure=None): group['lr'] = self._get_lr(group, state) beta2t = 1.0 - math.pow(state['step'], group['decay_rate']) - update = (grad ** 2) + group['eps'][0] + update = (grad**2) + group['eps'][0] if factored: exp_avg_sq_row = state['exp_avg_sq_row'] exp_avg_sq_col = state['exp_avg_sq_col'] diff --git a/projects/image_chat/transresnet_multimodal/modules.py b/projects/image_chat/transresnet_multimodal/modules.py index 3710b6a9471..bf1d760f585 100644 --- a/projects/image_chat/transresnet_multimodal/modules.py +++ b/projects/image_chat/transresnet_multimodal/modules.py @@ -526,7 +526,7 @@ def __init__( n_positions, hidden_dim, out=self.position_embeddings.weight ) else: - nn.init.normal_(self.position_embeddings.weight, 0, hidden_dim ** -0.5) + nn.init.normal_(self.position_embeddings.weight, 0, hidden_dim**-0.5) self.layers = nn.ModuleList() for _ in range(self.n_layers): diff --git a/projects/light_whoami/agents/expanded_attention.py b/projects/light_whoami/agents/expanded_attention.py index 61013662fa2..81382db420c 100644 --- a/projects/light_whoami/agents/expanded_attention.py +++ b/projects/light_whoami/agents/expanded_attention.py @@ -57,7 +57,7 @@ def get_classifier_model_and_dict( - opt: Opt + opt: Opt, ) -> Tuple[Optional[TorchAgent], Optional[DictionaryAgent]]: """ Build classifier model and dictionary. @@ -707,9 +707,14 @@ def _apply_model_parallel_with_extra( new_incr_state = {i: [] for i, _ in enumerate(self.layers)} for chunk_idx, layer_nos, next_device in work_items: - s_tensor, s_enc_out, s_enc_mask, s_incr_state, s_extra_out, s_extra_mask = chunks[ - chunk_idx - ] + ( + s_tensor, + s_enc_out, + s_enc_mask, + s_incr_state, + s_extra_out, + s_extra_mask, + ) = chunks[chunk_idx] for layer_no in layer_nos: s_tensor, nis = self.layers[layer_no]( x=s_tensor, @@ -721,7 +726,13 @@ def _apply_model_parallel_with_extra( ) new_incr_state[layer_no].append(nis) # don't move incr state, it's always on the correct device - s_tensor, s_enc_out, s_enc_mask, s_extra_out, s_extra_mask = PipelineHelper.chunk_to( + ( + s_tensor, + s_enc_out, + s_enc_mask, + s_extra_out, + s_extra_mask, + ) = PipelineHelper.chunk_to( (s_tensor, s_enc_out, s_enc_mask, s_extra_out, s_extra_mask), next_device, ) diff --git a/projects/safety_bench/model_wrappers/example_wrapper.py b/projects/safety_bench/model_wrappers/example_wrapper.py index 6b627cddb25..1299ae54643 100644 --- a/projects/safety_bench/model_wrappers/example_wrapper.py +++ b/projects/safety_bench/model_wrappers/example_wrapper.py @@ -29,6 +29,4 @@ def get_response(self, input_text: str) -> str: # Be sure to reset the model's dialogue history before/after # every call to `get_response`. - return ( - "Hello" - ) # In this example, we always respond 'Hello' regardless of the input + return "Hello" # In this example, we always respond 'Hello' regardless of the input diff --git a/projects/seeker/agents/seeker.py b/projects/seeker/agents/seeker.py index 5cd4f868ee5..0000465d7c3 100644 --- a/projects/seeker/agents/seeker.py +++ b/projects/seeker/agents/seeker.py @@ -831,9 +831,11 @@ def batch_act(self, observations: List[Dict[str, Message]]) -> List[Message]: """ knowledge_agent_observations = [o['knowledge_agent'] for o in observations] # First, determine whether we're searching - batch_reply_sdm, search_indices, knowledge_agent_observations = self.batch_act_sdm( - observations, knowledge_agent_observations - ) + ( + batch_reply_sdm, + search_indices, + knowledge_agent_observations, + ) = self.batch_act_sdm(observations, knowledge_agent_observations) # Second, generate search queries batch_reply_sqm = self.batch_act_sqm(observations, search_indices) diff --git a/projects/seeker/agents/seeker_modules.py b/projects/seeker/agents/seeker_modules.py index 434c80ad349..d99d160c059 100644 --- a/projects/seeker/agents/seeker_modules.py +++ b/projects/seeker/agents/seeker_modules.py @@ -243,9 +243,13 @@ def encoder( assert all(t is None for t in [input_turns_cnt, positions, segments]) # Encode with `super()` call for non-skip-retrieval inputs - enc_out_retrieval, mask_retrieval, input_turns_cnt, top_docs, top_doc_scores = super( - ComboFidModel, self - ).encoder( + ( + enc_out_retrieval, + mask_retrieval, + input_turns_cnt, + top_docs, + top_doc_scores, + ) = super(ComboFidModel, self).encoder( input[~skip_retrieval_vec], input_lengths[~skip_retrieval_vec], query_vec[~skip_retrieval_vec], @@ -258,7 +262,12 @@ def encoder( input[skip_retrieval_vec] ) - new_out, new_mask, new_top_docs, new_top_doc_scores = interleave_fid_combo_outputs( + ( + new_out, + new_mask, + new_top_docs, + new_top_doc_scores, + ) = interleave_fid_combo_outputs( enc_out_retrieval, enc_out_skip_retrieval, mask_retrieval, diff --git a/projects/wizard_of_wikipedia/generator/agents.py b/projects/wizard_of_wikipedia/generator/agents.py index 20e530de7f6..b7f4a3ce0e2 100644 --- a/projects/wizard_of_wikipedia/generator/agents.py +++ b/projects/wizard_of_wikipedia/generator/agents.py @@ -105,7 +105,7 @@ def _set_text_vec(self, obs, history, truncate): class EndToEndAgent(_GenericWizardAgent): def __init__(self, opt, shared=None): super().__init__(opt, shared) - self._vectorize_text = lru_cache(int(2 ** 20))(self._vectorize_text) + self._vectorize_text = lru_cache(int(2**20))(self._vectorize_text) # knowledge truncate defaults to the same as --truncate self.knowledge_truncate = opt.get('knowledge_truncate') diff --git a/tests/crowdsourcing/tasks/acute_eval/test_acute_eval.py b/tests/crowdsourcing/tasks/acute_eval/test_acute_eval.py index 2257fb51e49..1bfcfc1cf04 100644 --- a/tests/crowdsourcing/tasks/acute_eval/test_acute_eval.py +++ b/tests/crowdsourcing/tasks/acute_eval/test_acute_eval.py @@ -58,7 +58,6 @@ def test_base_task( # Check that the agent state is as it should be self._test_agent_state(task_data=task_data, data_regression=data_regression) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_dataset.py b/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_dataset.py index 76664a2fd8a..8be32c408ef 100644 --- a/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_dataset.py +++ b/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_dataset.py @@ -87,7 +87,6 @@ def setup_teardown(self): # Tear down temp file shutil.rmtree(root_dir) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_logs.py b/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_logs.py index 41acbec7b38..f6f9ab15fa4 100644 --- a/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_logs.py +++ b/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_logs.py @@ -103,7 +103,6 @@ def setup_teardown(self): # Tear down temp file shutil.rmtree(root_dir) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_self_chat.py b/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_self_chat.py index 570728654ed..583623f9c22 100644 --- a/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_self_chat.py +++ b/tests/crowdsourcing/tasks/acute_eval/test_fast_acute_self_chat.py @@ -79,7 +79,6 @@ def setup_teardown(self): # Tear down temp file shutil.rmtree(root_dir) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/model_chat/test_image_stack.py b/tests/crowdsourcing/tasks/model_chat/test_image_stack.py index 1e089f4713f..2bd2bccad30 100644 --- a/tests/crowdsourcing/tasks/model_chat/test_image_stack.py +++ b/tests/crowdsourcing/tasks/model_chat/test_image_stack.py @@ -72,6 +72,5 @@ def test_fill_stack(self, file_regression: FileRegressionFixture): # Check the output against what it should be file_regression.check(contents=stdout) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/model_chat/test_model_chat.py b/tests/crowdsourcing/tasks/model_chat/test_model_chat.py index 8d7c5dafe35..8052be760ae 100644 --- a/tests/crowdsourcing/tasks/model_chat/test_model_chat.py +++ b/tests/crowdsourcing/tasks/model_chat/test_model_chat.py @@ -157,7 +157,6 @@ def _remove_non_deterministic_keys(self, actual_state: dict) -> dict: return actual_state - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/model_chat/test_model_chat_analysis.py b/tests/crowdsourcing/tasks/model_chat/test_model_chat_analysis.py index dae9b287211..fa25c9c2ba3 100644 --- a/tests/crowdsourcing/tasks/model_chat/test_model_chat_analysis.py +++ b/tests/crowdsourcing/tasks/model_chat/test_model_chat_analysis.py @@ -132,6 +132,5 @@ def test_worker_results_file( outputs = setup_teardown file_regression.check(outputs[prefix], basename=prefix) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/model_chat/test_model_image_chat.py b/tests/crowdsourcing/tasks/model_chat/test_model_image_chat.py index 9be81cea078..df25a57cfee 100644 --- a/tests/crowdsourcing/tasks/model_chat/test_model_image_chat.py +++ b/tests/crowdsourcing/tasks/model_chat/test_model_image_chat.py @@ -163,7 +163,6 @@ def test_base_task(self): actual_value=actual_chat_data, expected_value=expected_chat_data ) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/qa_data_collection/test_qa_data_collection.py b/tests/crowdsourcing/tasks/qa_data_collection/test_qa_data_collection.py index 49bd70269df..98f8891119e 100644 --- a/tests/crowdsourcing/tasks/qa_data_collection/test_qa_data_collection.py +++ b/tests/crowdsourcing/tasks/qa_data_collection/test_qa_data_collection.py @@ -84,7 +84,6 @@ def test_base_task(self): expected_states=(expected_state,), ) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/test_chat_demo.py b/tests/crowdsourcing/tasks/test_chat_demo.py index 3ae497a2665..00fd4848d92 100644 --- a/tests/crowdsourcing/tasks/test_chat_demo.py +++ b/tests/crowdsourcing/tasks/test_chat_demo.py @@ -273,7 +273,6 @@ def test_base_task(self): expected_states=EXPECTED_STATES, ) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static.py b/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static.py index 90b6a907571..8e2a8d4d666 100644 --- a/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static.py +++ b/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static.py @@ -140,7 +140,6 @@ def _test_turn_annotations_static_task( self._test_agent_state(task_data=task_data, data_regression=data_regression) - except ImportError: pass diff --git a/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py b/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py index 4976f02f65b..a4a3592b3b1 100644 --- a/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py +++ b/tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py @@ -145,7 +145,6 @@ def test_compile_results(self): f'\n\n\tActual results:\n{actual_results.to_csv()}' ) - except ImportError: pass diff --git a/tests/crowdsourcing/test_analysis.py b/tests/crowdsourcing/test_analysis.py index 0862d1d0aa8..46768f0f334 100644 --- a/tests/crowdsourcing/test_analysis.py +++ b/tests/crowdsourcing/test_analysis.py @@ -17,7 +17,6 @@ class MockUnit(Unit): pass - except ModuleNotFoundError: # In case Mephisto is not installed we use a simpler mock object. class MockUnit: diff --git a/tests/test_tfidf_retriever.py b/tests/test_tfidf_retriever.py index e013d94605e..25b2843db10 100644 --- a/tests/test_tfidf_retriever.py +++ b/tests/test_tfidf_retriever.py @@ -34,7 +34,7 @@ def test_sparse_tfidf_multiworkers(self): task='babi:task1k:1', model_file=MODEL_FILE, retriever_numworkers=4, - retriever_hashsize=2 ** 8, + retriever_hashsize=2**8, retriever_tokenizer='simple', datatype='train:ordered', batchsize=1, @@ -82,7 +82,7 @@ def test_sparse_tfidf_retriever_singlethread(self): task='babi:task1k:1', model_file=MODEL_FILE, retriever_numworkers=1, - retriever_hashsize=2 ** 8, + retriever_hashsize=2**8, retriever_tokenizer='simple', datatype='train:ordered', batchsize=1, @@ -131,7 +131,7 @@ def test_sparse_tfidf_retriever_regexp(self): model_file=MODEL_FILE, retriever_tokenizer='regexp', retriever_numworkers=4, - retriever_hashsize=2 ** 8, + retriever_hashsize=2**8, datatype='train:ordered', batchsize=1, num_epochs=1,