Fix: unpin flake8 and fix cs errors (#4367)

* Fix: unpin flake8 and fix cs errors

* Ok we still need to quote those
This commit is contained in:
Julien Chaumond
2020-05-14 13:14:26 -04:00
committed by GitHub
parent c547f15a17
commit 448c467256
13 changed files with 35 additions and 21 deletions

View File

@@ -226,7 +226,7 @@ def lmap(f, x) -> List:
def fetch_test_set(test_set_url):
import wget
fname = wget.download(test_set_url, f"opus_test.txt")
fname = wget.download(test_set_url, "opus_test.txt")
lns = Path(fname).open().readlines()
src = lmap(str.strip, lns[::4])
gold = lmap(str.strip, lns[1::4])

View File

@@ -114,7 +114,7 @@ class GlueDataset(Dataset):
torch.save(self.features, cached_features_file)
# ^ This seems to take a lot of time so I want to investigate why and how we can improve.
logger.info(
f"Saving features into cached file %s [took %.3f s]", cached_features_file, time.time() - start
"Saving features into cached file %s [took %.3f s]", cached_features_file, time.time() - start
)
def __len__(self):

View File

@@ -65,7 +65,7 @@ class TextDataset(Dataset):
with open(cached_features_file, "wb") as handle:
pickle.dump(self.examples, handle, protocol=pickle.HIGHEST_PROTOCOL)
logger.info(
f"Saving features into cached file %s [took %.3f s]", cached_features_file, time.time() - start
"Saving features into cached file %s [took %.3f s]", cached_features_file, time.time() - start
)
def __len__(self):

View File

@@ -24,7 +24,7 @@ from abc import ABC, abstractmethod
from contextlib import contextmanager
from itertools import chain
from os.path import abspath, exists
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import numpy as np
@@ -58,6 +58,10 @@ if is_torch_available():
AutoModelWithLMHead,
)
if TYPE_CHECKING:
from .modeling_utils import PreTrainedModel
from .modeling_tf_utils import TFPreTrainedModel
logger = logging.getLogger(__name__)