Spaces:
Runtime error
Runtime error
crazyTransBitch (#1)
Browse files- Update app.py (30476bb7aa7edf1d6d2e56d4d7bd9d91fd44089f)
- Update app.py (31b6033aad801a3dd3d4344912f37623b8854b1b)
- Update app.py (d0a36d2590e317c60d740bcd171453ca0e6f6f38)
- Update app.py (e0e2048cb5928ba24e1a11676d12d3b17913b338)
- Update app.py (72adf3e80be729cb6bba9ce04c2aadd775dca37f)
Co-authored-by: Willow S Hart <[email protected]>
app.py
CHANGED
|
@@ -2,7 +2,8 @@ import spaces
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
import transformers
|
| 5 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
title = """# Welcome to 🌟Tonic's🐇🥷🏻Trinity
|
|
@@ -23,6 +24,11 @@ Answer the Question by exploring multiple reasoning paths as follows:
|
|
| 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 |
|
|
@@ -32,10 +38,9 @@ if not hf_token:
|
|
| 32 |
|
| 33 |
model = AutoModelForCausalLM.from_pretrained(
|
| 34 |
model_path,
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
trust_remote_code=True,
|
| 39 |
)
|
| 40 |
|
| 41 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
import transformers
|
| 5 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 6 |
+
import accelerate
|
| 7 |
import os
|
| 8 |
|
| 9 |
title = """# Welcome to 🌟Tonic's🐇🥷🏻Trinity
|
|
|
|
| 24 |
- 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.
|
| 25 |
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.
|
| 26 |
"""
|
| 27 |
+
quantization_config = BitsAndBytesConfig(
|
| 28 |
+
load_in_4bit=True,
|
| 29 |
+
bnb_4bit_use_double_quant=True,
|
| 30 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
| 31 |
+
)
|
| 32 |
|
| 33 |
model_path = "WhiteRabbitNeo/Trinity-13B"
|
| 34 |
|
|
|
|
| 38 |
|
| 39 |
model = AutoModelForCausalLM.from_pretrained(
|
| 40 |
model_path,
|
| 41 |
+
device_map="auto",
|
| 42 |
+
trust_remote_code=True,
|
| 43 |
+
quantization_config=quantization_config
|
|
|
|
| 44 |
)
|
| 45 |
|
| 46 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|