Spanish
File size: 2,321 Bytes
9234eb0
 
 
 
c6dba0d
 
9234eb0
 
e822186
1cf84d3
9234eb0
 
 
 
9b8dd5e
9234eb0
 
 
9b8dd5e
9234eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
language:
- es
license: apache-2.0
datasets:
- hackathon-somos-nlp-2023/Habilidades_Agente_v1
---

<div style="text-align:center;width:450px;height:450px;">
    <img src="https://huggingface.co/hackathon-somos-nlp-2023/SalpiBloomZ_15949_input_512-1b7/resolve/main/salpi.png" alt="SAlsapaca logo"">
</div>



# SalpiBloomZ-1b7: Spanish + BloomZ + Alpaca + softskills + virtual agents  (WIP)


## Adapter Description
This adapter was created with the [PEFT](https://github.com/huggingface/peft) library and allowed the base model [bigscience/bloomz-1b7](https://huggingface.co/bigscience/bloomz-1b7) to be fine-tuned on the [hackathon-somos-nlp-2023/Habilidades_Agente_v1](https://huggingface.co/datasets/hackathon-somos-nlp-2023/Habilidades_Agente_v1) by using the method *LoRA*.


## How to use
```py
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer

peft_model_id = "hackathon-somos-nlp-2023/salsapaca-native"
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, early_stopping = True, temperature=.9)

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

text = "hola"

gen_conversation(text)
```


## Resources used
Google Colab machine with the following specifications
<div style="text-align:center;width:550px;height:550px;">
    <img src="https://huggingface.co/hackathon-somos-nlp-2023/bertin-gpt-j-6B-es-finetuned-salpaca/resolve/main/resource.jpeg" alt="Resource logo">
</div>

## Citation
```
@misc {hackathon-somos-nlp-2023,
	author       = { {Edison Bejarano, Leonardo Bolaños, Alberto Ceballos, Santiago Pineda, Nicolay Potes} },
	title        = { SAlsapaca },
	year         = 2023,
	url          = { https://huggingface.co/hackathon-somos-nlp-2023/salsapaca-native }
	publisher    = { Hugging Face }
}
```