Commit 34ae15c6 authored by Baber's avatar Baber
Browse files

re-arrange imports

parent 65425258
...@@ -5,8 +5,6 @@ import logging ...@@ -5,8 +5,6 @@ import logging
import os import os
from typing import Dict, List, Optional, Tuple, Type, TypeVar, Union from typing import Dict, List, Optional, Tuple, Type, TypeVar, Union
import transformers
from sqlitedict import SqliteDict
from tqdm import tqdm from tqdm import tqdm
from lm_eval import utils from lm_eval import utils
...@@ -238,6 +236,8 @@ class CachingLM: ...@@ -238,6 +236,8 @@ class CachingLM:
:param cache_db: str :param cache_db: str
Path to cache db Path to cache db
""" """
from sqlitedict import SqliteDict
self.lm = lm self.lm = lm
self.cache_db = cache_db self.cache_db = cache_db
if os.path.dirname(cache_db): if os.path.dirname(cache_db):
...@@ -344,6 +344,8 @@ class TemplateLM(LM): ...@@ -344,6 +344,8 @@ class TemplateLM(LM):
def _encode_pair( def _encode_pair(
self, context: str, continuation: str self, context: str, continuation: str
) -> Tuple[List[int], List[int]]: ) -> Tuple[List[int], List[int]]:
import transformers
n_spaces = len(context) - len(context.rstrip()) n_spaces = len(context) - len(context.rstrip())
if n_spaces > 0: if n_spaces > 0:
continuation = context[-n_spaces:] + continuation continuation = context[-n_spaces:] + continuation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment