Comments (3)
What worked for me was to manually set the device_map like following
device = "cuda"
device_map = {
"model.vision_tower": "cuda:1",
"model.vision_resampler": "cuda:1",
"model.mm_projector": "cuda:1",
"model.norm": "cuda:1",
"model.image_newline": "cuda:1",
"model.embed_tokens": "cuda:1",
"lm_head": "cuda:1",
}
for i in range(0, 40):
device_map["model.layers.%d" % i] = "cuda:1"
for i in range(40, 81):
device_map["model.layers.%d" % i] = "cuda:2"
This loads half of the Qwen LLM on gpu1 and the other half on gpu2
from llava-next.
Thank you for your answer. I am doing this:
if '72b' in model_pth:
device = 'cuda'
device_map = {
"model.vision_tower": "cuda:0",
"model.vision_resampler": "cuda:0",
"model.mm_projector": "cuda:0",
"model.norm": "cuda:0",
"model.image_newline": "cuda:0",
"model.embed_tokens": "cuda:0",
"lm_head": "cuda:0",
}
for i in range(0, 27):
device_map["model.layers.%d" % i] = "cuda:0"
for i in range(27, 54):
device_map["model.layers.%d" % i] = "cuda:1"
for i in range(54, 81):
device_map["model.layers.%d" % i] = "cuda:2"
else:
device = 'auto'
device_map = 'auto'
self.tokenizer, self.model, self.image_processor, self.context_len = load_pretrained_model(
model_path=model_pth,
model_base=None,
model_name=model_name,
# device=device,
device_map=device_map,
**llava_model_args
)
But it seems that the code ignores that and is still trying to load the whole model in a single GPU.
from llava-next.
I managed it make it run by directly calling the class instead of using the load_pretrained_model
function:
tokenizer = AutoTokenizer.from_pretrained(model_pth, use_fast=False)
model = LlavaQwenForCausalLM.from_pretrained(
model_pth,
low_cpu_mem_usage=True,
attn_implementation="flash_attention_2",
torch_dtype=TORCH_TYPE,
device_map='auto',
)
from llava-next.
Related Issues (20)
- output of the demo code HOT 1
- videos of LLaVA-NeXT-interleave HOT 1
- When will mm_use_im_start_end be implemented in pre-training?
- LLaVA-NeXT-Interleave Training Details HOT 3
- how to get results? HOT 1
- Do we have some inference accelerate method for new llava-next-video models? HOT 1
- Eval results HOT 6
- How many A100s used for training? HOT 1
- Is LLaVA-NeXT-interleave 7B model availble? HOT 6
- Question about M4-Instruct datasets HOT 3
- Question regarding multi image inference - import vs demo HOT 3
- where is python3 llavavid/eval/eval_activitynet_qa.py? HOT 2
- question about the demo implementation HOT 2
- When will the training code be available? HOT 7
- Training dataset
- Requiremet File HOT 3
- Eval Results HOT 5
- Any plans to support vLLM?
- Can we add preprocessor_config.json for llava-next-interleave-qwen-7b model on Huggingface? HOT 1
- Chinese OCR Fine-tuning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llava-next.