Spaces:
Runtime error
Runtime error
bug fixes
Browse files
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import re
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
-
from transformers import
|
| 5 |
|
| 6 |
-
tokenizer =
|
| 7 |
model = AutoModelForMaskedLM.from_pretrained("mamiksik/CodeBERTa-commit-message-autocomplete")
|
| 8 |
pipe = pipeline("fill-mask", model=model, tokenizer=tokenizer)
|
| 9 |
|
|
@@ -47,7 +47,7 @@ def parse_files(patch) -> str:
|
|
| 47 |
|
| 48 |
|
| 49 |
def predict(patch, commit_message):
|
| 50 |
-
input_text = parse_files(patch) + "
|
| 51 |
token_count = tokenizer(input_text, return_tensors="pt").input_ids.shape[1]
|
| 52 |
result = pipe.predict(input_text)
|
| 53 |
|
|
|
|
| 1 |
import re
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
+
from transformers import pipeline, AutoModelForMaskedLM, AutoTokenizer
|
| 5 |
|
| 6 |
+
tokenizer = AutoTokenizer.from_pretrained("mamiksik/CodeBERTa-commit-message-autocomplete")
|
| 7 |
model = AutoModelForMaskedLM.from_pretrained("mamiksik/CodeBERTa-commit-message-autocomplete")
|
| 8 |
pipe = pipeline("fill-mask", model=model, tokenizer=tokenizer)
|
| 9 |
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
def predict(patch, commit_message):
|
| 50 |
+
input_text = parse_files(patch) + "</sep></sep><msg> " + commit_message + "</sep>"
|
| 51 |
token_count = tokenizer(input_text, return_tensors="pt").input_ids.shape[1]
|
| 52 |
result = pipe.predict(input_text)
|
| 53 |
|