JingyeChen commited on
Commit
cde0b82
1 Parent(s): a1ce13a
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -34,6 +34,7 @@ if not os.path.exists('images2'):
34
  # os.system('wget https://huggingface.co/JingyeChen22/textdiffuser2-full-ft/blob/main/gray256.jpg')
35
 
36
  # print(os.system('apt install mlocate'))
 
37
  os.system('ls')
38
  # print(os.system('pwd'))
39
  # print(os.system('locate gray256.jpg'))
@@ -43,17 +44,23 @@ os.system('ls')
43
 
44
  #### import m1
45
  from fastchat.model import load_model, get_conversation_template
 
46
  m1_model_path = 'JingyeChen22/textdiffuser2_layout_planner'
47
- m1_model, m1_tokenizer = load_model(
48
- m1_model_path,
49
- 'cuda',
50
- 1,
51
- None,
52
- False,
53
- False,
54
- revision="main",
55
- debug=False,
56
- )
 
 
 
 
 
57
 
58
  #### import diffusion models
59
  text_encoder = CLIPTextModel.from_pretrained(
 
34
  # os.system('wget https://huggingface.co/JingyeChen22/textdiffuser2-full-ft/blob/main/gray256.jpg')
35
 
36
  # print(os.system('apt install mlocate'))
37
+ os.system('nvidia-smi')
38
  os.system('ls')
39
  # print(os.system('pwd'))
40
  # print(os.system('locate gray256.jpg'))
 
44
 
45
  #### import m1
46
  from fastchat.model import load_model, get_conversation_template
47
+ from transformers import AutoTokenizer, AutoModelForCausalLM
48
  m1_model_path = 'JingyeChen22/textdiffuser2_layout_planner'
49
+ # m1_model, m1_tokenizer = load_model(
50
+ # m1_model_path,
51
+ # 'cuda',
52
+ # 1,
53
+ # None,
54
+ # False,
55
+ # False,
56
+ # revision="main",
57
+ # debug=False,
58
+ # )
59
+
60
+ m1_tokenizer = AutoTokenizer.from_pretrained(m1_model_path, use_fast=False)
61
+ m1_model = AutoModelForCausalLM.from_pretrained(
62
+ m1_model_path, torch_dtype=torch.float16, low_cpu_mem_usage=True
63
+ ).cuda()
64
 
65
  #### import diffusion models
66
  text_encoder = CLIPTextModel.from_pretrained(