cleaning up
Browse files
app.py
CHANGED
|
@@ -1,11 +1,8 @@
|
|
| 1 |
import sys
|
| 2 |
import torch
|
| 3 |
-
# import torch._dynamo.device_interface
|
| 4 |
import torch.utils._triton
|
| 5 |
|
| 6 |
-
# Hack unsloth to work without GPU
|
| 7 |
-
def fake_triton_check():
|
| 8 |
-
return False # Prevents `bitsandbytes` from requiring GPU
|
| 9 |
def fake_is_available():
|
| 10 |
return True
|
| 11 |
def fake_device_capability(*args, **kwargs):
|
|
@@ -25,6 +22,7 @@ sys.modules["torch"].cuda.current_device = fake_current_device
|
|
| 25 |
sys.modules["torch"].cuda.device_count = fake_device_count
|
| 26 |
sys.modules["torch.utils._triton"].has_triton = has_triton
|
| 27 |
sys.modules["torch._C"]._cuda_getCurrentRawStream = get_fake_stream
|
|
|
|
| 28 |
|
| 29 |
import streamlit as st
|
| 30 |
from unsloth.chat_templates import get_chat_template, CHAT_TEMPLATES
|
|
@@ -106,6 +104,6 @@ masked_text = text_tokenizer.decode([mask if x == -100 else x for x in ids])
|
|
| 106 |
st.markdown("#### Masked Prompt ('x' is the mask token)")
|
| 107 |
st.code(masked_text, language="html")
|
| 108 |
|
| 109 |
-
st.markdown("####
|
| 110 |
url = f"https://zeel-twro.hf.space?model={model}&message={message}&instruction_part={instruction_part}&response_part={response_part}"
|
| 111 |
-
st.
|
|
|
|
| 1 |
import sys
|
| 2 |
import torch
|
|
|
|
| 3 |
import torch.utils._triton
|
| 4 |
|
| 5 |
+
# >>> Hack unsloth to work without GPU
|
|
|
|
|
|
|
| 6 |
def fake_is_available():
|
| 7 |
return True
|
| 8 |
def fake_device_capability(*args, **kwargs):
|
|
|
|
| 22 |
sys.modules["torch"].cuda.device_count = fake_device_count
|
| 23 |
sys.modules["torch.utils._triton"].has_triton = has_triton
|
| 24 |
sys.modules["torch._C"]._cuda_getCurrentRawStream = get_fake_stream
|
| 25 |
+
# <<<
|
| 26 |
|
| 27 |
import streamlit as st
|
| 28 |
from unsloth.chat_templates import get_chat_template, CHAT_TEMPLATES
|
|
|
|
| 104 |
st.markdown("#### Masked Prompt ('x' is the mask token)")
|
| 105 |
st.code(masked_text, language="html")
|
| 106 |
|
| 107 |
+
st.markdown("#### You may share the following URL with others to show them the results")
|
| 108 |
url = f"https://zeel-twro.hf.space?model={model}&message={message}&instruction_part={instruction_part}&response_part={response_part}"
|
| 109 |
+
st.markdown(f"`{url}`")
|