Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,8 @@ from threading import Thread
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1")
|
| 7 |
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1", torch_dtype=torch.float16)
|
| 8 |
model = model.to('cuda:0')
|
| 9 |
-
|
|
|
|
| 10 |
class StopOnTokens(StoppingCriteria):
|
| 11 |
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
|
| 12 |
stop_ids = [29, 0]
|
|
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1")
|
| 7 |
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-Chat-3B-v1", torch_dtype=torch.float16)
|
| 8 |
model = model.to('cuda:0')
|
| 9 |
+
cfg = get_cfg()
|
| 10 |
+
cfg.MODEL.DEVICE = 'cpu'
|
| 11 |
class StopOnTokens(StoppingCriteria):
|
| 12 |
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
|
| 13 |
stop_ids = [29, 0]
|