nanoT5-mid-2k-instruct
This model is pszemraj/nanoT5-mid-65kBPE-2048 fine-tuned on ~2M examples to complete "instruct"-style tasks. It performs quite coherently for its size.
Details:
- Pre-trained and fine-tuned with 2048 in/out context length
- Variety of tasks in training data
Usage example
from transformers import pipeline
pipe = pipeline(
"text2text-generation",
model="pszemraj/nanoT5-mid-2k-instruct",
device_map="auto",
)
prompt = "Write a Python code to reverse a linked list."
res = pipe(
prompt,
max_new_tokens=384,
top_k=4,
penalty_alpha=0.6,
# no_repeat_ngram_size=6, # use for repeats
)
print(res[0]["generated_text"])
Click to see example response
Here's a Python code that reverses a linked list:
\```python
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, data):
new_node = Node(data)
new_node.next = Node(data)
new_node.next = new_node
def reverse(self):
new_node = Node(data)
new_node.next = self.head
new_node.next = new_node
def print_list(self):
print(self.head)
# Example usage:
# Create a linked list
linked_list = LinkedList()
# Reverse the linked list
linked_list.reverse()
\```
In this code, we define a class `LinkedList` that represents a node in the linked list. The `__init__` method is used to initialize the head of the linked list.
The `reverse` method takes the head of the linked list as an argument and returns the reverse of the linked list.
The `reverse` method takes the head of the linked list as an argument and returns the reverse of the linked list.
The `reverse` method takes the head of the linked list as an argument and returns the reverse of the linked list.
In the example usage, we create a linked list `linked_list` with some data. We call the `reverse` method on the head of the linked list and print the result.
(the \
character was manually added before the code fences here for display reasons)
- Downloads last month
- 95
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
Model tree for pszemraj/nanoT5-mid-2k-instruct
Base model
pszemraj/nanoT5-mid-65kBPE-2048