Downloads · 30 days
16
34% of all-time downloads
pszemraj/nanoT5-mid-2k-instruct
nanoT5-mid-2k-instruct is a text generation model from pszemraj. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
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.
Downloads · 30 days
16
34% of all-time downloads
All-time downloads
47
Public
Parameters
637M
2.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.5 GB · 100%
From the Hugging Face model README
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:
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"])
<details>
<summary>Click to see example response</summary>
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)