Model Card for Model ID
Model Details
GPT2-Medium trained using SFTTrainer using chat templates. Use a conversational dataset (Kukedlc/dpo-orpo-spanish-15k)
Usage
Using AutoModel
from transformers import AutoModelForCausalLM, AutoTokenizer,BitsAndBytesConfig import torch sys_prompt="Eres un asistente de IA, debes responder amablemente a las preguntas que haga el usuario" messages=[{'role':'system','content':sys_prompt},{'role':'user','content':'hola quién eres?'}] base_model="jhonparra18/gpt2-med-sft-chat-spanish" model = AutoModelForCausalLM.from_pretrained(base_model,torch_dtype=torch.float16,device_map="auto") tokenizer = AutoTokenizer.from_pretrained(base_model) #define your generation args generation_kwargs={ 'num_beams':5, 'no_repeat_ngram_size':2, 'do_sample':True, 'early_stopping':True, 'top_p':0.95 } tokenizer.padding_side="left" model_inputs=tokenizer.apply_chat_template(messages,tokenize=True,return_tensors="pt",return_dict=True,padding=True) outputs=model.generate( **model_inputs, **generation_kwargs ) for i, output in enumerate(outputs): print("{}: {}".format(i, tokenizer.decode(output, skip_special_tokens=True)))
Pipelines
from transformers import pipeline pipe=pipeline("text-generation",model=base_model,device_map="auto",**generation_kwargs) outputs=pipe(messages) print(outputs[0]['generated_text'][-1]['content'])
- Downloads last month
- 17
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for jhonparra18/gpt2-med-sft-chat-spanish
Base model
openai-community/gpt2-medium