sjzhao commited on
Commit
2ecc4f3
1 Parent(s): 94138ba

update flask

Browse files
Files changed (1) hide show
  1. gradio_demo/seed_llama_flask.py +5 -4
gradio_demo/seed_llama_flask.py CHANGED
@@ -66,8 +66,12 @@ class LLMService:
66
  self.image_id_shift = 32000
67
 
68
  self.image_transform = hydra.utils.instantiate(image_transform_cfg)
69
- self.tokenizer = hydra.utils.instantiate(tokenizer_cfg, device=args.tokenizer_device, load_diffusion=True)
70
 
 
 
 
 
 
71
  if args.offload_encoder:
72
  self.tokenizer.image_tokenizer.model.visual_encoder.to('cpu')
73
  if args.offload_decoder:
@@ -75,9 +79,6 @@ class LLMService:
75
 
76
  # model = hydra.utils.instantiate(model_cfg, torch_dtype=torch.float16)
77
  # self.model = model.eval().to(args.llm_device)
78
- model = hydra.utils.instantiate(model_cfg, device_map=args.llm_device).eval()
79
- self.model = model
80
- print(model.get_memory_footprint())
81
  self.llm_device = args.llm_device
82
  self.tokenizer_device = args.tokenizer_device
83
  self.offload_encoder = args.offload_encoder
 
66
  self.image_id_shift = 32000
67
 
68
  self.image_transform = hydra.utils.instantiate(image_transform_cfg)
 
69
 
70
+ model = hydra.utils.instantiate(model_cfg, device_map=args.llm_device).eval()
71
+ self.model = model
72
+ print(model.get_memory_footprint())
73
+
74
+ self.tokenizer = hydra.utils.instantiate(tokenizer_cfg, device=args.tokenizer_device, load_diffusion=True)
75
  if args.offload_encoder:
76
  self.tokenizer.image_tokenizer.model.visual_encoder.to('cpu')
77
  if args.offload_decoder:
 
79
 
80
  # model = hydra.utils.instantiate(model_cfg, torch_dtype=torch.float16)
81
  # self.model = model.eval().to(args.llm_device)
 
 
 
82
  self.llm_device = args.llm_device
83
  self.tokenizer_device = args.tokenizer_device
84
  self.offload_encoder = args.offload_encoder