From baf48d358348022d7b69a00bed018514d4baa185 Mon Sep 17 00:00:00 2001 From: "Efkan S. Goktepe" <76130958+serhatgktp@users.noreply.github.com> Date: Wed, 5 Jul 2023 13:03:22 -0400 Subject: [PATCH] Replace stop clause with shorter, pythonic alternative (#7159) Replace this comment with: - Description: Replace `if var is not None:` with `if var:`, a concise and pythonic alternative - Issue: N/A - Dependencies: None - Tag maintainer: Unsure - Twitter handle: N/A Signed-off-by: serhatgktp --- langchain/llms/huggingface_pipeline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langchain/llms/huggingface_pipeline.py b/langchain/llms/huggingface_pipeline.py index f10f93354f1..92da6f5fbab 100644 --- a/langchain/llms/huggingface_pipeline.py +++ b/langchain/llms/huggingface_pipeline.py @@ -179,7 +179,7 @@ class HuggingFacePipeline(LLM): f"Got invalid task {self.pipeline.task}, " f"currently only {VALID_TASKS} are supported" ) - if stop is not None: + if stop: # This is a bit hacky, but I can't figure out a better way to enforce # stop tokens when making calls to huggingface_hub. text = enforce_stop_tokens(text, stop)