Downloads · 30 days
0
mrm8488/bertin-gpt-j-6B-es-finetuned-chistes_spanish_jokes-500
bertin-gpt-j-6B-es-finetuned-chistes_spanish_jokes-500 is a text generation model from mrm8488. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This adapter was created by using the PEFT library and allows the base model BERTIN-GPT-J-6B to be fine-tuned on the dataset mrm8488/CHISTESspanishjokes for Spanish jokes generation by using the method LoRA.
Downloads · 30 days
0
Access
Public
Updated Feb 24, 2023
Repo size
29.4 MB
Likes
0
Public
Click a slice to open those files.
.bin29.4 MB · 100%
From the Hugging Face model README
This adapter was created by using the PEFT library and allows the base model BERTIN-GPT-J-6B to be fine-tuned on the dataset mrm8488/CHISTES_spanish_jokes for Spanish jokes generation by using the method LoRA.
BERTIN-GPT-J-6B is a Spanish finetuned version of GPT-J 6B, a transformer model trained using Ben Wang's Mesh Transformer JAX. "GPT-J" refers to the class of model, while "6B" represents the number of trainable parameters.
Dataset from Workshop for NLP introduction with Spanish jokes
TBA
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
peft_model_id = "mrm8488/bertin-gpt-j-6B-es-finetuned-chistes_spanish_jokes-500"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)
# Inference
batch = tokenizer("Esto son dos amigos", return_tensors='pt')
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=50)
print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=True))