Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from janus.models import MultiModalityCausalLM, VLChatProcessor
|
|
3 |
from janus.utils.io import load_pil_images
|
4 |
import numpy as np
|
5 |
from PIL import Image
|
6 |
-
from transformers import AutoModelForCausalLM
|
7 |
import torch
|
8 |
|
9 |
##
|
@@ -116,6 +116,10 @@ if __name__ == '__main__':
|
|
116 |
model_path = 'deepseek-ai/Janus-1.3B'
|
117 |
processor: VLChatProcessor = VLChatProcessor.from_pretrained(model_path)
|
118 |
tokenizer = processor.tokenizer
|
119 |
-
model: MultiModalityCausalLM = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
demo.launch()
|
|
|
3 |
from janus.utils.io import load_pil_images
|
4 |
import numpy as np
|
5 |
from PIL import Image
|
6 |
+
from transformers import AutoConfig, AutoModelForCausalLM
|
7 |
import torch
|
8 |
|
9 |
##
|
|
|
116 |
model_path = 'deepseek-ai/Janus-1.3B'
|
117 |
processor: VLChatProcessor = VLChatProcessor.from_pretrained(model_path)
|
118 |
tokenizer = processor.tokenizer
|
119 |
+
# model: MultiModalityCausalLM = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
|
120 |
+
config = AutoConfig.from_pretrained(model_path)
|
121 |
+
config.language_config._attn_implementation = 'eager'
|
122 |
+
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True)
|
123 |
+
# model = model.to(torch.bfloat16).cuda()
|
124 |
+
model = model.to(torch.float16)
|
125 |
demo.launch()
|