From 05c4f5d2b51d03b2e6a14b4c9334da3e1e89116e Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 29 Nov 2024 12:13:36 -0500 Subject: [PATCH 1/9] zero gpu --- gradio/chat_interface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 691ea88149502..3fa59a60b6644 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -331,8 +331,10 @@ def _setup_example_messages( return examples_messages def _setup_events(self) -> None: - submit_fn = self._stream_fn if self.is_generator else self._submit_fn submit_triggers = [self.textbox.submit, self.chatbot.retry] + submit_fn = self._stream_fn if self.is_generator else self._submit_fn + if hasattr(self.fn, "zerogpu"): + submit_fn.zerogpu = self.fn.zerogpu submit_event = ( self.textbox.submit( From 68be44917f4d0faeba4c92739f4d2ba269b9ea27 Mon Sep 17 00:00:00 2001 From: gradio-pr-bot Date: Fri, 29 Nov 2024 17:14:49 +0000 Subject: [PATCH 2/9] add changeset --- .changeset/little-meals-enter.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/little-meals-enter.md diff --git a/.changeset/little-meals-enter.md b/.changeset/little-meals-enter.md new file mode 100644 index 0000000000000..4d29cef25739f --- /dev/null +++ b/.changeset/little-meals-enter.md @@ -0,0 +1,5 @@ +--- +"gradio": minor +--- + +feat:Apply Zero GPU for `gr.ChatInterface` From f4fe5c13e6e8be7844e3036cd10084085d9dd0d6 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 29 Nov 2024 14:51:56 -0500 Subject: [PATCH 3/9] changes --- gradio/chat_interface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 3fa59a60b6644..590f0329accc4 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -334,7 +334,8 @@ def _setup_events(self) -> None: submit_triggers = [self.textbox.submit, self.chatbot.retry] submit_fn = self._stream_fn if self.is_generator else self._submit_fn if hasattr(self.fn, "zerogpu"): - submit_fn.zerogpu = self.fn.zerogpu + val = self.fn.zerogpu + submit_fn.zerogpu = val submit_event = ( self.textbox.submit( From 5f1cf0edaa1cb6d9a9c336639cf34ffd557507e9 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 29 Nov 2024 14:54:13 -0500 Subject: [PATCH 4/9] changes --- gradio/chat_interface.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 590f0329accc4..e3fc84d36fae8 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -334,8 +334,7 @@ def _setup_events(self) -> None: submit_triggers = [self.textbox.submit, self.chatbot.retry] submit_fn = self._stream_fn if self.is_generator else self._submit_fn if hasattr(self.fn, "zerogpu"): - val = self.fn.zerogpu - submit_fn.zerogpu = val + setattr(submit_fn, "zerogpu", None) submit_event = ( self.textbox.submit( From 2bf317eb8ab484117b6cf5c55fd530a033edb2e5 Mon Sep 17 00:00:00 2001 From: gradio-pr-bot Date: Fri, 29 Nov 2024 19:55:10 +0000 Subject: [PATCH 5/9] add changeset --- .changeset/little-meals-enter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/little-meals-enter.md b/.changeset/little-meals-enter.md index 4d29cef25739f..e470894a5354b 100644 --- a/.changeset/little-meals-enter.md +++ b/.changeset/little-meals-enter.md @@ -2,4 +2,4 @@ "gradio": minor --- -feat:Apply Zero GPU for `gr.ChatInterface` +feat:[test] zerogpu fix From 70270e624f21fb0058d47f18186e2541674d3237 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 29 Nov 2024 15:07:45 -0500 Subject: [PATCH 6/9] change --- gradio/chat_interface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index e3fc84d36fae8..6b44214ffbb0f 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -334,7 +334,9 @@ def _setup_events(self) -> None: submit_triggers = [self.textbox.submit, self.chatbot.retry] submit_fn = self._stream_fn if self.is_generator else self._submit_fn if hasattr(self.fn, "zerogpu"): - setattr(submit_fn, "zerogpu", None) + submit_fn.__func__.zerogpu = None + # if hasattr(self.fn, "zerogpu"): + # setattr(submit_fn.__func__, "zerogpu", None) submit_event = ( self.textbox.submit( From b48adc41bb9227ba0ee07f009b5862211e0c332e Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 29 Nov 2024 15:17:58 -0500 Subject: [PATCH 7/9] check --- gradio/chat_interface.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 6b44214ffbb0f..4bdc9e9d6df32 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -334,9 +334,7 @@ def _setup_events(self) -> None: submit_triggers = [self.textbox.submit, self.chatbot.retry] submit_fn = self._stream_fn if self.is_generator else self._submit_fn if hasattr(self.fn, "zerogpu"): - submit_fn.__func__.zerogpu = None - # if hasattr(self.fn, "zerogpu"): - # setattr(submit_fn.__func__, "zerogpu", None) + submit_fn.__func__.zerogpu = self.fn.zerogpu submit_event = ( self.textbox.submit( From b02aa6c8b5c4416b6f279983c913faf839f29feb Mon Sep 17 00:00:00 2001 From: gradio-pr-bot Date: Fri, 29 Nov 2024 20:18:48 +0000 Subject: [PATCH 8/9] add changeset --- .changeset/little-meals-enter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/little-meals-enter.md b/.changeset/little-meals-enter.md index e470894a5354b..4d29cef25739f 100644 --- a/.changeset/little-meals-enter.md +++ b/.changeset/little-meals-enter.md @@ -2,4 +2,4 @@ "gradio": minor --- -feat:[test] zerogpu fix +feat:Apply Zero GPU for `gr.ChatInterface` From afad353e70886d7578b32bc05ef01949532d5bd9 Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Fri, 29 Nov 2024 16:02:59 -0500 Subject: [PATCH 9/9] format --- gradio/chat_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 4bdc9e9d6df32..b97e69f92f7ed 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -334,7 +334,7 @@ def _setup_events(self) -> None: submit_triggers = [self.textbox.submit, self.chatbot.retry] submit_fn = self._stream_fn if self.is_generator else self._submit_fn if hasattr(self.fn, "zerogpu"): - submit_fn.__func__.zerogpu = self.fn.zerogpu + submit_fn.__func__.zerogpu = self.fn.zerogpu # type: ignore submit_event = ( self.textbox.submit(