Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -26,13 +26,15 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
26 |
model_name = "01-ai/Yi-6B-200K"
|
27 |
|
28 |
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
|
|
29 |
# tokenizer = YiTokenizer(vocab_file=model_name)
|
30 |
model = transformers.AutoModelForCausalLM.from_pretrained(model_name,
|
31 |
-
device_map=
|
32 |
torch_dtype=torch.bfloat16,
|
33 |
load_in_4bit=True,
|
34 |
trust_remote_code=True
|
35 |
)
|
|
|
36 |
|
37 |
# Load the model and tokenizer using transformers
|
38 |
# model = AutoModelForCausalLM.from_pretrained("01-ai/Yi-6B-200K", trust_remote_code=True)
|
|
|
26 |
model_name = "01-ai/Yi-6B-200K"
|
27 |
|
28 |
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
29 |
+
tokenizer = tokenizer.cuda()
|
30 |
# tokenizer = YiTokenizer(vocab_file=model_name)
|
31 |
model = transformers.AutoModelForCausalLM.from_pretrained(model_name,
|
32 |
+
device_map="auto",
|
33 |
torch_dtype=torch.bfloat16,
|
34 |
load_in_4bit=True,
|
35 |
trust_remote_code=True
|
36 |
)
|
37 |
+
model = model.cuda()
|
38 |
|
39 |
# Load the model and tokenizer using transformers
|
40 |
# model = AutoModelForCausalLM.from_pretrained("01-ai/Yi-6B-200K", trust_remote_code=True)
|