Tonic commited on
Commit
c70e8e5
1 Parent(s): 555e2ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -17
app.py CHANGED
@@ -5,26 +5,16 @@ import transformers
5
  from transformers import AutoModelForCausalLM, AutoTokenizer
6
  import os
7
 
8
- title = """# Welcome to 🌟Tonic's🐇🥷🏻Trinity
9
  You can build with this endpoint using🐇🥷🏻Trinity available here : [WhiteRabbitNeo/Trinity-13B](https://huggingface.co//WhiteRabbitNeo/Trinity-13B). You can also use 🐇🥷🏻Trinity by cloning this space. Simply click here: <a style="display:inline-block" href="https://huggingface.co/spaces/Tonic/trinity?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></h3>
10
  Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) Math 🔍 [introspector](https://huggingface.co/introspector) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [SciTonic](https://github.com/Tonic-AI/scitonic)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
11
  """
12
 
13
 
14
- default_system_prompt = """
15
- Answer the Question by exploring multiple reasoning paths as follows:
16
- - First, carefully analyze the question to extract the key information components and break it down into logical sub-questions. This helps set up the framework for reasoning. The goal is to construct an internal search tree.
17
- - For each sub-question, leverage your knowledge to generate 2-3 intermediate thoughts that represent steps towards an answer. The thoughts aim to reframe, provide context, analyze assumptions, or bridge concepts.
18
- - Evaluate the clarity, relevance, logical flow and coverage of concepts for each thought option. Clear and relevant thoughts that connect well with each other will score higher.
19
- - Based on the thought evaluations, deliberate to construct a chain of reasoning that stitches together the strongest thoughts in a natural order.
20
- - If the current chain is determined to not fully answer the question, backtrack and explore alternative paths by substituting different high-scoring thoughts.
21
- - Throughout the reasoning process, aim to provide explanatory details on thought process rather than just state conclusions, including briefly noting why some thoughts were deemed less ideal.
22
- - Once a reasoning chain is constructed that thoroughly answers all sub-questions in a clear, logical manner, synthesize the key insights into a final concise answer.
23
- - Please note that while the focus is on the final answer in the response, it should also include intermediate thoughts inline to illustrate the deliberative reasoning process.
24
- In summary, leverage a Tree of Thoughts approach to actively explore multiple reasoning paths, evaluate thoughts heuristically, and explain the process - with the goal of producing insightful answers.
25
- """
26
 
27
- model_path = "WhiteRabbitNeo/Trinity-13B"
28
 
29
  hf_token = os.getenv("HF_TOKEN")
30
  if not hf_token:
@@ -34,7 +24,8 @@ model = AutoModelForCausalLM.from_pretrained(
34
  model_path,
35
  torch_dtype=torch.float16,
36
  device_map="auto",
37
- load_in_8bit=True,
 
38
  trust_remote_code=True,
39
  )
40
 
@@ -67,7 +58,7 @@ def gradio_app():
67
  with gr.Blocks() as demo:
68
  gr.Markdown(title)
69
  with gr.Row():
70
- custom_prompt = gr.Textbox(label="Custom System Prompt (optional)", placeholder="Leave blank to use the default prompt...")
71
  instruction = gr.Textbox(label="Your Instruction", placeholder="Type your question here...")
72
  with gr.Row():
73
  temperature = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, value=0.5, label="Temperature")
@@ -76,7 +67,7 @@ def gradio_app():
76
  top_k = gr.Slider(minimum=0, maximum=100, step=1, value=50, label="Top K")
77
  with gr.Row():
78
  generate_btn = gr.Button("Generate")
79
- output = gr.Textbox(label="Generated Text", lines=10, placeholder="Generated answer will appear here...")
80
 
81
  generate_btn.click(
82
  fn=generate_text,
 
5
  from transformers import AutoModelForCausalLM, AutoTokenizer
6
  import os
7
 
8
+ title = """# Welcome to 🌟Tonic's🐇🥷🏻Neo
9
  You can build with this endpoint using🐇🥷🏻Trinity available here : [WhiteRabbitNeo/Trinity-13B](https://huggingface.co//WhiteRabbitNeo/Trinity-13B). You can also use 🐇🥷🏻Trinity by cloning this space. Simply click here: <a style="display:inline-block" href="https://huggingface.co/spaces/Tonic/trinity?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a></h3>
10
  Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/GWpVpekp) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) Math 🔍 [introspector](https://huggingface.co/introspector) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [SciTonic](https://github.com/Tonic-AI/scitonic)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
11
  """
12
 
13
 
14
+ default_system_prompt = """SYSTEM: You are an AI that code. Answer with code."""
15
+
16
+ model_path = "whiterabbitneo/WhiteRabbitNeo-33B-v-1"
 
 
 
 
 
 
 
 
 
17
 
 
18
 
19
  hf_token = os.getenv("HF_TOKEN")
20
  if not hf_token:
 
24
  model_path,
25
  torch_dtype=torch.float16,
26
  device_map="auto",
27
+ load_in_4bit=True,
28
+ load_in_8bit=False,
29
  trust_remote_code=True,
30
  )
31
 
 
58
  with gr.Blocks() as demo:
59
  gr.Markdown(title)
60
  with gr.Row():
61
+ custom_prompt = gr.Textbox(label="🐇🥷🏻NeoCustom System Prompt (optional)", placeholder="Leave blank to use the default prompt...")
62
  instruction = gr.Textbox(label="Your Instruction", placeholder="Type your question here...")
63
  with gr.Row():
64
  temperature = gr.Slider(minimum=0.1, maximum=1.0, step=0.1, value=0.5, label="Temperature")
 
67
  top_k = gr.Slider(minimum=0, maximum=100, step=1, value=50, label="Top K")
68
  with gr.Row():
69
  generate_btn = gr.Button("Generate")
70
+ output = gr.Code(label="Generated Text", lines=10, placeholder="🐇🥷🏻Neo:")
71
 
72
  generate_btn.click(
73
  fn=generate_text,