Summarization
Transformers
PyTorch
English
t5
text2text-generation
Trained with AutoTrain
text-generation-inference
Instructions to use ashwinR/CodeExplainer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ashwinR/CodeExplainer with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "summarization" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("summarization", model="ashwinR/CodeExplainer")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("ashwinR/CodeExplainer") model = AutoModelForSeq2SeqLM.from_pretrained("ashwinR/CodeExplainer") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -6,13 +6,18 @@ language:
|
|
| 6 |
- en
|
| 7 |
widget:
|
| 8 |
- text: >
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
datasets:
|
| 17 |
- sagard21/autotrain-data-code-explainer
|
| 18 |
co2_eq_emissions:
|
|
@@ -41,7 +46,7 @@ from transformers import (
|
|
| 41 |
pipeline,
|
| 42 |
)
|
| 43 |
|
| 44 |
-
model_name = "
|
| 45 |
|
| 46 |
tokenizer = AutoTokenizer.from_pretrained(model_name, padding=True)
|
| 47 |
|
|
|
|
| 6 |
- en
|
| 7 |
widget:
|
| 8 |
- text: >
|
| 9 |
+
class Solution(object):
|
| 10 |
+
def isValid(self, s):
|
| 11 |
+
stack = []
|
| 12 |
+
mapping = {")": "(", "}": "{", "]": "["}
|
| 13 |
+
for char in s:
|
| 14 |
+
if char in mapping:
|
| 15 |
+
top_element = stack.pop() if stack else '#'
|
| 16 |
+
if mapping[char] != top_element:
|
| 17 |
+
return False
|
| 18 |
+
else:
|
| 19 |
+
stack.append(char)
|
| 20 |
+
return not stack
|
| 21 |
datasets:
|
| 22 |
- sagard21/autotrain-data-code-explainer
|
| 23 |
co2_eq_emissions:
|
|
|
|
| 46 |
pipeline,
|
| 47 |
)
|
| 48 |
|
| 49 |
+
model_name = "ashwinR/CodeExplainer"
|
| 50 |
|
| 51 |
tokenizer = AutoTokenizer.from_pretrained(model_name, padding=True)
|
| 52 |
|