Spaces:
Paused
Paused
Fixed it
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ MAX_INPUT_TOKEN_LENGTH = 4096
|
|
20 |
|
21 |
if torch.cuda.is_available():
|
22 |
model_id = "codys12/MergeLlama-7b"
|
23 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16)
|
24 |
model.cuda()
|
25 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
26 |
|
@@ -44,7 +44,7 @@ def generate(
|
|
44 |
current_input += message
|
45 |
|
46 |
device = "cuda:0"
|
47 |
-
|
48 |
|
49 |
if len(input_ids) > MAX_INPUT_TOKEN_LENGTH:
|
50 |
input_ids = input_ids[-MAX_INPUT_TOKEN_LENGTH:]
|
|
|
20 |
|
21 |
if torch.cuda.is_available():
|
22 |
model_id = "codys12/MergeLlama-7b"
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map=0,)
|
24 |
model.cuda()
|
25 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
26 |
|
|
|
44 |
current_input += message
|
45 |
|
46 |
device = "cuda:0"
|
47 |
+
input_ids = tokenizer(current_input, return_tensors="pt").to(device)
|
48 |
|
49 |
if len(input_ids) > MAX_INPUT_TOKEN_LENGTH:
|
50 |
input_ids = input_ids[-MAX_INPUT_TOKEN_LENGTH:]
|