PEFT
nielsr HF Staff commited on
Commit
7525e5a
·
verified ·
1 Parent(s): 2c854a3

Add pipeline tag to metadata

Browse files

This 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.

Files changed (1) hide show
  1. README.md +11 -4
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('\n')
 
43
  return None
44
 
45
  def diff2code(diff : str) -> str:
46
- return '\n'.join(
 
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]\n{program.strip()}\n[/PYTHON]\n[DIFF]\n'
 
 
 
 
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)