Initial commit

This commit is contained in:
hanluzhi0429@gmail.com
2025-04-13 09:30:46 +08:00
commit 4f8972e88a
248 changed files with 34689 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import os
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--src", type=str)
parser.add_argument("--dst", type=str)
args = parser.parse_args()
all_answers = []
for line_idx, line in enumerate(open(args.src)):
res = json.loads(line)
question_id = res["question_id"]
text = res["text"].rstrip(".").lower()
all_answers.append({"questionId": question_id, "prediction": text})
with open(args.dst, "w") as f:
json.dump(all_answers, f)
@@ -0,0 +1,18 @@
import os
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--src", type=str)
parser.add_argument("--dst", type=str)
args = parser.parse_args()
cur_result = {}
for line in open(args.src):
data = json.loads(line)
qid = data["question_id"]
cur_result[f"v1_{qid}"] = data["text"]
with open(args.dst, "w") as f:
json.dump(cur_result, f, indent=2)
+88
View File
@@ -0,0 +1,88 @@
import json
import os
import fire
import re
from convert_sqa_to_llava_base_prompt import build_prompt_chatbot
def convert_to_llava(base_dir, split, prompt_format="QCM-LEA"):
split_indices = json.load(open(os.path.join(base_dir, "pid_splits.json")))[split]
problems = json.load(open(os.path.join(base_dir, "problems.json")))
split_problems = build_prompt_chatbot(problems, split_indices, prompt_format, use_caption=False, is_test=False)
target_format = []
for prob_id, (input, output) in split_problems.items():
if input.startswith("Question: "):
input = input.replace("Question: ", "")
if output.startswith("Answer: "):
output = output.replace("Answer: ", "")
raw_prob_data = problems[prob_id]
if raw_prob_data["image"] is None:
target_format.append(
{
"id": prob_id,
"conversations": [
{"from": "human", "value": f"{input}"},
{"from": "gpt", "value": f"{output}"},
],
}
)
else:
target_format.append(
{
"id": prob_id,
"image": os.path.join(prob_id, raw_prob_data["image"]),
"conversations": [
{"from": "human", "value": f"{input}\n<image>"},
{"from": "gpt", "value": f"{output}"},
],
}
)
print(f"Number of samples: {len(target_format)}")
with open(os.path.join(base_dir, f"llava_{split}_{prompt_format}.json"), "w") as f:
json.dump(target_format, f, indent=2)
def convert_to_jsonl(base_dir, split, prompt_format="QCM-LEPA"):
split_indices = json.load(open(os.path.join(base_dir, "pid_splits.json")))[split]
problems = json.load(open(os.path.join(base_dir, "problems.json")))
split_problems = build_prompt_chatbot(problems, split_indices, prompt_format, use_caption=False, is_test=False)
writer = open(os.path.join(base_dir, f"scienceqa_{split}_{prompt_format}.jsonl"), "w")
for prob_id, (input, output) in split_problems.items():
if input.startswith("Question: "):
input = input.replace("Question: ", "")
if output.startswith("Answer: "):
output = output.replace("Answer: ", "")
raw_prob_data = problems[prob_id]
if raw_prob_data["image"] is None:
data = {
"id": prob_id,
"instruction": f"{input}",
"output": f"{output}",
}
else:
data = {
"id": prob_id,
"image": os.path.join(prob_id, raw_prob_data["image"]),
"instruction": f"{input}\n<image>",
"output": f"{output}",
}
writer.write(json.dumps(data) + "\n")
writer.close()
def main(task, **kwargs):
globals()[task](**kwargs)
if __name__ == "__main__":
fire.Fire(main)
@@ -0,0 +1,298 @@
def get_question_text(problem):
question = problem["question"]
return question
def get_context_text(problem, use_caption):
txt_context = problem["hint"]
img_context = problem["caption"] if use_caption else ""
context = " ".join([txt_context, img_context]).strip()
if context == "":
context = "N/A"
return context
def get_choice_text(probelm, options):
choices = probelm["choices"]
choice_list = []
for i, c in enumerate(choices):
choice_list.append("({}) {}".format(options[i], c))
choice_txt = " ".join(choice_list)
# print(choice_txt)
return choice_txt
def get_answer(problem, options):
return options[problem["answer"]]
def get_lecture_text(problem):
# \\n: GPT-3 can generate the lecture with more tokens.
lecture = problem["lecture"].replace("\n", "\\n")
return lecture
def get_solution_text(problem):
# \\n: GPT-3 can generate the solution with more tokens
solution = problem["solution"].replace("\n", "\\n")
return solution
def create_one_example_chatbot(format, question, context, choice, answer, lecture, solution, test_example=True):
input_format, output_format = format.split("-")
## Inputs
if input_format == "CQM":
input = f"Context: {context}\nQuestion: {question}\nOptions: {choice}\n"
elif input_format == "QCM":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\n"
# upper bound experiment
elif input_format == "QCML":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {lecture}\n"
elif input_format == "QCME":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {solution}\n"
elif input_format == "QCMLE":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {lecture} {solution}\n"
elif input_format == "QCLM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {lecture}\nOptions: {choice}\n"
elif input_format == "QCEM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {solution}\nOptions: {choice}\n"
elif input_format == "QCLEM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {lecture} {solution}\nOptions: {choice}\n"
# Outputs
if test_example:
output = "Answer:"
elif output_format == "A":
output = f"Answer: The answer is {answer}."
elif output_format == "AL":
output = f"Answer: The answer is {answer}. BECAUSE: {solution}"
elif output_format == "AE":
output = f"Answer: The answer is {answer}. BECAUSE: {lecture}"
elif output_format == "ALE":
output = f"Answer: The answer is {answer}. BECAUSE: {lecture} {solution}"
elif output_format == "AEL":
output = f"Answer: The answer is {answer}. BECAUSE: {solution} {lecture}"
elif output_format == "LA":
output = f"Answer: {lecture} The answer is {answer}."
elif output_format == "EA":
output = f"Answer: {solution} The answer is {answer}."
elif output_format == "LEA":
output = f"Answer: {lecture} {solution} The answer is {answer}."
elif output_format == "ELA":
output = f"Answer: {solution} {lecture} The answer is {answer}."
elif output_format == "LEPA":
output = ""
if len(lecture.strip()) > 0:
output += f"LECTURE: {lecture}\n"
if len(solution.strip()) > 0:
output += f"SOLUTION: {solution}\n"
output += "###\n"
output += f"ANSWER: {answer}."
input = input.replace(" ", " ").strip()
output = output.replace(" ", " ").strip()
if input.endswith("BECAUSE:"):
input = input.replace("BECAUSE:", "").strip()
if output.endswith("BECAUSE:"):
output = output.replace("BECAUSE:", "").strip()
return input, output
def create_one_example(format, question, context, choice, answer, lecture, solution, test_example=True):
input_format, output_format = format.split("-")
## Inputs
if input_format == "CQM":
input = f"Context: {context}\nQuestion: {question}\nOptions: {choice}\n"
elif input_format == "QCM":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\n"
# upper bound experiment
elif input_format == "QCML":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {lecture}\n"
elif input_format == "QCME":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {solution}\n"
elif input_format == "QCMLE":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {lecture} {solution}\n"
elif input_format == "QCLM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {lecture}\nOptions: {choice}\n"
elif input_format == "QCEM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {solution}\nOptions: {choice}\n"
elif input_format == "QCLEM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {lecture} {solution}\nOptions: {choice}\n"
# Outputs
if test_example:
output = "Answer:"
elif output_format == "A":
output = f"Answer: The answer is {answer}."
elif output_format == "AL":
output = f"Answer: The answer is {answer}. BECAUSE: {solution}"
elif output_format == "AE":
output = f"Answer: The answer is {answer}. BECAUSE: {lecture}"
elif output_format == "ALE":
output = f"Answer: The answer is {answer}. BECAUSE: {lecture} {solution}"
elif output_format == "AEL":
output = f"Answer: The answer is {answer}. BECAUSE: {solution} {lecture}"
elif output_format == "LA":
output = f"Answer: {lecture} The answer is {answer}."
elif output_format == "EA":
output = f"Answer: {solution} The answer is {answer}."
elif output_format == "LEA":
output = f"Answer: {lecture} {solution} The answer is {answer}."
elif output_format == "ELA":
output = f"Answer: {solution} {lecture} The answer is {answer}."
text = input + output
text = text.replace(" ", " ").strip()
if text.endswith("BECAUSE:"):
text = text.replace("BECAUSE:", "").strip()
return text
def create_one_example_gpt4(format, question, context, choice, answer, lecture, solution, test_example=True):
input_format, output_format = format.split("-")
## Inputs
if input_format == "CQM":
input = f"Context: {context}\nQuestion: {question}\nOptions: {choice}\n"
elif input_format == "QCM":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\n"
# upper bound experiment
elif input_format == "QCML":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {lecture}\n"
elif input_format == "QCME":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {solution}\n"
elif input_format == "QCMLE":
input = f"Question: {question}\nContext: {context}\nOptions: {choice}\nBECAUSE: {lecture} {solution}\n"
elif input_format == "QCLM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {lecture}\nOptions: {choice}\n"
elif input_format == "QCEM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {solution}\nOptions: {choice}\n"
elif input_format == "QCLEM":
input = f"Question: {question}\nContext: {context}\nBECAUSE: {lecture} {solution}\nOptions: {choice}\n"
# Outputs
if test_example:
output = "Answer:"
elif output_format == "A":
output = f"Answer: The answer is {answer}."
elif output_format == "AL":
output = f"Answer: The answer is {answer}. BECAUSE: {solution}"
elif output_format == "AE":
output = f"Answer: The answer is {answer}. BECAUSE: {lecture}"
elif output_format == "ALE":
output = f"Answer: The answer is {answer}. BECAUSE: {lecture} {solution}"
elif output_format == "AEL":
output = f"Answer: The answer is {answer}. BECAUSE: {solution} {lecture}"
elif output_format == "LA":
output = f"Answer: {lecture} The answer is {answer}."
elif output_format == "EA":
output = f"Answer: {solution} The answer is {answer}."
elif output_format == "LEA":
output = f"Answer: {lecture} {solution} The answer is {answer}."
elif output_format == "ELA":
output = f"Answer: {solution} {lecture} The answer is {answer}."
input = input.replace(" ", " ").strip()
output = output.replace(" ", " ").strip()
if output.endswith("BECAUSE:"):
output = output.replace("BECAUSE:", "").strip()
user_prompt = {"role": "user", "content": f"Can you explain {input}?"}
assistant_prompt = {"role": "assistant", "content": f"{output}"}
return user_prompt, assistant_prompt
def build_prompt_chatbot(problems, shot_qids, prompt_format, use_caption=False, options=["A", "B", "C", "D", "E"], is_test=False):
examples = {}
for qid in shot_qids:
question = get_question_text(problems[qid])
context = get_context_text(problems[qid], use_caption)
choice = get_choice_text(problems[qid], options)
answer = get_answer(problems[qid], options)
lecture = get_lecture_text(problems[qid]).replace("\\n", "\n")
solution = get_solution_text(problems[qid]).replace("\\n", "\n")
train_example = create_one_example_chatbot(prompt_format, question, context, choice, answer, lecture, solution, test_example=is_test)
examples[qid] = train_example
return examples
def build_prompt(problems, shot_qids, test_qid, args):
examples = []
# n-shot training examples
for qid in shot_qids:
question = get_question_text(problems[qid])
context = get_context_text(problems[qid], args.use_caption)
choice = get_choice_text(problems[qid], args.options)
answer = get_answer(problems[qid], args.options)
lecture = get_lecture_text(problems[qid])
solution = get_solution_text(problems[qid])
train_example = create_one_example(args.prompt_format, question, context, choice, answer, lecture, solution, test_example=False)
examples.append(train_example)
# test example
question = get_question_text(problems[test_qid])
context = get_context_text(problems[test_qid], args.use_caption)
choice = get_choice_text(problems[test_qid], args.options)
answer = get_answer(problems[test_qid], args.options)
lecture = get_lecture_text(problems[test_qid])
solution = get_solution_text(problems[test_qid])
test_example = create_one_example(args.prompt_format, question, context, choice, answer, lecture, solution, test_example=True)
examples.append(test_example)
# create the prompt input
prompt_input = "\n\n".join(examples)
return prompt_input
def build_prompt_gpt4(problems, shot_qids, test_qid, args):
prompt_array = [{"role": "system", "content": "You are a helpful assistant."}]
# n-shot training examples
for qid in shot_qids:
question = get_question_text(problems[qid])
context = get_context_text(problems[qid], args.use_caption)
choice = get_choice_text(problems[qid], args.options)
answer = get_answer(problems[qid], args.options)
lecture = get_lecture_text(problems[qid])
solution = get_solution_text(problems[qid])
user_prompt, assistant_prompt = create_one_example_gpt4(args.prompt_format, question, context, choice, answer, lecture, solution, test_example=False)
prompt_array.append(user_prompt)
prompt_array.append(assistant_prompt)
# test example
question = get_question_text(problems[test_qid])
context = get_context_text(problems[test_qid], args.use_caption)
choice = get_choice_text(problems[test_qid], args.options)
answer = get_answer(problems[test_qid], args.options)
lecture = get_lecture_text(problems[test_qid])
solution = get_solution_text(problems[test_qid])
user_prompt, assistant_prompt = create_one_example_gpt4(args.prompt_format, question, context, choice, answer, lecture, solution, test_example=True)
prompt_array.append(user_prompt)
prompt_array.append(assistant_prompt)
return prompt_array
@@ -0,0 +1,45 @@
import os
import argparse
import json
from llava.eval.m4c_evaluator import EvalAIAnswerProcessor
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--annotation-file", type=str, required=True)
parser.add_argument("--result-file", type=str, required=True)
parser.add_argument("--result-upload-file", type=str, required=True)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
os.makedirs(os.path.dirname(args.result_upload_file), exist_ok=True)
results = []
error_line = 0
for line_idx, line in enumerate(open(args.result_file)):
try:
results.append(json.loads(line))
except:
error_line += 1
results = {x["question_id"]: x["text"] for x in results}
test_split = [json.loads(line) for line in open(args.annotation_file)]
split_ids = set([x["question_id"] for x in test_split])
print(f"total results: {len(results)}, total split: {len(test_split)}, error_line: {error_line}")
all_answers = []
answer_processor = EvalAIAnswerProcessor()
for x in test_split:
# import pdb; pdb.set_trace()
assert x["question_id"] in results, print(x)
all_answers.append({"image": x["image"], "answer": answer_processor(results[x["question_id"]])})
with open(args.result_upload_file, "w") as f:
json.dump(all_answers, f)
@@ -0,0 +1,50 @@
import os
import argparse
import json
from llava.eval.m4c_evaluator import EvalAIAnswerProcessor
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--dir", type=str, default="./playground/data/eval/vqav2")
parser.add_argument("--ckpt", type=str, required=True)
parser.add_argument("--split", type=str, required=True)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
src = os.path.join(args.dir, "answers", args.split, args.ckpt, "merge.jsonl")
test_split = os.path.join(args.dir, "llava_vqav2_mscoco_test2015.jsonl")
dst = os.path.join(args.dir, "answers_upload", args.split, f"{args.ckpt}.json")
os.makedirs(os.path.dirname(dst), exist_ok=True)
results = []
error_line = 0
for line_idx, line in enumerate(open(src)):
try:
results.append(json.loads(line))
except:
error_line += 1
results = {x["question_id"]: x["text"] for x in results}
test_split = [json.loads(line) for line in open(test_split)]
split_ids = set([x["question_id"] for x in test_split])
print(f"total results: {len(results)}, total split: {len(test_split)}, error_line: {error_line}")
all_answers = []
answer_processor = EvalAIAnswerProcessor()
for x in test_split:
if x["question_id"] not in results:
all_answers.append({"question_id": x["question_id"], "answer": ""})
else:
all_answers.append({"question_id": x["question_id"], "answer": answer_processor(results[x["question_id"]])})
with open(dst, "w") as f:
json.dump(all_answers, open(dst, "w"))
+124
View File
@@ -0,0 +1,124 @@
import json
import os
from PIL import Image
from tqdm import tqdm
import matplotlib.pyplot as plt
import numpy as np
def load_data(json_path):
with open(json_path, "r") as f:
return json.load(f)
def filter_data(data):
# filtered_data = [item for item in data if "image" in item and "text" in item["image"]]
filtered_data = [item for item in data if "image" in item]
return filtered_data
from multiprocessing import Pool
import functools
def calculate_image_dimension(item, images_folder):
image_path = os.path.join(images_folder, item["image"])
try:
with Image.open(image_path) as img:
width, height = img.size
return width, height
except Exception as e:
print(f"Error opening {image_path}: {e}")
return None, None
def calculate_image_dimensions_multiprocess(filtered_data, images_folder, num_processes=256):
with Pool(num_processes) as p:
dimensions = list(tqdm(p.imap(functools.partial(calculate_image_dimension, images_folder=images_folder), filtered_data), total=len(filtered_data), desc="Calculating image dimensions"))
widths, heights = zip(*[dim for dim in dimensions if dim[0] is not None])
return list(widths), list(heights)
def tokenize(text):
return text.split()
def calculate_tokenized_lengths(data):
lengths = []
for item in tqdm(data, desc="Tokenizing conversations"):
for conversation in item["conversations"]:
tokenized_value = tokenize(conversation["value"])
lengths.append(len(tokenized_value))
return lengths
import argparse
def main():
parser = argparse.ArgumentParser(description="Process data for LLaVA_Next project.")
parser.add_argument("--json_path", type=str, help="Path to the JSON file containing data.")
parser.add_argument("--images_folder", type=str, default="/mnt/bn/vl-research/data/llava_data", help="Path to the folder containing images.")
args = parser.parse_args()
llava_instruct_name = args.json_path.split("/")[-1].replace(".json", "")
json_path = args.json_path
llava_instruct_name = os.path.basename(json_path).replace(".json", "")
images_folder = args.images_folder
data = load_data(json_path)
filtered_data = filter_data(data)
if len(filtered_data) != 0:
print(f"Total data items: {len(data)}, Filtered data items: {len(filtered_data)}")
widths, heights = calculate_image_dimensions_multiprocess(filtered_data, images_folder)
max_width = max(widths)
max_height = max(heights)
print(f"Max width: {max_width}, Max height: {max_height}")
tokenized_lengths = calculate_tokenized_lengths(data)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 12))
if len(filtered_data) != 0:
# Plot 2D histogram
if min(widths) == max(widths):
widths_bins = [min(widths), max(widths) + 1]
else:
widths_bins = np.arange(min(widths), max(widths) + 100, 100)
if min(heights) == max(heights):
heights_bins = [min(heights), max(heights) + 1]
else:
heights_bins = np.arange(min(heights), max(heights) + 100, 100)
h, xedges, yedges, image = ax1.hist2d(widths, heights, bins=[widths_bins, heights_bins], cmap=plt.cm.jet, density=True)
fig.colorbar(image, ax=ax1)
ax1.set_xlabel("Width")
ax1.set_ylabel("Height")
ax1.set_title(f"dist_{llava_instruct_name}_2d_w_h\nMax width: {max(widths)}, Max height: {max(heights)}", fontsize=10)
# Plot histogram
hist, bin_edges = np.histogram(tokenized_lengths, bins=np.arange(0, max(tokenized_lengths) + 10, 100))
bins = np.arange(0, max(tokenized_lengths) + 10, 100)
ax2.bar(bin_edges[:-1], hist, width=7, edgecolor="black", log=True)
# Display every nth label on the x-axis
n = 8 # Adjust this value to control the number of labels displayed
ticks = bins[::n]
tick_labels = [int(tick) for tick in ticks]
ax2.set_xticks(ticks)
ax2.set_xticklabels(tick_labels, rotation=90, fontsize=8)
ax2.set_xlim(min(bin_edges), max(bin_edges))
ax2.set_xlabel("Tokenized Length")
ax2.set_ylabel("Count (log scale)")
ax2.set_title(f"dist_{llava_instruct_name}_tokenized_length", fontsize=8)
plt.tight_layout()
plt.savefig(f"/mnt/bn/vl-research/workspace/boli01/projects/LLaVA_Next/notebooks/sft_data/dist_{llava_instruct_name}_combined.png")
print(f"Plots saved to /mnt/bn/vl-research/workspace/boli01/projects/LLaVA_Next/notebooks/sft_data/dist_{llava_instruct_name}_combined.png")
if __name__ == "__main__":
main()
+67
View File
@@ -0,0 +1,67 @@
import json
import re
json_path = "/mnt/bn/vl-research/workspace/boli01/projects/sft_data_workspace/vlfeedback_80k.jsonl"
with open(json_path, "r") as f:
data = f.readlines()
data = [json.loads(d) for d in data]
def convert_format(original_data, dimension="Visual Faithfulness"):
converted_data = []
for item in original_data:
# Assuming the best response is the one with the highest helpfulness rating
best_completion = max(item["completions"], key=lambda x: int(x["annotations"]["Helpfulness"]["Rating"]))
best_response = best_completion["response"]
best_model = best_completion["model"]
if "†source" in best_response:
print(best_response)
# Regex pattern to match the pattern 【digit†source】
pattern = r"【\d+†source】"
# Replace the matched patterns with an empty string
cleaned_text = re.sub(pattern, "", best_response)
best_response = cleaned_text
print(f"*****************************************")
print(best_response)
# Assuming the worst response is the one with the lowest helpfulness rating
worst_completion = min(item["completions"], key=lambda x: int(x["annotations"]["Helpfulness"]["Rating"]))
worst_response = worst_completion["response"]
if "†source" in worst_response:
print(worst_response)
# Regex pattern to match the pattern ��digit†source】
pattern = r"【\d+†source】"
# Replace the matched patterns with an empty string
cleaned_text = re.sub(pattern, "", worst_response)
worst_response = cleaned_text
print(f"*****************************************")
print(worst_response)
# Extract scores
best_score = int(best_completion["annotations"][dimension]["Rating"])
worst_score = int(worst_completion["annotations"][dimension]["Rating"])
# Construct the new format
new_item = {
"id": item["id"],
"prompt": item["prompt"],
"answer": "",
"image": f"silkie_dpo/{item['id']}.jpg", # Assuming the video ID is the last part of the original ID
"chosen": best_response,
"rejected": worst_response,
"chosen_score": best_score,
"rejected_score": worst_score,
}
converted_data.append(new_item)
return converted_data
for dimension in ["Visual Faithfulness", "Helpfulness", "Ethical Considerations"]:
converted_data = convert_format(data, dimension=dimension)
with open(f"/mnt/bn/vl-research/data/llava_instruct/dpo_data/silkie_dpo_data_{dimension.replace(' ', '_').lower()}_{len(converted_data)}.json", "w") as f:
json.dump(converted_data, f, indent=4)
+30
View File
@@ -0,0 +1,30 @@
python3 -m pip install --upgrade pip;
export http_proxy=http://sys-proxy-rd-relay.byted.org:8118;
export https_proxy=http://sys-proxy-rd-relay.byted.org:8118;
export HF_HOME=/mnt/bn/vl-research-boli01-cn/.cache/huggingface;
export HF_TOKEN="";
export HF_HUB_ENABLE_HF_TRANSFER="1";
cd /mnt/bn/vl-research-boli01-cn/projects/zzz/lmms-eval;
pip install -e .;
cd /mnt/bn/vl-research-boli01-cn/projects/zzz/LLaVA_Next;
pip install -e .;
python3 -m pip install ninja;
python3 -m pip install flash-attn --no-build-isolation;
bash /mnt/bn/vl-research-boli01-cn/projects/zzz/LLaVA_Next/cn_scripts/vicuna/internal0.6m_finetune_llava1.6mix_7b_v0.2_unfreeze.sh
accelerate launch --num_processes 8 --main_process_port 12345 -m lmms_eval \
--model llava \
--model_args pretrained="/mnt/bn/vl-research-boli01-cn/projects/zzz/LLaVA_Next/internal_project_checkpoints/llavanext-lmsys_vicuna-7b-v1.5-clip-vit-large-patch14-336-mlp2x_gelu-pretrain_internal0.6m_vicuna_v1_finetune_llava1.6_datamix_unfreezeVIS_1e" \
--tasks ok_vqa,textcaps_val,mme_test,mmmu,cmmmu,coco2017_cap_val,vizwiz_vqa_val,ai2d,chartqa,pope \
--batch_size 1 \
--log_samples \
--log_samples_suffix debug \
--output_path ./logs/ \
--wandb_args 'project=llava-next-lmms-eval,job_type=eval';
+95
View File
@@ -0,0 +1,95 @@
#!/bin/bash
cd /mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install -U transformers
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Get the latest version of deepspeed from PyPI
latest_version=$(yolk -V deepspeed | cut -d ' ' -f 2)
# Check if the installed version is not the latest
# pip install deepspeed==0.12.2
if [ "$installed_version" != "$latest_version" ]; then
pip install deepspeed==0.12.2
fi
# Install flash-attn if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## VICUNA ##################
PROMPT_VERSION=v1
MODEL_VERSION="vicuna-7b-v1-5"
################## VICUNA ##################
################## project ##################
PROJECT_NAME="ds_llava-vicuna-7b-v1-5-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME="mixtral_instruct_158K_V1"
# wandb configure
export WANDB_API_KEY="03fc62d68025c9498cf6493432551badd7d4f953"
wandb login $WANDB_API_KEY
export WANDB_NAME=$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME
export WANDB_PROJECT=LLaVA_Mixtral
export WANDB_MODE=online
# wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data/coco/train2017 \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/$PROJECT_NAME/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava--$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME--finetune \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
+99
View File
@@ -0,0 +1,99 @@
#!/bin/bash
dataset_name=$1
# Uncomment and set the following variables correspondingly to run this script:
cd /mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install -U transformers
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Get the latest version of deepspeed from PyPI
latest_version=$(yolk -V deepspeed | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install deepspeed==0.12.2
fi
# Install yolk3k if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## VICUNA ##################
PROMPT_VERSION=v1
MODEL_VERSION="vicuna-7b-v1-5"
################## VICUNA ##################
################## project ##################
PROJECT_NAME="ds_llava-vicuna-7b-v1-5-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME=$dataset_name
# wandb configure
export WANDB_API_KEY="03fc62d68025c9498cf6493432551badd7d4f953"
wandb login $WANDB_API_KEY
export WANDB_NAME=$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME
export WANDB_PROJECT=LLaVA_Mixtral
export WANDB_MODE=online
wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/$PROJECT_NAME/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava--$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME--finetune \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
@@ -0,0 +1,46 @@
#!/bin/bash
# Uncomment and set the following variables correspondingly to run this script:
################## VICUNA ##################
# PROMPT_VERSION=v1
# MODEL_VERSION="vicuna-v1-3-7b"
################## VICUNA ##################
################## LLaMA-2 ##################
# PROMPT_VERSION="llava_llama_2"
# MODEL_VERSION="llama-2-7b-chat"
################## LLaMA-2 ##################
deepspeed llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/llava_instruct_158k.json \
--image_folder /path/to/coco/train2017 \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/llava-$MODEL_VERSION-pretrain/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava-$MODEL_VERSION-finetune \
--num_train_epochs 3 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# Uncomment and set the following variables correspondingly to run this script:
################## VICUNA ##################
# PROMPT_VERSION=v1
# MODEL_VERSION="vicuna-v1-3-7b"
################## VICUNA ##################
################## LLaMA-2 ##################
# PROMPT_VERSION="llava_llama_2"
# MODEL_VERSION="llama-2-7b-chat"
################## LLaMA-2 ##################
deepspeed llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--lora_enable True \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/llava_instruct_80k.json \
--image_folder /path/to/coco/train2017 \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/llava-$MODEL_VERSION-pretrain/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava-$MODEL_VERSION-finetune_lora \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--lazy_preprocess True \
--dataloader_num_workers 16 \
--report_to wandb
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
cd /mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install -U transformers
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Get the latest version of deepspeed from PyPI
latest_version=$(yolk -V deepspeed | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install deepspeed==0.12.2
fi
# Install yolk3k if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## MISTRAL ##################
PROMPT_VERSION=mistral_instruct
MODEL_VERSION="Mistral-7B-Instruct-v0.2"
################## VICUNA ##################
################## project ##################
PROJECT_NAME="ds_llava-Mistral-7B-Instruct-v0.2-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME="mixtral_instruct_158K_V1"
# wandb configure
export WANDB_API_KEY="03fc62d68025c9498cf6493432551badd7d4f953"
wandb login $WANDB_API_KEY
export WANDB_NAME=$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME
export WANDB_PROJECT=LLaVA_Mixtral
export WANDB_MODE=online
wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data/coco/train2017 \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/$PROJECT_NAME/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava--$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME--finetune \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
dataset_name=$1
cd /mnt/bn/vl-research/workspace/yhzhang/LLaVA
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install -U transformers
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Get the latest version of deepspeed from PyPI
# latest_version=$(yolk -V deepspeed | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "0.12.2" ]; then
pip install deepspeed==0.12.2
fi
# Install yolk3k if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## MISTRAL ##################
PROMPT_VERSION=mistral_instruct
MODEL_VERSION="Mistral-7B-Instruct-v0.2"
################## MISTRAL ##################
################## project ##################
PROJECT_NAME="ds_llava-Mistral-7B-Instruct-v0.2-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME=$dataset_name
# wandb configure
export WANDB_API_KEY="03fc62d68025c9498cf6493432551badd7d4f953"
wandb login $WANDB_API_KEY
export WANDB_NAME=$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME
export WANDB_PROJECT=LLaVA_Mixtral
export WANDB_MODE=online
wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/$PROJECT_NAME/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava--$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME--finetune \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True
# --report_to wandb
@@ -0,0 +1,100 @@
#!/bin/bash
dataset_name=$1
cd /mnt/bn/vl-research/workspace/boli01/projects/LLaVA_Next
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
pip install pydantic
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "4.36.2" ]; then
pip install transformers==4.36.2
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "0.12.2" ]; then
pip install deepspeed==0.12.2
fi
# Install flash-atten if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## MISTRAL ##################
PROMPT_VERSION=mistral_instruct
MODEL_VERSION="Mistral-7B-Instruct-v0.2"
################## MISTRAL ##################
################## project ##################
PROJECT_NAME="ds_llava-Mistral-7B-Instruct-v0.2-clip_large_336px-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME=$dataset_name
# wandb configure
export WANDB_API_KEY=e464cc107357c7b38e87f239bc3eb2ce5fb73c7c
export WANDB_PROJECT=llava
export WANDB_NAME=$PROJECT_NAME--$DATA_NAME--336px--anyres--sft
export WANDB_MODE=online
wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero3.json \
--model_name_or_path /mnt/bn/vl-research/workspace/project/2023/LLaVA/checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data \
--vision_tower openai/clip-vit-large-patch14-336 \
--pretrain_mm_mlp_adapter /mnt/bn/vl-research/workspace/project/2023/LLaVA/checkpoints/ds_llava-Mistral-7B-Instruct-v0.2-clip_large_336px-mlp2x_gelu-pretrain_blip558k_plain/mm_projector.bin \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--unfreeze_mm_vision_tower True \
--mm_vision_tower_lr 2e-6 \
--image_aspect_ratio anyres \
--image_grid_pinpoints "[(336, 672), (672, 336), (672, 672), (1008, 336), (336, 1008)]" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--output_dir ./checkpoints/$PROJECT_NAME--$DATA_NAME--336px--anyres--sft \
--num_train_epochs 9 \
--per_device_train_batch_size 8 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "epoch" \
--save_steps 1500 \
--learning_rate 5e-6 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 4096 \
--gradient_checkpointing True \
--dataloader_num_workers 8 \
--lazy_preprocess True \
--report_to wandb
@@ -0,0 +1,97 @@
#!/bin/bash
dataset_name=$1
cd /mnt/bn/vl-research/workspace/yhzhang/LLaVA
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
pip install pydantic
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "4.36.2" ]; then
pip install transformers==4.36.2
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "0.12.2" ]; then
pip install deepspeed==0.12.2
fi
# Install flash-atten if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## MISTRAL ##################
PROMPT_VERSION=mistral_instruct
MODEL_VERSION="Mistral-7B-Instruct-v0.2"
################## MISTRAL ##################
################## project ##################
PROJECT_NAME="ds_llava-Mistral-7B-Instruct-v0.2-clip_large_336px-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME=$dataset_name
# wandb configure
export WANDB_API_KEY=e464cc107357c7b38e87f239bc3eb2ce5fb73c7c
export WANDB_PROJECT=llava
export WANDB_NAME=$PROJECT_NAME--$DATA_NAME--336px--unfreeze--anyres--sft
export WANDB_MODE=online
wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero3.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data \
--vision_tower openai/clip-vit-large-patch14-336 \
--pretrain_mm_mlp_adapter /mnt/bn/vl-research/workspace/project/2023/LLaVA/checkpoints/ds_llava-Mistral-7B-Instruct-v0.2-clip_large_336px-mlp2x_gelu-pretrain_blip558k_plain/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--image_aspect_ratio anyres \
--image_grid_pinpoints "[(336, 672), (672, 336), (672, 672), (1008, 336), (336, 1008)]" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--output_dir ./checkpoints/$PROJECT_NAME--$DATA_NAME--336px--anyres--unfreeze--sft \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
@@ -0,0 +1,78 @@
#!/bin/bash
# set up wandb
export WANDB_API_KEY=a651c244635bc6f913ab654af3f0eebaecdc9381
export WANDB_ENTITY=llava-vl
export WANDB_PROJECT=llava-next
export PYTHONWARNINGS="ignore"
cd /mnt/bn/vl-research/workspace/boli01/projects/lmms-eval
pip install -e .
# set up llava dev env
cd /mnt/bn/vl-research/workspace/boli01/projects/LLaVA_Next
################## MISTRAL ##################
PROMPT_VERSION=mistral_instruct
MODEL_VERSION="Mistral-7B-Instruct-v0.2"
################## MISTRAL ##################
################## project ##################
PROJECT_NAME="ds_llava-Mistral-7B-Instruct-v0.2-clip_large_336px-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME='llava_caps20k_chartqa19k'
export WANDB_NAME=$PROJECT_NAME--$DATA_NAME--336px--anyres--sft
export WANDB_MODE=online
wandb online
CUDA_VISIBLE_DEVICES="0,1,2,3,4,5,6,7" deepspeed --master_port 26000 --include localhost:0,1,2,3,4,5,6,7 llava/train/train_mem.py \
--deepspeed ./scripts/zero3_offload.json \
--model_name_or_path mistralai/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/llava_instruct/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/data/llava \
--vision_tower openai/clip-vit-large-patch14-336 \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--unfreeze_mm_vision_tower True \
--mm_vision_tower_lr 2e-6 \
--image_aspect_ratio anyres \
--image_grid_pinpoints "[(336, 672), (672, 336), (672, 672), (1008, 336), (336, 1008)]" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--output_dir ./checkpoints/$PROJECT_NAME--llava1.6--336px--anyres--sft \
--num_train_epochs 1 \
--per_device_train_batch_size 8 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 1500 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 4096 \
--gradient_checkpointing True \
--dataloader_num_workers 32 \
--lazy_preprocess True \
--report_to wandb \
--run_name $WANDB_NAME
# starting here is the args for evaluation
--eval_num_processes 4 \
--task_names mme,docvqa_val \
--model_args pretrained=./checkpoints/$PROJECT_NAME--$DATA_NAME--336px--anyres--sft \
--limit 8 \
--batch_size 1 \
--log_samples \
--log_samples_suffix debug \
--output_path ./logs/
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
cd /mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA
# Install yolk3k if not installed
if ! pip show yolk3k > /dev/null 2>&1; then
pip install yolk3k
fi
# Get the installed version of transformers
installed_version=$(pip show transformers | grep Version | cut -d ' ' -f 2)
# Get the latest version of transformers from PyPI
latest_version=$(yolk -V transformers | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install -U transformers
fi
# Get the installed version of deepspeed
installed_version=$(pip show deepspeed | grep Version | cut -d ' ' -f 2)
# Get the latest version of deepspeed from PyPI
latest_version=$(yolk -V deepspeed | cut -d ' ' -f 2)
# Check if the installed version is not the latest
if [ "$installed_version" != "$latest_version" ]; then
pip install deepspeed==0.12.2
fi
# Install yolk3k if not installed
if ! pip show flash-attn > /dev/null 2>&1; then
pip install flash-attn --no-build-isolation
fi
################## MISTRAL ##################
PROMPT_VERSION=mistral_instruct
MODEL_VERSION="Mistral-7B-Instruct-v0.2"
################## VICUNA ##################
################## project ##################
PROJECT_NAME="ds_llava-Mistral-7B-Instruct-v0.2-mlp2x_gelu-pretrain_blip558k_plain"
################## data ##################
DATA_NAME="llava_instruct_150k"
# wandb configure
export WANDB_API_KEY="03fc62d68025c9498cf6493432551badd7d4f953"
wandb login $WANDB_API_KEY
export WANDB_NAME=$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME
export WANDB_PROJECT=LLaVA_Mixtral
export WANDB_MODE=online
wandb online
deepspeed --master_port 26000 \
llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/$DATA_NAME.json \
--image_folder /mnt/bn/vl-research/workspace/boli01/data/playground/data/coco/train2017 \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/$PROJECT_NAME/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava--$PROJECT_NAME--$MODEL_VERSION--$DATA_NAME--finetune \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# Uncomment and set the following variables correspondingly to run this script:
################## VICUNA ##################
# PROMPT_VERSION=v1
# MODEL_VERSION="vicuna-v1-3-7b"
################## VICUNA ##################
################## LLaMA-2 ##################
# PROMPT_VERSION="llava_llama_2"
# MODEL_VERSION="llama-2-7b-chat"
################## LLaMA-2 ##################
deepspeed llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--lora_enable True \
--bits 4 \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path ./playground/data/llava_instruct_80k.json \
--image_folder /path/to/coco/train2017 \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/llava-$MODEL_VERSION-pretrain/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava-$MODEL_VERSION-finetune_lora \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--lazy_preprocess True \
--dataloader_num_workers 16 \
--report_to wandb
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
deepspeed llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path lmsys/vicuna-13b-v1.3 \
--version $PROMPT_VERSION \
--data_path /Data/ScienceQA/data/scienceqa/llava_train_QCM-LEA.json \
--image_folder /Data/ScienceQA/data/scienceqa/images/train \
--vision_tower openai/clip-vit-large-patch14 \
--pretrain_mm_mlp_adapter ./checkpoints/huggingface/liuhaotian/llava-pretrain-vicuna-13b-v1.3/mm_projector.bin \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava-vicuna-13b-v1.3-pretrain_lcs558k_plain-ScienceQA_QCM_LEA-12e \
--num_train_epochs 12 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 50000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
+22
View File
@@ -0,0 +1,22 @@
import argparse
from llava.model.builder import load_pretrained_model
from llava.mm_utils import get_model_name_from_path
def merge_lora(args):
model_name = get_model_name_from_path(args.model_path)
tokenizer, model, image_processor, context_len = load_pretrained_model(args.model_path, args.model_base, model_name, device_map="cpu")
model.save_pretrained(args.save_model_path)
tokenizer.save_pretrained(args.save_model_path)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model-path", type=str, required=True)
parser.add_argument("--model-base", type=str, required=True)
parser.add_argument("--save-model-path", type=str, required=True)
args = parser.parse_args()
merge_lora(args)
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
# Uncomment and set the following variables correspondingly to run this script:
# MODEL_VERSION=vicuna-v1-3-7b
# MODEL_VERSION=llama-2-7b-chat
########### DO NOT CHANGE ###########
########### USE THIS FOR BOTH ###########
PROMPT_VERSION=plain
########### DO NOT CHANGE ###########
deepspeed llava/train/train_mem.py \
--deepspeed ./scripts/zero2.json \
--model_name_or_path ./checkpoints/$MODEL_VERSION \
--version $PROMPT_VERSION \
--data_path /path/to/pretrain_data.json \
--image_folder /path/to/images \
--vision_tower openai/clip-vit-large-patch14 \
--tune_mm_mlp_adapter True \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir ./checkpoints/llava-$MODEL_VERSION-pretrain \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 24000 \
--learning_rate 2e-3 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 2048 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb
+57
View File
@@ -0,0 +1,57 @@
import json
import os
import argparse
from tqdm import tqdm
import yaml
def check_missing_images(json_path, images_folder):
data = json.load(open(json_path, "r"))
missing_data = []
for i, d in enumerate(tqdm(data)):
image = d["image"] if "image" in d else ""
if image != "":
path = os.path.join(images_folder, image)
if not os.path.exists(path):
print(f"Missing image: {path}")
missing_data.append(d)
return missing_data
def read_yaml_to_llava_data(yaml_path, images_folder):
print(f"Reading YAML file: {yaml_path}")
with open(yaml_path, "r") as f:
data = yaml.safe_load(f)
llava_json_paths = data["datasets"]
for item in llava_json_paths:
json_path = item["json_path"]
missing_data = check_missing_images(json_path, images_folder)
if len(missing_data) > 0:
print(f"Missing images in {json_path}:")
for d in missing_data:
print(d)
def direct_check_llava_data(json_path, images_folder):
missing_data = check_missing_images(json_path, images_folder)
if len(missing_data) > 0:
print(f"Missing images in {json_path}:")
for d in missing_data:
print(d)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Check for missing images in dataset.")
parser.add_argument("--yaml_path", type=str, default="", help="Path to the YAML file containing the dataset.")
parser.add_argument("--json_path", type=str, default="", help="Path to the JSON file containing the dataset.")
parser.add_argument("--images_folder", type=str, default="/mnt/bn/vl-research/data/llava_data", help="Path to the folder containing the images.")
args = parser.parse_args()
if args.json_path != "":
direct_check_llava_data(args.json_path, args.images_folder)
elif args.yaml_path != "":
read_yaml_to_llava_data(args.yaml_path, args.images_folder)
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
CHUNKS=8
for IDX in {0..7}; do
CUDA_VISIBLE_DEVICES=$IDX python -m llava.eval.model_vqa_science \
--model-path liuhaotian/llava-lcs558k-scienceqa-vicuna-13b-v1.3 \
--question-file ~/haotian/datasets/ScienceQA/data/scienceqa/llava_test_QCM-LEA.json \
--image-folder ~/haotian/datasets/ScienceQA/data/scienceqa/images/test \
--answers-file ./test_llava-13b-chunk$CHUNKS_$IDX.jsonl \
--num-chunks $CHUNKS \
--chunk-idx $IDX \
--conv-mode llava_v1 &
done
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
CHUNKS=8
output_file="test_llava-13b.jsonl"
# Clear out the output file if it exists.
> "$output_file"
# Loop through the indices and concatenate each file.
for idx in $(seq 0 $((CHUNKS-1))); do
cat "./test_llava-13b-chunk${idx}.jsonl" >> "$output_file"
done
python llava/eval/eval_science_qa.py \
--base-dir ~/haotian/datasets/ScienceQA/data/scienceqa \
--result-file ./test_llava-13b.jsonl \
--output-file ./test_llava-13b_output.json \
--output-result ./test_llava-13b_result.json
+5
View File
@@ -0,0 +1,5 @@
# evaluate
./scripts/interleave/eval_interleave_3d.sh /path/to/ckpt /path/to/images multi_image_in_domain
./scripts/interleave/eval_interleave_3d.sh /path/to/ckpt /path/to/images multi_image_out_domain
./scripts/interleave/eval_interleave_3d.sh /path/to/ckpt /path/to/images multi_view_in_domain
+28
View File
@@ -0,0 +1,28 @@
alias python=python3
CKPT_PATH=$1
NAME=$(echo "$CKPT_PATH" | awk -F'/' '{print $NF}')
echo $NAME
##### set images path
DATA_PATH=$2
EVAL_TYPE=$3
JSON_PATH=$2/$3.json
############################### eval multi-image
RESULT_NAME="logs/${NAME}/${EVAL_TYPE}"
echo $RESULT_NAME
mkdir -p logs/${NAME}
file_path=${RESULT_NAME}/result.jsonl
bash scripts/interleave/eval_multiprocess.sh \
${CKPT_PATH} \
${JSON_PATH} \
${RESULT_NAME} \
${DATA_PATH} \
"" \
8 0
python3 llava/eval/evaluate_interleave.py --result-dir ${RESULT_NAME}
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# Check if three arguments are passed
if [ "$#" -ne 7 ]; then
echo "Usage: $0 <model_path> <question_path> <base_answer_path> <image_folder> <extra_prompt> <N> <temperature>"
exit 1
fi
# Assign the command line arguments to variables
model_path=$1
question_path=$2
base_answer_path=$3
image_folder=$4
extra_prompt=$5
N=$6
temperature=$7
# Loop over each chunk/process
for (( chunk_id=0; chunk_id<N; chunk_id++ ))
do
# Define the answer path for each chunk
answer_path="${base_answer_path}/result_${chunk_id}.jsonl"
if [ -f "$answer_path" ]; then
rm "$answer_path"
fi
# Run the Python program in the background
CUDA_VISIBLE_DEVICES="$chunk_id" python3 llava/eval/model_vqa.py --model-path "$model_path" --question-file "$question_path" --answers-file "$answer_path" --num-chunks "$N" --chunk-idx "$chunk_id" --image-folder "$image_folder" --extra-prompt "$extra_prompt" --temperature "$temperature" &
# Uncomment below if you need a slight delay between starting each process
# sleep 0.1
done
# Wait for all background processes to finish
wait
merged_file="${base_answer_path}/result.jsonl"
if [ -f "$merged_file" ]; then
rm "$merged_file"
fi
# Merge all the JSONL files into one
#cat "${base_answer_path}"_*.jsonl > "${base_answer_path}.jsonl"
for ((i=0; i<N; i++)); do
input_file="${base_answer_path}/result_${i}.jsonl"
cat "$input_file" >> "${base_answer_path}/result.jsonl"
done
# remove the unmerged files
for (( chunk_id=0; chunk_id<N; chunk_id++ ))
do
# Define the answer path for each chunk
answer_path="${base_answer_path}/result_${chunk_id}.jsonl"
if [ -f "$answer_path" ]; then
rm "$answer_path"
fi
done
+19
View File
@@ -0,0 +1,19 @@
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen1.5-MoE-A2.7B-Chat", torch_dtype=torch.bfloat16, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen1.5-MoE-A2.7B-Chat")
prompt = "Give me a short introduction to large language model."
messages = [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512)
generated_ids = [output_ids[len(input_ids) :] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
+81
View File
@@ -0,0 +1,81 @@
import json
import os
from tqdm import tqdm
with open("/mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA/playground/data/llava_v1_5_mix665k.json") as f:
llava_v1_5_mix665k = json.load(f) # 665298
with open("/mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA/playground/data/llava_instruct_150k.json") as f:
llava_instruct_150k = json.load(f) # 157712
# Create sets of "id" fields
mix665k_ids = set()
for item in llava_v1_5_mix665k:
all_conv = ""
for cur_conversation in item["conversations"]:
all_conv += cur_conversation["value"]
mix665k_ids.add(f'{item["id"]}_{all_conv}')
instruct_150k_ids = set()
for item in llava_instruct_150k:
all_conv = ""
for cur_conversation in item["conversations"]:
all_conv += cur_conversation["value"]
instruct_150k_ids.add(f'{item["id"]}_{all_conv}')
share_gpt_ids = set()
for item in llava_v1_5_mix665k:
if "image" not in item:
all_conv = ""
for cur_conversation in item["conversations"]:
all_conv += cur_conversation["value"]
share_gpt_ids.add(f'{item["id"]}_{all_conv}') # 40688
# Get "id" fields that are in mix665k but not in instruct_150k and share_gpt
new_ids = mix665k_ids - instruct_150k_ids - share_gpt_ids # 466898
# Get "id" fields that are in mix665k but not in share_gpt
# new_ids = mix665k_ids - share_gpt_ids #624610
# import pdb; pdb.set_trace()
# Filter mix665k data based on new_ids
new_data = []
for item in llava_v1_5_mix665k:
all_conv = ""
for cur_conversation in item["conversations"]:
all_conv += cur_conversation["value"]
if f'{item["id"]}_{all_conv}' in new_ids:
new_data.append(item)
import pdb
pdb.set_trace()
with open("/mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA/playground/data/mixtral_instruct_135K_of_158K_V1.5.json") as f:
new_mixtral_instruct = json.load(f)
# mixtral_instruct_50K_of_80K_V1.json@
# print(len(new_data))
# for _ in new_mixtral_instruct:
# # import pdb; pdb.set_trace()
# if "coco" not in _["image"]:
# _["image"] = f"coco/train2017/{_['image']}"
# new_data.append(_)
# print(len(instruct_150k_ids))
print(len(new_data))
# for _ in tqdm(new_data):
# if "image" in _:
# if "000000442654" in _["image"]:
# all_conv = ""
# for cur_conversation in _["conversations"]:
# all_conv += cur_conversation["value"]
# # if not os.path.exists(f'/mnt/bn/vl-research/workspace/boli01/data/playground/data/{_["image"]}'):
# import pdb; pdb.set_trace()
# Write new_data to a new JSON file
with open("/mnt/bn/vl-research/workspace/boli01/zzzprojects/LLaVA/playground/data/llava_v1_5_mix665k_minus_llava_instruct_150k_minus_sharegpt_plus_mixtral_instruct_135K_of_158K_V1.5.json", "w") as f:
json.dump(new_data, f)
+94
View File
@@ -0,0 +1,94 @@
# About Training Scripts
We first release the basic training scripts for LLaVA-NeXT. It's based on previous LLaVA's training scripts and researchers familiar with LLaVA will find it easy to use.
We will gradually release the more detailed training scripts for our LLaVA OneVision models including the mid stage, single-image final stage and one-vision final stage.
> They are basically the same as the basic training scripts, but with some modifications, such as the data yaml.
- `finetune_clip.sh`: This could be seen as the first image version LLaVA-NeXT (2024-01) training script, with `anyres` strategy and maximum 2x2 image grids.
- `finetune_siglip.sh`: Same but with `siglip` encoder, each grid becomes 729 tokens.
- `finetune_onevision.sh`: This is our latest training script, with `anyres_max_9` strategy and image grids weaving from 1x1 to 6x6, at most to 2304x2304 resolution. Inside the script, we also incorporate the multi-image and video data into training loop. the detail token strategy could be found in our paper.
# About the LLaVA-OneVision Data
We need to address the fact that our data has been collected and used in different projects/people. LLaVA-OneVision is our first attempt to integrate these datasets. For the data that has already been uploaded, we will refer you to the corresponding locations. We kindly ask everyone to gather the "fragments" and piece them together into a "diamond" in your own environment.
Here we explain the some technical details on our data.
- pretrain data - BLIP558K (same as previous llava 1.5 series)
- mid stage data mixture
```yaml
datasets:
- json_path: /mnt/bn/vl-research/data/llava_instruct/blip558k_stage1.5_finetune_w_prompt.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/coco118k_stage1.5_finetune_w_prompt.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/cc3m_recap_data_prompt_v2.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_tr_sft.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/instruct_azure_dc_zh_92K.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/allava/Evol-Instruct-GPT4-Turbo-143K.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/synthdog_zh/synthdog_zh_100k.json
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/synthdog_en/synthdog_en_100k.json
sampling_strategy: all
```
The first three datasets can be collected via the [LLaVA-Recap](https://huggingface.co/collections/lmms-lab/llava-next-6623288e2d61edba3ddbf5ff) series data. We did a slightly modification to make the data more compatible to other data with an added prompt behind `<image>` at each question. You may download our dataset and process it in local environment. Each data we added the **same prompt** "\nPlease generate detailed descriptions of the given image.". Here's an example:
```json
{
"id": "000000000009",
"image": "coco/train2017/000000000009.jpg",
"conversations": [
{
"from": "human",
"value": "<image>\nPlease generate detailed descriptions of the given image."
},
{
"from": "gpt",
"value": "The image shows a meal served in a blue tray with compartments. In the top left compartment, there is a slice of bread with a spread that appears to be butter, accompanied by a few almonds and a slice of what looks like a baked potato or sweet potato. The top right compartment contains a variety of fruits, including what seems to be pineapple, orange slices, and possibly a piece of melon.\n\nIn the bottom left compartment, there is a piece of bread with a spread that could be butter or margarine, and a small portion of what might be a meatball or a similar type of meat covered in a sauce. The bottom right compartment contains a serving of broccoli, which appears to be steamed or lightly cooked.\n\nThe meal is presented in a way that suggests it is a balanced meal, with a variety of food groups represented carbohydrates (bread), protein (meatball), healthy fats (almonds and butter), and fruits and vegetables (broccoli and the fruit assortment). The image is a close-up photograph with a focus on the food, and the colors are vibrant, indicating freshness."
}
]
}
```
The rest files are being uploaded to [LLaVA-OneVision Mid-Stage Data](https://huggingface.co/datasets/lmms-lab/LLaVA-OneVision-Mid-Data), except from `instruct_azure_dc_zh_92K` since it's internal data due and have policy issue (sad but I could preview one example). The `instruct_azure_dc_zh_92K` images are from COCO and QAs are generated by GPT-4V service provided by AzureAI. We uses this data in early stage experiments wishing to add Chinese knowledge to our model, and just kept using it (yes, just legacy, no other specific reason).
```json
{
"id": "000000051920",
"image": "azure_dc_zh_92K/000000051920.jpg",
"conversations": [
{
"from": "human",
"value": "<image>\n这幅画中的关键信息有哪些?"
},
{
"from": "gpt",
"value": "这张图片展示了一位穿着深色(可能是黑色或深蓝色)毛衣的人坐在一张桌子前,正在用右手拿着一片披萨。披萨看起来有多种配料,包括绿色的菠菜和橙红色的番茄,放在一个银色的圆形披萨盘上。披萨盘上还剩下大约六片披萨。在背景中,可以看到一个穿着浅色衣服的人站在柜台后面,柜台上方有一个黑板菜单,上面用白色粉笔写着菜单项,但是字迹不清晰,无法阅读。整个场景看起来像是在一个披萨店内部,环境显得比较休闲。"
}
],
"data_source": "azure_dc_zh_92K"
}
```
- single-image stage data mixture
We have placed our single-image stage data in [single-image-yaml](https://github.com/LLaVA-VL/LLaVA-NeXT/blob/main/scripts/train/single_image.yaml) for users to review. You can download each subset from [onevision-data](https://huggingface.co/datasets/lmms-lab/LLaVA-OneVision-Data).
Inside the data yaml, the first indicates the previous llava-1.6/next 790K data, you can download them in [llava-next-data](https://huggingface.co/datasets/lmms-lab/LLaVA-NeXT-Data).
Inside the yaml, the naming would be different with our paper figure due to writing consideration. For users who need to explore our dataset, you can check the [upload script](https://github.com/LLaVA-VL/LLaVA-NeXT/blob/0070d0ae4931c9b19d9cc57c38e16a87c270a61c/playground/upload_data.py#L175) to find the mapping from our local dataset to HF's version.
- onevision stage data mixture
Our onevision stage data is available in [onevision-yaml](https://github.com/LLaVA-VL/LLaVA-NeXT/blob/main/scripts/train/onevision.yaml). The single-image portion can be downloaded from the above Huggingface link for onevision data. Here's a breakdown of each part:
- Around 800K higher-quality data re-sampled from the previous stage (yes, it's data replay!).
- [M4-Instruct Data](https://huggingface.co/datasets/lmms-lab/M4-Instruct-Data)
- Video Data: We have released the video part along with [llava-video-data](https://huggingface.co/datasets/lmms-lab/LLaVA-Video-178K). Users can download the data, and we utilize the subset used in LLaVA-OneVision:
- We have included captions and open-ended questions in the 0_30_s_academic_v0_1 split, along with 240,000 open-ended QA items and 15,000 caption entries, as part of the video data in LLaVA-Hound for LLaVA-OneVision.
- 0_30_s_academic_v0_1 captions
- 0_30_s_academic_v0_1 open-ended QA
- LLaVA-Hound: Same as above.
+65
View File
@@ -0,0 +1,65 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
LLM_VERSION="Qwen/Qwen2-7B-Instruct"
LLM_VERSION_CLEAN="${LLM_VERSION//\//_}"
VISION_MODEL_VERSION="openai/clip-vit-large-patch14-336"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
PROMPT_VERSION="qwen_1_5"
BASE_RUN_NAME="llavanext-${VISION_MODEL_VERSION_CLEAN}-${LLM_VERSION_CLEAN}-mlp2x_gelu-pretrain_blip558k_plain"
echo "BASE_RUN_NAME: ${BASE_RUN_NAME}"
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" --node_rank="${RANK}" --master_addr="${ADDR}" --master_port="${PORT}" \
llava/train/train_mem.py \
--deepspeed scripts/zero3.json \
--model_name_or_path ${LLM_VERSION} \
--version ${PROMPT_VERSION} \
--data_path=llava_1_6.json \
--image_folder your_image_folder \
--pretrain_mm_mlp_adapter="/checkpoints/projectors/${BASE_RUN_NAME}/mm_projector.bin" \
--mm_tunable_parts="mm_vision_tower,mm_mlp_adapter,mm_language_model" \
--mm_vision_tower_lr=2e-6 \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--image_aspect_ratio anyres \
--image_grid_pinpoints "[(336, 672), (672, 336), (672, 672), (1008, 336), (336, 1008)]" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--run_name $MID_RUN_NAME \
--output_dir "/checkpoints/${MID_RUN_NAME}" \
--num_train_epochs 1 \
--per_device_train_batch_size 4 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 3000 \
--save_total_limit 1 \
--learning_rate 1e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 32768 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb \
--torch_compile True \
--torch_compile_backend "inductor" \
--dataloader_drop_last True \
--attn_implementation sdpa
# You can delete the sdpa attn_implementation if you want to use flash attn
@@ -0,0 +1,67 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
LLM_VERSION="Qwen/Qwen2-7B-Instruct"
LLM_VERSION_CLEAN="${LLM_VERSION//\//_}"
VISION_MODEL_VERSION="google/siglip-so400m-patch14-384"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
PROMPT_VERSION="qwen_1_5"
BASE_RUN_NAME="llavanext-${VISION_MODEL_VERSION_CLEAN}-${LLM_VERSION_CLEAN}-mlp2x_gelu-pretrain_blip558k_plain"
echo "BASE_RUN_NAME: ${BASE_RUN_NAME}"
CKPT_PATH=$LLM_VERSION # this could also be the previous stage checkpoint
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" --node_rank="${RANK}" --master_addr="${ADDR}" --master_port="${PORT}" \
llava/train/train_mem.py \
--deepspeed scripts/zero3.json \
--model_name_or_path ${CKPT_PATH} \
--version ${PROMPT_VERSION} \
--data_path=llava_1_6.json \
--image_folder your_image_folder \
--pretrain_mm_mlp_adapter="/checkpoints/projectors/${BASE_RUN_NAME}/mm_projector.bin" \
--mm_tunable_parts="mm_vision_tower,mm_mlp_adapter,mm_language_model" \
--mm_vision_tower_lr=2e-6 \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--image_aspect_ratio anyres \
--image_grid_pinpoints "[(384, 768), (768, 384), (768, 768), (1152, 384), (384, 1152)]" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--run_name $MID_RUN_NAME \
--output_dir "/checkpoints/${MID_RUN_NAME}" \
--num_train_epochs 1 \
--per_device_train_batch_size 4 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 3000 \
--save_total_limit 1 \
--learning_rate 1e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 32768 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb \
--torch_compile True \
--torch_compile_backend "inductor" \
--dataloader_drop_last True \
--attn_implementation sdpa
# You can delete the sdpa attn_implementation if you want to use flash attn
+64
View File
@@ -0,0 +1,64 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
# export NCCL_IB_HCA=${ARNOLD_RDMA_DEVICE}
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
VISION_MODEL_VERSION="openai/clip-vit-large-patch14-336"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
# Stage 2
PROMPT_VERSION="qwen_1_5"
#torchrun --nproc_per_node="${ARNOLD_WORKER_GPU}" --nnodes="${ARNOLD_WORKER_NUM}" --node_rank="${ARNOLD_ID}" --master_addr="${METIS_WORKER_0_HOST}" --master_port="${port_in_cmd}" \
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${ARNOLD_WORKER_GPU}" --nnodes="${ARNOLD_WORKER_NUM}" --node_rank="${ARNOLD_ID}" --master_addr="${METIS_WORKER_0_HOST}" --master_port="${port_in_cmd}" \
llava/train/train_dpo.py \
--deepspeed scripts/zero3.json \
--model_name_or_path lmms-lab/LongVA-7B \
--version $PROMPT_VERSION \
--dpo_alpha 1.0 --beta 0.1 --gamma 0 \
--data_path="/data/llava_video/shareVideoGPTV/dpo/sft_dpo_17k.jsonl" \
--image_folder /data/llava_data \
--video_folder /llava_video/shareVideoGPTV/frames/all_frames/ \
--mm_tunable_parts="mm_vision_tower,mm_mlp_adapter,mm_language_model" \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--mm_spatial_pool_stride 2 \
--mm_resampler_type "spatial_pool" \
--mm_spatial_pool_out_channels 1024 \
--group_by_modality_length True \
--image_aspect_ratio anyres \
--image_grid_pinpoints "[(336, 672), (672, 336), (672, 672), (1008, 336), (336, 1008)]" \
--mm_patch_merge_type unires \
--bf16 True \
--run_name $MID_RUN_NAME \
--output_dir "/checkpoints/${MID_RUN_NAME}" \
--num_train_epochs 3 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 16 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 3000 \
--save_total_limit 1 \
--learning_rate 5e-7 \
--weight_decay 0. \
--warmup_ratio 0.1 \
--lr_scheduler_type "linear" \
--logging_steps 1 \
--tf32 True \
--model_max_length 32768 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb \
--torch_compile True \
--torch_compile_backend "inductor" \
--dataloader_drop_last True \
--attn_implementation sdpa
+69
View File
@@ -0,0 +1,69 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
# export NCCL_IB_HCA=${ARNOLD_RDMA_DEVICE}
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
VISION_MODEL_VERSION="google/siglip-so400m-patch14-384"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
# DPO Stage
PROMPT_VERSION="qwen_1_5"
SFT_MODEL="lmms-lab/llava-onevision-qwen2-7b-ov"
EPOCH=1
beta=0.1
DPO_RUN_NAME="llava-onevision-qwen2-7b-ov_dpo-beta${beta}-epoch${EPOCH}"
DPO_CLEAN_NAME="${DPO_RUN_NAME##*/}"
OUTPUT_DIR="<your-output-folder>/${DPO_CLEAN_NAME}"
DATA_PATH="<your-data-path>"
echo $DPO_RUN_NAME
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" --node_rank="${RANK}" --master_addr="${ADDR}" --master_port="${PORT}" \
llava/train/train_dpo.py \
--deepspeed scripts/zero3.json \
--model_name_or_path=${SFT_MODEL} \
--dpo_alpha=1.0 \
--beta=${beta} \
--gamma=0 \
--version $PROMPT_VERSION \
--data_path=$DATA_PATH \
--image_folder "<your-image-folder>" \
--mm_tunable_parts="mm_vision_tower,mm_mlp_adapter,mm_language_model" \
--unfreeze_mm_vision_tower True \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--image_aspect_ratio anyres_max_9 \
--image_grid_pinpoints "(1x1),...,(6x6)" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--run_name $DPO_CLEAN_NAME \
--output_dir $OUTPUT_DIR \
--num_train_epochs $EPOCH \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 1 \
--gradient_accumulation_steps 8 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 1000 \
--save_total_limit 1 \
--learning_rate 5e-7 \
--weight_decay 0. \
--warmup_ratio 0.1 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 32768 \
--gradient_checkpointing True \
--dataloader_num_workers 4 \
--lazy_preprocess True \
--report_to wandb \
--dataloader_drop_last True
+74
View File
@@ -0,0 +1,74 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
VISION_MODEL_VERSION="google/siglip-so400m-patch14-384"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
BASE_RUN_NAME="llavanext-google_siglip-so400m-patch14-384-Qwen_Qwen2-7B-Instruct-mlp2x_gelu-pretrain_blip558k_plain"
echo "BASE_RUN_NAME: ${BASE_RUN_NAME}"
############### Finetune ################
MIXTURE="qwen"
# Stage 2
PROMPT_VERSION="qwen_vla"
RUN_NAME="llava-openvla-${MIXTURE}"
PREV_STAGE_CHECKPOINT="/mnt/d/temp/huggingface/hub/llava_qwen_vla"
# PREV_STAGE_CHECKPOINT="/mnt/d/ckpt/llava-openvla-qwen"
echo "PREV_STAGE_CHECKPOINT: ${PREV_STAGE_CHECKPOINT}"
echo "MID_RUN_NAME: ${RUN_NAME}"
NUM_GPUS=1
NNODES=1
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" \
llava/train/train_mem.py \
--deepspeed scripts/zero2.json \
--model_name_or_path $PREV_STAGE_CHECKPOINT \
--version $PROMPT_VERSION \
--data_path /root/code/openvla-llava/LLaVA-Next/scripts/train/vla.yaml \
--image_folder /root/code/openvla-llava/LLaVA-Next/images \
--mm_tunable_parts="mm_language_model" \
--mm_vision_tower_lr=2e-6 \
--vision_tower google/siglip-so400m-patch14-384 \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--image_aspect_ratio anyres_max_9 \
--image_grid_pinpoints "(1x1),...,(6x6)" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--run_name $RUN_NAME \
--output_dir /mnt/d/ckpt_3_28/$RUN_NAME \
--num_train_epochs 5 \
--per_device_train_batch_size 8 \
--per_device_eval_batch_size 100 \
--gradient_accumulation_steps 2 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 900 \
--save_total_limit 2 \
--learning_rate 1e-4 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 4096 \
--gradient_checkpointing True \
--dataloader_num_workers 1 \
--lazy_preprocess True \
--report_to wandb \
--torch_compile True \
--torch_compile_backend "inductor" \
--dataloader_drop_last True \
--frames_upbound 1
exit 0;
# You can delete the sdpa attn_implementation if you want to use flash attn
+73
View File
@@ -0,0 +1,73 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
LLM_VERSION="Qwen/Qwen2-7B-Instruct"
# for 7b model we recommend bs=1, accum=2, 16 nodes, 128 gpus, lr=1e-5, warmup=0.03
# for 72b model we recommend bs=1, accum=1, 32 nodes, 256 gpus, lr=1e-5, warmup=0.03
LLM_VERSION_CLEAN="${LLM_VERSION//\//_}"
VISION_MODEL_VERSION="google/siglip-so400m-patch14-384"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
BASE_RUN_NAME="llavanext-google_siglip-so400m-patch14-384-Qwen_Qwen2-7B-Instruct-mlp2x_gelu-pretrain_blip558k_plain"
echo "BASE_RUN_NAME: ${BASE_RUN_NAME}"
############### Finetune ################
# Stage 2
PROMPT_VERSION="qwen_1_5"
RUN_NAME="llava-onevision-${VISION_MODEL_VERSION_CLEAN}-${LLM_VERSION_CLEAN}-si_stage_am9"
PREV_STAGE_CHECKPOINT="/mnt/bn/vl-research/checkpoints/onevision/xxxxxxxxxxxxxxxx" # replace it with your last checkpoint training from mid stage
echo "PREV_STAGE_CHECKPOINT: ${PREV_STAGE_CHECKPOINT}"
echo "MID_RUN_NAME: ${RUN_NAME}"
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" --node_rank="${RANK}" --master_addr="${ADDR}" --master_port="${PORT}" \
llava/train/train_mem.py \
--deepspeed scripts/zero3.json \
--model_name_or_path $PREV_STAGE_CHECKPOINT \
--version $PROMPT_VERSION \
--data_path /mnt/bn/vl-research/workspace/boli01/projects/LLaVA_Next/scripts/i18n/scale_llms/next_3p2m_single_image.yaml \
--image_folder /mnt/bn/vl-research/data/llava_data \
--video_folder /mnt/bn/vl-research/data/llava_video \
--mm_tunable_parts="mm_vision_tower,mm_mlp_adapter,mm_language_model" \
--mm_vision_tower_lr=2e-6 \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_projector_type mlp2x_gelu \
--mm_vision_select_layer -2 \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--group_by_modality_length True \
--image_aspect_ratio anyres_max_9 \
--image_grid_pinpoints "(1x1),...,(6x6)" \
--mm_patch_merge_type spatial_unpad \
--bf16 True \
--run_name $RUN_NAME \
--output_dir /mnt/bn/vl-research/checkpoints/onevision/$RUN_NAME \
--num_train_epochs 1 \
--per_device_train_batch_size 1 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 2 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 1000 \
--save_total_limit 1 \
--learning_rate 1e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 32768 \
--gradient_checkpointing True \
--dataloader_num_workers 4 \
--lazy_preprocess True \
--report_to wandb \
--torch_compile True \
--torch_compile_backend "inductor" \
--dataloader_drop_last True \
--frames_upbound 32
exit 0;
+17
View File
@@ -0,0 +1,17 @@
datasets:
- json_path: /mnt/bn/vl-research/data/llava_instruct/blip558k_stage1.5_finetune_w_prompt.json # released in lmms-lab/LLaVA-ReCap-*
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/coco118k_stage1.5_finetune_w_prompt.json # released in lmms-lab/LLaVA-ReCap-*
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/cc3m_recap_data_prompt_v2.json # released in lmms-lab/LLaVA-ReCap-*
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_tr_sft.json # released in lmms-lab/LLaVA-OneVision-Mid-Data
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/instruct_azure_dc_zh_92K.json # not released, explained at https://github.com/LLaVA-VL/LLaVA-NeXT/tree/main/scripts/train
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/Evol-Instruct-GPT4-Turbo-143K.json # released in lmms-lab/LLaVA-OneVision-Mid-Data
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/synthdog_zh/synthdog_zh_100k.json # released in lmms-lab/LLaVA-OneVision-Mid-Data
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/synthdog_en/synthdog_en_100k.json # released in lmms-lab/LLaVA-OneVision-Mid-Data
sampling_strategy: all
+185
View File
@@ -0,0 +1,185 @@
datasets:
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_next_fit_mix_filtered_text_wild_738590.json
sampling_strategy: "first:50%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_wild_4v_39k.json # not released
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_wild_4v_12k.json # not released
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/mavis_math_metagen_87358.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/mavis_math_rule_geo_100000.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/cambrian_filtered_gpt4vo_sp_token_fltd_max10k_checked.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/VisualWebInstruct_filtered_263589.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/visual_chat_en_26048_gpt4o_coco_checked.json # not released
sampling_strategy: "all"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/gpt4o_combinations_51316.json
# sampling_strategy: "all"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/chrome_writting_train_8835.json
# sampling_strategy: "first:20%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/k12_printing_train_256646.json
# sampling_strategy: "first:1%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/iiit5k_annotations_2000.json
# sampling_strategy: "first:20%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/hme100k_train_clean_74502.json
# sampling_strategy: "first:10%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sroie_data_33626.json
# sampling_strategy: "first:1%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/orand_car_a_train_2009.json
# sampling_strategy: "first:10%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/orand_car_b_train_3000.json
# sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llavar_gpt4_20k.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/ai2d_azuregpt_detailed_understanding_4874.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/infographic_vqa_4404.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/infographic_azuregpt4v_1992.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/lrv_chart_1787.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/lrv_normal_gpt4v_filtered_10500.json
sampling_strategy: "first:10%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/scienceqa_nona_context_19218.json
# sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/allava_instruct_vflan4v_20000.json
sampling_strategy: "first:30%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/allava_instruct_laion4v_50000.json
sampling_strategy: "first:30%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/textocr_gpt4v_train_converted_25114.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/ai2d_train_internvl_single_12413.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/textcaps_train_21952.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_qa_sft.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_cap_sft.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_ie_sft.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_kg_sft.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/vision_flan_filtered_186070.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/mathqa_29837.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/geo3k_2101.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/geo170k_qa_converted_67833.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/geo170k_align_converted_60252.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4o_dataset.jsonl
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-coco-50k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-knowledge-2k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-llava-30k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-sam-20k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_CLEVR-Math_5290.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_FigureQA_17597.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_Geometry3K_9734.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_GeoQA+_17172.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_GEOS_508.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_IconQA_22599.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_MapQA_5235.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_PlotQA_5485.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_PMC-VQA_35958.json
sampling_strategy: "first:1%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_Super-CLEVR_8652.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_TabMWP_22462.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_TQA_10181.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_UniGeo_11959.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_VizWiz_6614.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_VQA-AS_5907.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_VQA-RAD_2130.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/magpie_pro_qwen2_72b_st_300000_sp_token_fltd_299992.json
sampling_strategy: "end:20%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/magpie_pro_l3_80b_st_300000.json
sampling_strategy: "end:20%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/magpie_pro_l3_80b_mt_300000_sp_token_fltd_299998.json
sampling_strategy: "end:20%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/image_textualization_dataset_filtered.json
sampling_strategy: "first:20%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/ai2d_llava_format_2434.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/chart2text_26961.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/chartqa_18265_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/diagram_image_to_text_300.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/hateful_memes_8500_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/hitab_2500_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/iam_5663.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/infographic_vqa_2118_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/intergps_1280_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/mapqa_37417_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/rendered_text_10000.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/robut_sqa_8514.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/robut_wikisql_74989.json
sampling_strategy: "first:10%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/robut_wtq_38246_llava_format_filtered_4000tokens_38236.json
# sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/screen2words_15730.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/tabmwp_22722.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/tallyqa_98680_llava_format.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/st_vqa_17247_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/tqa_llava_format_27307.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/visual7w_llava_format_14366.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/visualmrc_3027.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/vqarad_313_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/vsr_2157_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/vistext_9969.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/websight_10000.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_ofa_DEMON-FULL_filtered_311085.json # released in lmms-lab/M4-Instruct
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_ofa_mantis-instruct_reformatted.json # released in lmms-lab/M4-Instruct
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/academic_source_30s_v1_all.json # will be released in next version of LLaVA-NeXT-Video
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/0718_0_30_s_academic_mc_v0_1_all.json # will be released in next version of LLaVA-NeXT-Video
sampling_strategy: all
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4video_255000.json # download from sharegpt4video
sampling_strategy: all
+55
View File
@@ -0,0 +1,55 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
LLM_VERSION="Qwen/Qwen2-7B-Instruct"
LLM_VERSION_CLEAN="${LLM_VERSION//\//_}"
VISION_MODEL_VERSION="openai/clip-vit-large-patch14-336"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
PROMPT_VERSION=plain
BASE_RUN_NAME="llavanext-${VISION_MODEL_VERSION_CLEAN}-${LLM_VERSION_CLEAN}-mlp2x_gelu-pretrain_blip558k_plain"
echo "BASE_RUN_NAME: ${BASE_RUN_NAME}"
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" --node_rank="${RANK}" --master_addr="${ADDR}" --master_port="${PORT}" \
llava/train/train_mem.py \
--deepspeed scripts/zero3.json \
--model_name_or_path ${LLM_VERSION} \
--version ${PROMPT_VERSION} \
--data_path /blip_558k/blip_558k_plain.json \
--image_folder /blip_558k/images \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_tunable_parts="mm_mlp_adapter" \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir /checkpoints/projectors/${BASE_RUN_NAME} \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "no" \
--save_steps 50000 \
--learning_rate 1e-3 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 8192 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb \
--run_name $BASE_RUN_NAME \
--attn_implementation sdpa
# You can delete the sdpa attn_implementation if you want to use flash attn
+55
View File
@@ -0,0 +1,55 @@
export OMP_NUM_THREADS=8
export NCCL_IB_DISABLE=0
export NCCL_IB_GID_INDEX=3
export NCCL_SOCKET_IFNAME=eth0
export NCCL_DEBUG=INFO
LLM_VERSION="Qwen/Qwen2-7B-Instruct"
LLM_VERSION_CLEAN="${LLM_VERSION//\//_}"
VISION_MODEL_VERSION="google/siglip-so400m-patch14-384"
VISION_MODEL_VERSION_CLEAN="${VISION_MODEL_VERSION//\//_}"
############### Pretrain ################
PROMPT_VERSION=plain
BASE_RUN_NAME="llavanext-${VISION_MODEL_VERSION_CLEAN}-${LLM_VERSION_CLEAN}-mlp2x_gelu-pretrain_blip558k_plain"
echo "BASE_RUN_NAME: ${BASE_RUN_NAME}"
ACCELERATE_CPU_AFFINITY=1 torchrun --nproc_per_node="${NUM_GPUS}" --nnodes="${NNODES}" --node_rank="${RANK}" --master_addr="${ADDR}" --master_port="${PORT}" \
llava/train/train_mem.py \
--deepspeed scripts/zero3.json \
--model_name_or_path ${LLM_VERSION} \
--version ${PROMPT_VERSION} \
--data_path /blip_558k/blip_558k_plain.json \
--image_folder /blip_558k/images \
--vision_tower ${VISION_MODEL_VERSION} \
--mm_tunable_parts="mm_mlp_adapter" \
--mm_vision_select_layer -2 \
--mm_projector_type mlp2x_gelu \
--mm_use_im_start_end False \
--mm_use_im_patch_token False \
--bf16 True \
--output_dir /checkpoints/projectors/${BASE_RUN_NAME} \
--num_train_epochs 1 \
--per_device_train_batch_size 16 \
--per_device_eval_batch_size 4 \
--gradient_accumulation_steps 1 \
--evaluation_strategy "no" \
--save_strategy "no" \
--save_steps 50000 \
--learning_rate 1e-3 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--tf32 True \
--model_max_length 8192 \
--gradient_checkpointing True \
--dataloader_num_workers 16 \
--lazy_preprocess True \
--report_to wandb \
--run_name $BASE_RUN_NAME \
--attn_implementation sdpa
# You can delete the sdpa attn_implementation if you want to use flash attn
+187
View File
@@ -0,0 +1,187 @@
datasets:
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_next_fit_mix_filtered_text_wild_738590.json # released in lmms-lab/LLaVA-NeXT-Data
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_wild_4v_39k.json # not released
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llava_wild_4v_12k.json # not released
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/llavar_gpt4_20k.json
sampling_strategy: "all"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sroie_data_33626.json
# sampling_strategy: "first:10%"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/orand_car_a_train_2009.json
# sampling_strategy: "all"
# - json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/orand_car_b_train_3000.json
# sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/mavis_math_metagen_87358.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/mavis_math_rule_geo_100000.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/chrome_writting_train_8835.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/k12_printing_train_256646.json
sampling_strategy: "first:1%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/iiit5k_annotations_2000.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/hme100k_train_clean_74502.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/ai2d_azuregpt_detailed_understanding_4874.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/infographic_vqa_4404.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/infographic_azuregpt4v_1992.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/lrv_chart_1787.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/lrv_normal_gpt4v_filtered_10500.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/scienceqa_nona_context_19218.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/allava_instruct_vflan4v_20000.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/allava_instruct_laion4v_50000.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/textocr_gpt4v_train_converted_25114.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/ai2d_train_internvl_single_12413.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/textcaps_train_21952.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_qa_sft.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_cap_sft.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_ie_sft.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/ureader_new/ureader_kg_sft.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/vision_flan_filtered_186070.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/mathqa_29837.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/geo3k_2101.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/geo170k_qa_converted_67833.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/geo170k_align_converted_60252.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-coco-50k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-knowledge-2k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-llava-30k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4v-sam-20k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_CLEVR-Math_5290.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_FigureQA_17597.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_Geometry3K_9734.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_GeoQA+_17172.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_GEOS_508.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_IconQA_22599.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_MapQA_5235.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_PMC-VQA_35958.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_Super-CLEVR_8652.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_TabMWP_22462.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_TQA_10181.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_UniGeo_11959.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_VizWiz_6614.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_VQA-AS_5907.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/MathV360K_VQA-RAD_2130.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/Evol-Instruct-GPT4-Turbo-143000.json
sampling_strategy: "first:30%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/magpie_pro_qwen2_72b_st_300000_sp_token_fltd_299992.json
sampling_strategy: "first:50%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/magpie_pro_l3_80b_st_300000.json
sampling_strategy: "first:50%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/magpie_pro_l3_80b_mt_300000_sp_token_fltd_299998.json
sampling_strategy: "first:50%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/image_textualization_dataset_filtered.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/cambrian_filtered_gpt4vo_sp_token_fltd_max10k.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/real_vision_flan/sharegpt4o_dataset.jsonl
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/ai2d_llava_format_2434.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/aokvqa_16539_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/chart2text_26961.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/chartqa_18265_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/clevr_70000_llava_format.json
sampling_strategy: "first:1%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/diagram_image_to_text_300.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/dvqa_200000_llava_format.json
sampling_strategy: "first:1%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/figureqa_100000_llava_format.json
sampling_strategy: "first:1%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/geomverse_9303.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/hateful_memes_8500_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/hitab_2500_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/iam_5663.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/raven_42000.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/iconqa_llava_format_27307.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/infographic_vqa_2118_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/intergps_1280_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/mapqa_37417_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/multihiertt_7619.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/rendered_text_10000.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/robut_sqa_8514.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/robut_wikisql_74989.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/robut_wtq_38246_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/screen2words_15730.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/scienceqa_llava_format_4976.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/tabmwp_22722.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/tallyqa_98680_llava_format.json
sampling_strategy: "first:10%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/st_vqa_17247_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/tqa_llava_format_27307.json
sampling_strategy: "first:5%"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/visual7w_llava_format_14366.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/visualmrc_3027.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/vqarad_313_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/vsr_2157_llava_format.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/vistext_9969.json
sampling_strategy: "all"
- json_path: /mnt/bn/vl-research/data/llava_instruct/cauldron/websight_10000.json
sampling_strategy: "all"
+3
View File
@@ -0,0 +1,3 @@
datasets:
- json_path: /data/jcy/data/llavaov/iiit5k/iiit5k.json
sampling_strategy: "all"
+3
View File
@@ -0,0 +1,3 @@
datasets:
- json_path: /root/code/openvla-llava/LLaVA-Next/vla_llava.json
sampling_strategy: "all"
+41
View File
@@ -0,0 +1,41 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},
"zero_optimization": {
"stage": 2,
"offload_optimizer": {
"device": "none",
"pin_memory": true
},
"allgather_partitions": true,
"allgather_bucket_size": 2e8,
"overlap_comm": false,
"reduce_scatter": true,
"reduce_bucket_size": 2e8,
"contiguous_gradients": true
},
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"steps_per_print": 100,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"wall_clock_breakdown": false
}
+41
View File
@@ -0,0 +1,41 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},
"zero_optimization": {
"stage": 2,
"offload_optimizer": {
"device": "none",
"pin_memory": true
},
"allgather_partitions": true,
"allgather_bucket_size": 2e8,
"overlap_comm": true,
"reduce_scatter": true,
"reduce_bucket_size": 2e8,
"contiguous_gradients": true
},
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"steps_per_print": 100,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"wall_clock_breakdown": false
}
+31
View File
@@ -0,0 +1,31 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"train_micro_batch_size_per_gpu": "auto",
"train_batch_size": "auto",
"gradient_accumulation_steps": "auto",
"zero_optimization": {
"stage": 2,
"offload_optimizer": {
"device": "cpu",
"pin_memory": true
},
"offload_param": {
"device": "cpu",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto"
}
}
+41
View File
@@ -0,0 +1,41 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"zero_optimization": {
"stage": 3,
"offload_optimizer": {
"device": "none",
"pin_memory": true
},
"offload_param": {
"device": "none",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_gather_16bit_weights_on_model_save": true
},
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"steps_per_print": 100,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"wall_clock_breakdown": false
}
+48
View File
@@ -0,0 +1,48 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},
"zero_optimization": {
"stage": 3,
"offload_optimizer": {
"device": "cpu",
"pin_memory": true
},
"offload_param": {
"device": "cpu",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"gather_16bit_weights_on_model_save": true
},
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"steps_per_print": 1e5,
"wall_clock_breakdown": false
}
+53
View File
@@ -0,0 +1,53 @@
{
"fp16": {
"enabled": "auto",
"loss_scale": 0,
"loss_scale_window": 1000,
"initial_scale_power": 16,
"hysteresis": 2,
"min_loss_scale": 1
},
"bf16": {
"enabled": "auto"
},
"optimizer": {
"type": "AdamW",
"params": {
"lr": "auto",
"betas": "auto",
"eps": "auto",
"weight_decay": "auto"
}
},
"zero_optimization": {
"stage": 3,
"offload_optimizer": {
"device": "none",
"pin_memory": true
},
"offload_param": {
"device": "none",
"pin_memory": true
},
"overlap_comm": true,
"contiguous_gradients": true,
"zero_quantized_weights": true,
"zero_hpz_partition_size": 16,
"zero_quantized_gradients": true,
"sub_group_size": 1e9,
"reduce_bucket_size": "auto",
"stage3_prefetch_bucket_size": "auto",
"stage3_param_persistence_threshold": "auto",
"stage3_max_live_parameters": 1e9,
"stage3_max_reuse_distance": 1e9,
"stage3_gather_16bit_weights_on_model_save": true
},
"gradient_accumulation_steps": "auto",
"gradient_clipping": "auto",
"steps_per_print": 100,
"train_batch_size": "auto",
"train_micro_batch_size_per_gpu": "auto",
"wall_clock_breakdown": false
}