banao-tech commited on
Commit
c5d6df1
·
verified ·
1 Parent(s): 481903b

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -12
main.py CHANGED
@@ -43,18 +43,13 @@ processor = AutoProcessor.from_pretrained(
43
  "microsoft/Florence-2-base", trust_remote_code=True
44
  )
45
 
46
- try:
47
- model = AutoModelForCausalLM.from_pretrained(
48
- "weights/icon_caption_florence",
49
- torch_dtype=torch.float16,
50
- trust_remote_code=True,
51
- ).to("cuda")
52
- except:
53
- model = AutoModelForCausalLM.from_pretrained(
54
- "weights/icon_caption_florence",
55
- torch_dtype=torch.float16,
56
- trust_remote_code=True,
57
- )
58
  caption_model_processor = {"processor": processor, "model": model}
59
  print("finish loading model!!!")
60
 
 
43
  "microsoft/Florence-2-base", trust_remote_code=True
44
  )
45
 
46
+
47
+ model = AutoModelForCausalLM.from_pretrained(
48
+ "weights/icon_caption_florence",
49
+ torch_dtype=torch.float16,
50
+ trust_remote_code=True,
51
+ device_map='auto',
52
+ ).to("cuda")
 
 
 
 
 
53
  caption_model_processor = {"processor": processor, "model": model}
54
  print("finish loading model!!!")
55