Instructions to use szalontaib/MegaBugInject with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use szalontaib/MegaBugInject with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/home/bszalontai/balazs_munka/codellama/models_hf/wizard-coder-13b-python") model = PeftModel.from_pretrained(base_model, "szalontaib/MegaBugInject") - Notebooks
- Google Colab
- Kaggle
Add pipeline tag to metadata
Browse filesThis PR adds the `pipeline_tag: text-generation` to the model card's metadata, making it easier for users to discover the model on the Hugging Face Hub under the text generation task category.
README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
library_name: peft
|
| 3 |
base_model: WizardLMTeam/WizardCoder-Python-13B-V1.0
|
|
|
|
| 4 |
license: apache-2.0
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
# Model Card for Model ID
|
|
@@ -39,17 +40,23 @@ def extract_diff(model_output):
|
|
| 39 |
pattern = re.compile(r'\s*\[DIFF\](.*?)\[/DIFF\]\s*', re.DOTALL)
|
| 40 |
matches = pattern.findall(model_output)
|
| 41 |
if matches:
|
| 42 |
-
return matches[0].strip('
|
|
|
|
| 43 |
return None
|
| 44 |
|
| 45 |
def diff2code(diff : str) -> str:
|
| 46 |
-
return '
|
|
|
|
| 47 |
line[2:] for line in diff.splitlines()
|
| 48 |
if not line.startswith('-')
|
| 49 |
).strip()
|
| 50 |
|
| 51 |
def corrupt(program, model, tokenizer, **generation_kwargs):
|
| 52 |
-
prompt = f'[PYTHON]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
model_inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
|
| 54 |
generated_ids = model.generate(**model_inputs, **generation_kwargs)
|
| 55 |
outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
base_model: WizardLMTeam/WizardCoder-Python-13B-V1.0
|
| 3 |
+
library_name: peft
|
| 4 |
license: apache-2.0
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
---
|
| 7 |
|
| 8 |
# Model Card for Model ID
|
|
|
|
| 40 |
pattern = re.compile(r'\s*\[DIFF\](.*?)\[/DIFF\]\s*', re.DOTALL)
|
| 41 |
matches = pattern.findall(model_output)
|
| 42 |
if matches:
|
| 43 |
+
return matches[0].strip('
|
| 44 |
+
')
|
| 45 |
return None
|
| 46 |
|
| 47 |
def diff2code(diff : str) -> str:
|
| 48 |
+
return '
|
| 49 |
+
'.join(
|
| 50 |
line[2:] for line in diff.splitlines()
|
| 51 |
if not line.startswith('-')
|
| 52 |
).strip()
|
| 53 |
|
| 54 |
def corrupt(program, model, tokenizer, **generation_kwargs):
|
| 55 |
+
prompt = f'[PYTHON]
|
| 56 |
+
{program.strip()}
|
| 57 |
+
[/PYTHON]
|
| 58 |
+
[DIFF]
|
| 59 |
+
'
|
| 60 |
model_inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
|
| 61 |
generated_ids = model.generate(**model_inputs, **generation_kwargs)
|
| 62 |
outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
|