sapinedamo commited on
Commit
d5c7717
1 Parent(s): 9f26a8f

Create README.md

Browse files

![DALL·E 2023-03-22 15.33.52 - Alpaca latina en forma de caricatura con legales.png](https://s3.amazonaws.com/moonup/production/uploads/6418809922270b3ccf132960/rlw2BpmtsVXtyY2PPj4l4.png)

SAlpaca: Spanish Alpaca

Adapter Description:
This adapter was created with the PEFT library and allowed the base model bertin-gpt-j-6B-es-finetuned to be fine-tuned on Spanish Alpaca Dataset by using the method LoRA.

How to use:

```
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer

peft_model_id = "hackathon-somos-nlp-2023/bertin-gpt-j-6B-es-finetuned-salpaca"
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(peft_model_id)

# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)

def gen_conversation(text):
text = "<SC>instruction: " + text + "\n "
batch = tokenizer(text, return_tensors='pt')
with torch.cuda.amp.autocast():
output_tokens = model.generate(**batch, max_new_tokens=256, eos_token_id=50258)

print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=False))

text = "hola, cómo estás?"

gen_conversation(text)

```

Files changed (1) hide show
  1. README.md +6 -0
README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - bertin-project/alpaca-spanish
4
+ language:
5
+ - es
6
+ ---