Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Properly Reset Long Term Memory for Multiple Video Inferences Without Reloading the Model? #58

Open
JUNJIE99 opened this issue May 2, 2024 · 3 comments

Comments

@JUNJIE99
Copy link

JUNJIE99 commented May 2, 2024

Hi, thank you for your great work!

I am using the inference.py script for processing multiple videos sequentially. Currently, I have to reload the model to reset the long term memory for each new video, which is quite resource-intensive.

Is there a more efficient way to reinitialize the long term memory without reloading the model each time? Any advice would be highly appreciated.

Thank you for your attention and I look forward to your suggestions.

@JUNJIE99
Copy link
Author

JUNJIE99 commented May 2, 2024

More specifically, I've noticed that the following block of code, which initializes the model and its components, needs to be executed for each new video:

model_config = cfg.model_cfg
model_config.device_8bit = args.gpu_id
model_cls = registry.get_model_class(model_config.arch)
model = model_cls.from_config(model_config).to('cuda:{}'.format(args.gpu_id))
vis_processor_cfg = cfg.datasets_cfg.webvid.vis_processor.train
vis_processor = registry.get_processor_class(vis_processor_cfg.name).from_config(vis_processor_cfg)
chat = Chat(model, vis_processor, device='cuda:{}'.format(args.gpu_id))

This approach requires reloading the entire model. I am looking for a way to manually reset the model's memory state for a new video without having to rerun the entire initialization block.

Thank you for your attention!

@yzy-bupt
Copy link

yzy-bupt commented Aug 4, 2024

Same problem as you.

@Espere-1119-Song
Copy link
Collaborator

do you mean change the length of short-term memory or long-term memory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants