Spaces:
Runtime error
Runtime error
jaymojnidar
commited on
Commit
•
d4772a6
1
Parent(s):
7d41378
remvoing cuda dependencies
Browse files
app.py
CHANGED
@@ -81,7 +81,9 @@ def generate(
|
|
81 |
def process_example(message: str) -> tuple[str, list[tuple[str, str]]]:
|
82 |
generator = generate(message, [], DEFAULT_SYSTEM_PROMPT, 1024, 1, 0.95, 50)
|
83 |
for x in generator:
|
|
|
84 |
pass
|
|
|
85 |
return '', x
|
86 |
|
87 |
|
|
|
81 |
def process_example(message: str) -> tuple[str, list[tuple[str, str]]]:
|
82 |
generator = generate(message, [], DEFAULT_SYSTEM_PROMPT, 1024, 1, 0.95, 50)
|
83 |
for x in generator:
|
84 |
+
print(f"Printing x before pass {x}")
|
85 |
pass
|
86 |
+
print(f"Printing x after pass {x}")
|
87 |
return '', x
|
88 |
|
89 |
|
model.py
CHANGED
@@ -28,6 +28,7 @@ if not torch.cuda.is_available():
|
|
28 |
device_map='auto',
|
29 |
use_auth_token=True
|
30 |
)
|
|
|
31 |
else:
|
32 |
model = None
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
@@ -61,7 +62,7 @@ def run(message: str,
|
|
61 |
top_p: float = 0.95,
|
62 |
top_k: int = 50) -> Iterator[str]:
|
63 |
prompt = get_prompt(message, chat_history, system_prompt)
|
64 |
-
inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False).to('cuda')
|
65 |
|
66 |
streamer = TextIteratorStreamer(tokenizer,
|
67 |
timeout=10.,
|
|
|
28 |
device_map='auto',
|
29 |
use_auth_token=True
|
30 |
)
|
31 |
+
print("Loaded the model!")
|
32 |
else:
|
33 |
model = None
|
34 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
|
62 |
top_p: float = 0.95,
|
63 |
top_k: int = 50) -> Iterator[str]:
|
64 |
prompt = get_prompt(message, chat_history, system_prompt)
|
65 |
+
inputs = tokenizer([prompt], return_tensors='pt', add_special_tokens=False).to(torch.device) #.to('cuda')
|
66 |
|
67 |
streamer = TextIteratorStreamer(tokenizer,
|
68 |
timeout=10.,
|