-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/add-vllm-deploy
- Loading branch information
Showing
22 changed files
with
202 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ tests/state_of_the_union.txt | |
|
||
# Build | ||
build | ||
!dummy_file | ||
!dummy_file |
89 changes: 0 additions & 89 deletions
89
data_process/data/multiturn_data/multiturn_data_preprocess.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import json | ||
|
||
dummy_qa = {"id": "", "conversations": [{"from": "human", "value": "How old is Haofei?"}, {"from": "gpt", "value": "He is one year old."}]} | ||
|
||
res = [] | ||
for i in range(1000): | ||
new_qa = dict(dummy_qa) | ||
new_qa["id"] = f"identity_{i}" | ||
res.append(new_qa) | ||
|
||
with open("./dummy_convs.json", "w") as f: | ||
json.dump(res, f, indent=4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import json | ||
import transformers | ||
|
||
INPUT_PATH = "fastchat-ft-gpt4-gpt4-easy-2-side-partial-speak.json" | ||
OUTPUT_PATH = "fastchat-ft-gpt4-gpt4-easy-2-side-partial-speak-no-long.json" | ||
MODEL_CHECKPOINT = "meta-llama/Llama-2-13b-chat-hf" | ||
HF_TOKEN = "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" | ||
|
||
with open(INPUT_PATH, 'r') as f: | ||
data = json.load(f) | ||
|
||
tokenizer = transformers.AutoTokenizer.from_pretrained( | ||
MODEL_CHECKPOINT, | ||
padding = False, | ||
truncation = False, | ||
token=HF_TOKEN, | ||
) | ||
|
||
res = [] | ||
for d in data: | ||
for conv in d['conversations']: | ||
if conv['from'] == "human": | ||
input_ids = tokenizer(conv['value']) | ||
if len(input_ids) <= 2048: | ||
res.append(d) | ||
|
||
with open(OUTPUT_PATH, 'w') as f: | ||
json.dump(res, f, indent=4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import json | ||
|
||
INPUT_PATH = "fastchat-ft-gpt4-gpt4-easy-2-side-partial.json" | ||
OUTPUT_PATH = "fastchat-ft-gpt4-gpt4-easy-2-side-partial-speak.json" | ||
|
||
with open(INPUT_PATH, 'r') as f: | ||
data = json.load(f) | ||
|
||
res = [] | ||
for d in data: | ||
for conv in d['conversations']: | ||
if conv['from'] == "gpt" and "'action_type': 'speak'" in conv['value']: | ||
res.append(d) | ||
|
||
with open(OUTPUT_PATH, 'w') as f: | ||
json.dump(res, f, indent=4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.