gaochangkuan
commited on
Commit
•
7cdd946
1
Parent(s):
a502d76
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
-
|
2 |
-
|
|
|
3 |
import torch
|
4 |
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
5 |
|
6 |
model_path= "CubeAI/Zhuji-Internet-Literature-Intelligent-Writing-Model-V1.0"
|
7 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path, encode_special_tokens=True)
|
8 |
model= AutoModelForCausalLM.from_pretrained(
|
9 |
model_path,
|
10 |
torch_dtype= torch.bfloat16,
|
11 |
low_cpu_mem_usage= True,
|
|
|
12 |
attn_implementation="flash_attention_2",
|
13 |
device_map= "auto"
|
14 |
)
|
|
|
1 |
+
import os
|
2 |
+
token = os.getenv('HUGGINGFACE_TOKEN')
|
3 |
+
|
4 |
import torch
|
5 |
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
6 |
|
7 |
model_path= "CubeAI/Zhuji-Internet-Literature-Intelligent-Writing-Model-V1.0"
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, encode_special_tokens=True, token=token)
|
9 |
model= AutoModelForCausalLM.from_pretrained(
|
10 |
model_path,
|
11 |
torch_dtype= torch.bfloat16,
|
12 |
low_cpu_mem_usage= True,
|
13 |
+
token=token,
|
14 |
attn_implementation="flash_attention_2",
|
15 |
device_map= "auto"
|
16 |
)
|