sapinedamo NickyNicky commited on
Commit
39b62dc
1 Parent(s): 169139a

Create README.md (#1)

Browse files

- Create README.md (3afea6010edd4a809b432b977a6284f75e23c246)


Co-authored-by: Nicky <NickyNicky@users.noreply.huggingface.co>

Files changed (1) hide show
  1. README.md +65 -0
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - es
4
+ license: apache-2.0
5
+ datasets:
6
+ - hackathon-somos-nlp-2023/Habilidades_Agente_v1
7
+ pipeline_tag: conversational
8
+ ---
9
+
10
+ <div style="text-align:center;width:450px;height:450px;">
11
+ <img src="https://huggingface.co/hackathon-somos-nlp-2023/SalpiBloomZ_15949_input_512-1b7/resolve/main/salpi.png" alt="SAlsapaca logo"">
12
+ </div>
13
+
14
+
15
+
16
+ # SalpiBloomZ-1b7: Spanish + BloomZ + Alpaca + softskills + virtual agents (WIP)
17
+
18
+
19
+ ## Adapter Description
20
+ 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.
21
+
22
+
23
+ ## How to use
24
+ py
25
+ import torch
26
+ from peft import PeftModel, PeftConfig
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer
28
+
29
+ peft_model_id = "hackathon-somos-nlp-2023/salsapaca-native"
30
+ config = PeftConfig.from_pretrained(peft_model_id)
31
+ model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
32
+ tokenizer = AutoTokenizer.from_pretrained(peft_model_id)
33
+
34
+ # Load the Lora model
35
+ model = PeftModel.from_pretrained(model, peft_model_id)
36
+
37
+ def gen_conversation(text):
38
+ text = "<SC>instruction: " + text + "\n "
39
+ batch = tokenizer(text, return_tensors='pt')
40
+ with torch.cuda.amp.autocast():
41
+ output_tokens = model.generate(**batch, max_new_tokens=256, eos_token_id=50258, early_stopping = True, temperature=.9)
42
+
43
+ print('\n\n', tokenizer.decode(output_tokens[0], skip_special_tokens=False))
44
+
45
+ text = "hola"
46
+
47
+ gen_conversation(text)
48
+
49
+
50
+
51
+ ## Resources used
52
+ Google Colab machine with the following specifications
53
+ <div style="text-align:center;width:550px;height:550px;">
54
+ <img src="https://huggingface.co/hackathon-somos-nlp-2023/bertin-gpt-j-6B-es-finetuned-salpaca/resolve/main/resource.jpeg" alt="Resource logo">
55
+ </div>
56
+
57
+ ## Citation
58
+
59
+ @misc {hackathon-somos-nlp-2023,
60
+ author = { {Edison Bejarano, Leonardo Bolaños, Alberto Ceballos, Santiago Pineda, Nicolay Potes} },
61
+ title = { SAlsapaca },
62
+ year = 2023,
63
+ url = { https://huggingface.co/hackathon-somos-nlp-2023/salsapaca-native }
64
+ publisher = { Hugging Face }
65
+ }