Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
add usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
drndr committed Nov 7, 2023
1 parent e1aefc5 commit de44168
Show file tree
Hide file tree
Showing 10 changed files with 413 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
2 changes: 1 addition & 1 deletion src/genbench/tasks/nl_codesearch_clf/cosqa/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
torch v. 2.1.0
numpy v. 1.25.1
tqdm v. 4.65.0
transformers v. 4.32.0
scikit-learn v. 1.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_dataset_raw(self) -> Dict[str, datasets.Dataset]:
# Split input into comment and code
input_parts = item["input"].split("[CODESPLIT]")
# Split random input into comment and code
random_input_parts = random_item["input"].split("[CODESPLIT]")
random_input_parts = random_item[0]["input"].split("[CODESPLIT]")
# Combine the "input" fields of the original and random items
new_input = input_parts[0] + "[CODESPLIT]" + random_input_parts[1]
new_item = {"input": new_input, "target": 0, "target_options": item["target_options"]}
Expand Down
Loading

0 comments on commit de44168

Please sign in to comment.