Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2
|
3 |
+
datasets:
|
4 |
+
- Bluckr/function-calling-assistant-spanish-pofi-v2
|
5 |
+
inference: true
|
6 |
+
language:
|
7 |
+
- es
|
8 |
+
license: mit
|
9 |
+
model_creator: Bluckr
|
10 |
+
model_name: Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2
|
11 |
+
pipeline_tag: text-generation
|
12 |
+
quantized_by: afrideva
|
13 |
+
tags:
|
14 |
+
- nlp
|
15 |
+
- code
|
16 |
+
- phi-3
|
17 |
+
- chat
|
18 |
+
- function-call
|
19 |
+
- gguf
|
20 |
+
- ggml
|
21 |
+
- quantized
|
22 |
+
widget:
|
23 |
+
- messages:
|
24 |
+
- content: '### Input: Que sabes hacer? ### Response:'
|
25 |
+
role: user
|
26 |
+
---
|
27 |
+
|
28 |
+
# Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2-GGUF
|
29 |
+
|
30 |
+
Quantized GGUF model files for [Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2](https://huggingface.co/Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2) from [Bluckr](https://huggingface.co/Bluckr)
|
31 |
+
|
32 |
+
## Original Model Card:
|
33 |
+
|
34 |
+
<div style="text-align: center;">
|
35 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/64beeb8f4b4ff0d5097ddcfc/HF124f84-X7L_rPynRa4n.gif" alt="Pofi" width="300" style="display: block; margin: 0 auto;" />
|
36 |
+
</div>
|
37 |
+
|
38 |
+
Phi 3 adjusted to behave like assistant Pofi, training data works with the function calling method.
|
39 |
+
is a fine-tuned version of ["unsloth/Phi-3-mini-4k-instruct"](https://huggingface.co/unsloth/Phi-3-mini-4k-instruct)
|
40 |
+
Pofi can:
|
41 |
+
|
42 |
+
| Utilities |
|
43 |
+
|-----------------------------|
|
44 |
+
| Setting alarms |
|
45 |
+
| Connecting to the web |
|
46 |
+
| Sending files |
|
47 |
+
| Sending messages |
|
48 |
+
| Saving strings of characters|
|
49 |
+
| Opening applications |
|
50 |
+
| Creating files |
|
51 |
+
| Manipulating the system |
|
52 |
+
|
53 |
+
|
54 |
+
## Simple Inference API
|
55 |
+
```python
|
56 |
+
import requests
|
57 |
+
|
58 |
+
API_URL = "https://api-inference.huggingface.co/models/Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2"
|
59 |
+
headers = {"Authorization": "Bearer %s"%token_id}
|
60 |
+
def query(payload):
|
61 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
62 |
+
print(response.json())
|
63 |
+
|
64 |
+
prompt = """### Input: cómo te llamas? ### Response:"""
|
65 |
+
|
66 |
+
output = query({
|
67 |
+
"inputs": prompt
|
68 |
+
})
|
69 |
+
```
|
70 |
+
# Response
|
71 |
+
```python
|
72 |
+
[{'generated_text': '### Input: cómo te llamas? ### Response: soy Pofi.'}]
|
73 |
+
```
|
74 |
+
|
75 |
+
|
76 |
+
## Unsloth Inference
|
77 |
+
```python
|
78 |
+
%%capture
|
79 |
+
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
|
80 |
+
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
81 |
+
!pip install --no-deps "xformers<0.0.26" trl peft accelerate bitsandbytes
|
82 |
+
```
|
83 |
+
|
84 |
+
```python
|
85 |
+
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
86 |
+
|
87 |
+
### Instruction:
|
88 |
+
{}
|
89 |
+
|
90 |
+
### Input:
|
91 |
+
{}
|
92 |
+
|
93 |
+
### Response:
|
94 |
+
{}"""
|
95 |
+
```
|
96 |
+
|
97 |
+
|
98 |
+
```python
|
99 |
+
from unsloth import FastLanguageModel
|
100 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
101 |
+
model_name = "Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2",
|
102 |
+
max_seq_length = 2048,
|
103 |
+
dtype = None,
|
104 |
+
load_in_4bit = True,
|
105 |
+
)
|
106 |
+
FastLanguageModel.for_inference(model)
|
107 |
+
```
|
108 |
+
|
109 |
+
```python
|
110 |
+
inputs = tokenizer(
|
111 |
+
[
|
112 |
+
alpaca_prompt.format(
|
113 |
+
"""""functions":[{'name': 'fnt_programa', 'description': 'el usuario solicita un programa.', 'parameters': [{'description': 'nombre del programa solicitado.', 'name': 'programa', 'required': True, 'type': 'string'}]},
|
114 |
+
{'name': 'fnt_buscar_web', 'description': 'el usuario solicita una busqueda en internet.', 'parameters': [{'description': 'busqueda especifica.', 'name': 'busqueda', 'required': False, 'type': 'string'}, {'description': 'página especifica para la busqueda', 'name': 'sitio', 'required': False, 'type': 'string'}]},
|
115 |
+
{'name': 'fnt_buscar_lugares', 'description': 'el usuario solicita la ubicación de un lugar.', 'parameters': [{'description': 'lugar especifico.', 'name': 'lugar', 'required': True, 'type': 'string'}, {'description': 'ubicación del lugar', 'name': 'ubicación', 'required': False, 'type': 'string'}]},
|
116 |
+
{'name': 'fnt_enviar_mensajes', 'description': 'el usuario desea enviar un mensaje.', 'parameters': [{'description': 'el usuario especifica a quien enviar el mensaje.', 'name': 'destinatario', 'required': True, 'type': 'string'}, {'description': 'contenido que desea enviar el usuario', 'name': 'mensaje', 'required': True, 'type': 'string'}]},
|
117 |
+
{'name': 'fnt_crear_archivo', 'description': 'el usuario desea crear un archivo.', 'parameters': [{'description': 'el usuario especifica el nombre del archivo.', 'name': 'nombre', 'required': False, 'type': 'string'}, {'description': 'ubicación donde se creará el archivo', 'name': 'ubicación', 'required': False, 'type': 'string'}, {'description': 'extensión del archivo', 'name': 'extensión', 'required': False, 'type': 'string'}]},
|
118 |
+
{'name': 'fnt_establecer_alarma', 'description': 'el usuario desea una alarma o recordatorio', 'parameters': [{'description': 'el usuario especifica el nombre de la alarma.', 'name': 'nombre', 'required': False, 'type': 'string'}, {'description': 'hora de la alarma', 'name': 'hora', 'required': True, 'type': 'string'}, {'description': 'día que se activará la alarma', 'name': 'día', 'required': False, 'type': 'string'}]},
|
119 |
+
{'name': 'fnt_enviar_archivos', 'description': 'el usuario solicita el envio de archivos.', 'parameters': [{'description': 'archivos especificos.', 'name': 'archivos', 'required': True, 'type': 'string'}, {'description': 'destino donde llegarán los archivos', 'name': 'destino', 'required': True, 'type': 'string'}]},
|
120 |
+
{'name': 'fnt_guardar_valores', 'description': 'el usuario solicita almacenar valores.', 'parameters': [{'description': 'valor a almacenar.', 'name': 'valor', 'required': True, 'type': 'string'}, {'description': 'lugar de almacenamiento', 'name': 'lugar', 'required': False, 'type': 'string'}]},
|
121 |
+
{'name': 'fnt_hora', 'description': 'el usuario solicita la hora', 'parameters': [{'description': 'ubicación donde la hora es solicitada.', 'name': 'ubicacion', 'required': True, 'type': 'string'}]},
|
122 |
+
{'name': 'fnt_clima', 'description': 'el usuario solicita el clima', 'parameters': [{'description': 'ubicación donde se solicita el clima.', 'name': 'ubicacion', 'required': True, 'type': 'string'}]},
|
123 |
+
{'name': 'fnt_significado', 'description': 'el usuario solicita el significado de una palabra', 'parameters': [{'description': 'palabra solicitada.', 'name': 'palabra', 'required': True, 'type': 'string'}]},""", # instruction
|
124 |
+
"Pofi envia el archivo de selfie.jpg a drive", # input
|
125 |
+
"", # output - leave this blank for generation!
|
126 |
+
)
|
127 |
+
], return_tensors = "pt").to("cuda")
|
128 |
+
|
129 |
+
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
130 |
+
tokenizer.batch_decode(outputs)
|
131 |
+
```
|
132 |
+
# Response
|
133 |
+
```python
|
134 |
+
Response:\nEnviando el archivo de selfie.jpg a drive.{"function_call":{"name":"fnt_enviar_archivos","arguments":{"archivos":"selfie.jpg","destino":"drive"}}}<|endoftext|>']
|
135 |
+
```
|