Former-commit-id: a6741bba8cebd16a6a3f97a2dc81057d0e27eb39
This commit is contained in:
hiyouga
2024-06-18 22:42:45 +08:00
parent 5cfa342f01
commit 4bc0bea0e9
3 changed files with 10 additions and 2 deletions

View File

@@ -59,6 +59,13 @@ class HuggingfaceEngine(BaseEngine):
self.tokenizer, model_args, finetuning_args, is_trainable=False, add_valuehead=(not self.can_generate)
) # must after fixing tokenizer to resize vocab
self.generating_args = generating_args.to_dict()
try:
asyncio.get_event_loop()
except RuntimeError:
logger.warning("There is no current event loop, creating a new one.")
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
self.semaphore = asyncio.Semaphore(int(os.environ.get("MAX_CONCURRENT", "1")))
@staticmethod