Updated README for GPU configuration.

#51
Files changed (1) hide show
  1. README.md +7 -0
README.md CHANGED
@@ -109,6 +109,13 @@ model = Qwen2VLForConditionalGeneration.from_pretrained(
109
  "Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto"
110
  )
111
 
 
 
 
 
 
 
 
112
  # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
113
  # model = Qwen2VLForConditionalGeneration.from_pretrained(
114
  # "Qwen/Qwen2-VL-7B-Instruct",
 
109
  "Qwen/Qwen2-VL-7B-Instruct", torch_dtype="auto", device_map="auto"
110
  )
111
 
112
+ # alternative if you are facing nan issues on output with device_map="auto" settings.
113
+ device = torch.device(f"cuda:xxx" if torch.cuda.is_available() else "cpu")
114
+ # model = Qwen2VLForConditionalGeneration.from_pretrained(
115
+ # "Qwen/Qwen2-VL-7B-Instruct", torch_dtype=torch.bfloat16, device_map=device
116
+ #)
117
+ # model.eval()
118
+
119
  # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
120
  # model = Qwen2VLForConditionalGeneration.from_pretrained(
121
  # "Qwen/Qwen2-VL-7B-Instruct",