Downloads · 30 days
8
12% of all-time downloads
lyndoncarlson/chile_edu_estan_HyDE
chile_edu_estan_HyDE is a machine learning model from lyndoncarlson. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This model is a text generation model fine-tuned from ByT5-Small, designed to generate coherent and contextually relevant Spanish text based on input prompts. It is optimized for generating content chunks, making it s…
Downloads · 30 days
8
12% of all-time downloads
All-time downloads
66
Public
Parameters
248M
3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors990 MB · 100%
From the Hugging Face model README
This model is a text generation model fine-tuned from ByT5-Small, designed to generate coherent and contextually relevant Spanish text based on input prompts. It is optimized for generating content chunks, making it suitable for applications such as content creation, automated writing assistance, and more.
trained-byt5-smallinput_text): User queries or initial text snippets.output_text): Corresponding generated or relevant text passages with a high relevance rank (rank > 4).(prompt, content) pairs were selected where both prompt and content have non-zero lengths and a relevance rank greater than 4, ensuring high-quality training data.output_text entries were split into chunks of up to 512 characters to manage model input size and to enhance training efficiency.max_length = 512doc_stride = 256 (for handling long texts with overlapping contexts)google/byt5-smalltorch.nn.CrossEntropyLoss) to train the model to predict the next tokens in the sequence.5e-5 and weight decay of 0.01fp16 = False) to prevent issues with NaNs during training.test_loss in the training logs.Below is a Python example demonstrating how to use the fine-tuned ByT5-Small model for text generation in Spanish. Ensure you have installed the necessary libraries (transformers, torch) and have the model saved in the ./trained-byt5-small directory.
import torch
from transformers import T5ForConditionalGeneration, ByT5Tokenizer
# Load the trained model and tokenizer
model_dir = "./trained-byt5-small"
tokenizer = ByT5Tokenizer.from_pretrained(model_dir)
model = T5ForConditionalGeneration.from_pretrained(model_dir)
# Move model to device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
model.eval()
prompt = "¿Cómo implementar un sistema solar en una escuela primaria?"
# Tokenize the input text
inputs = tokenizer(
prompt,
return_tensors="pt",
max_length=512,
truncation=True
).to(device)
# Generate outputs
with torch.no_grad():
outputs = model.generate(
input_ids=inputs['input_ids'],
attention_mask=inputs['attention_mask'],
max_length=512,
num_return_sequences=1,
do_sample=True,
temperature=0.5,
top_k=2000,
top_p=0.95,
repetition_penalty=1.2,
early_stopping=True
)
# Decode and print the generated text
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"Generated Text: {generated_text}")
Output:
Generated Text: Para implementar un sistema solar en una escuela primaria, se puede comenzar por educar a los estudiantes sobre los planetas y sus características. Luego, se pueden realizar actividades prácticas como construir maquetas del sistema solar, organizar excursiones a planetarios o utilizar software educativo interactivo. Además, es importante fomentar la curiosidad y el interés de los alumnos mediante proyectos de investigación y presentaciones sobre diferentes aspectos del espacio.
Bias and Fairness:
Domain Specificity:
Quality and Reliability:
Data Privacy:
Misuse Potential: