change
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ import os
|
|
7 |
from transformers import GemmaTokenizer, AutoModelForCausalLM
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
from threading import Thread
|
|
|
10 |
|
11 |
# Set an environment variable
|
12 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
@@ -57,7 +58,7 @@ h1 {
|
|
57 |
# Load the tokenizer and model
|
58 |
model_path = "Zhengyi/LLaMA-Mesh"
|
59 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
60 |
-
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="
|
61 |
terminators = [
|
62 |
tokenizer.eos_token_id,
|
63 |
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
|
|
7 |
from transformers import GemmaTokenizer, AutoModelForCausalLM
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
from threading import Thread
|
10 |
+
import torch
|
11 |
|
12 |
# Set an environment variable
|
13 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
|
|
58 |
# Load the tokenizer and model
|
59 |
model_path = "Zhengyi/LLaMA-Mesh"
|
60 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
61 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="cuda:0", torch_dtype=torch.float16).to('cuda')
|
62 |
terminators = [
|
63 |
tokenizer.eos_token_id,
|
64 |
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|