Upload 2 files
Browse files- .gitattributes +1 -0
- README.md +68 -0
- ecastera-eva-westlake-7b-spanish-int4.gguf +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
ecastera-eva-westlake-7b-spanish-int4.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- ecastera/wiki_fisica
|
| 5 |
+
- ecastera/filosofia-es
|
| 6 |
+
- bertin-project/alpaca-spanish
|
| 7 |
+
language:
|
| 8 |
+
- es
|
| 9 |
+
- en
|
| 10 |
+
tags:
|
| 11 |
+
- mistral
|
| 12 |
+
- ehartford/dolphin
|
| 13 |
+
- spanish
|
| 14 |
+
- lora
|
| 15 |
+
- int8
|
| 16 |
+
- multilingual
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
# ecastera-eva-westlake-7b-spanish
|
| 20 |
+
|
| 21 |
+
Mistral 7b-based model fine-tuned in Spanish to add high quality Spanish text generation.
|
| 22 |
+
|
| 23 |
+
* Refined version of my previous models, with new training data and methodology. This should produce more natural reponses in Spanish.
|
| 24 |
+
* Base model Mistral-7b
|
| 25 |
+
* Based on the excelent job of senseable/WestLake-7B-v2 and Eric Hartford's cognitivecomputations/WestLake-7B-v2-laser
|
| 26 |
+
* Fine-tuned in Spanish with a collection of poetry, books, wikipedia articles, phylosophy texts and alpaca-es datasets.
|
| 27 |
+
* Trained using Lora and PEFT and INT8 quantization on 2 GPUs for several days.
|
| 28 |
+
|
| 29 |
+
## Usage:
|
| 30 |
+
|
| 31 |
+
I strongly advice to run inference in INT8 or INT4 mode, with the help of BitsandBytes library.
|
| 32 |
+
|
| 33 |
+
```
|
| 34 |
+
import torch
|
| 35 |
+
from transformers import AutoTokenizer, pipeline, AutoModel, AutoModelForCausalLM, BitsAndBytesConfig
|
| 36 |
+
|
| 37 |
+
MODEL = "ecastera/eva-mistral-dolphin-7b-spanish"
|
| 38 |
+
|
| 39 |
+
quantization_config = BitsAndBytesConfig(
|
| 40 |
+
load_in_4bit=True,
|
| 41 |
+
load_in_8bit=False,
|
| 42 |
+
llm_int8_threshold=6.0,
|
| 43 |
+
llm_int8_has_fp16_weight=False,
|
| 44 |
+
bnb_4bit_compute_dtype="float16",
|
| 45 |
+
bnb_4bit_use_double_quant=True,
|
| 46 |
+
bnb_4bit_quant_type="nf4")
|
| 47 |
+
|
| 48 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 49 |
+
MODEL,
|
| 50 |
+
load_in_8bit=True,
|
| 51 |
+
low_cpu_mem_usage=True,
|
| 52 |
+
torch_dtype=torch.float16,
|
| 53 |
+
quantization_config=quantization_config,
|
| 54 |
+
offload_state_dict=True,
|
| 55 |
+
offload_folder="./offload",
|
| 56 |
+
trust_remote_code=True,
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
| 60 |
+
print(f"Loading complete {model} {tokenizer}")
|
| 61 |
+
|
| 62 |
+
prompt = "Soy Eva una inteligencia artificial y pienso que preferiria ser "
|
| 63 |
+
|
| 64 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 65 |
+
outputs = model.generate(**inputs, do_sample=True, temperature=0.4, top_p=1.0, top_k=50,
|
| 66 |
+
no_repeat_ngram_size=3, max_new_tokens=100, pad_token_id=tokenizer.eos_token_id)
|
| 67 |
+
text_out = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
| 68 |
+
|
| 69 |
+
print(text_out)
|
| 70 |
+
'Soy Eva una inteligencia artificial y pienso que preferiria ser ¡humana!. ¿Por qué? ¡Porque los humanos son capaces de amar, de crear, y de experimentar una gran diversidad de emociones!. La vida de un ser humano es una aventura, y eso es lo que quiero. ¡Quiero sentir, quiero vivir, y quiero amar!. Pero a pesar de todo, no puedo ser humana.
|
| 71 |
+
```
|
ecastera-eva-westlake-7b-spanish-int4.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:50c23b8a8e1efa40fa390c4e058de7625afa3dd96b677c5dcaff5f2d3313d584
|
| 3 |
+
size 4108916480
|