初始化项目,由ModelHub XC社区提供模型
Model: afrideva/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2-GGUF Source: Original Platform
This commit is contained in:
135
README.md
Normal file
135
README.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
base_model: Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2
|
||||
datasets:
|
||||
- Bluckr/function-calling-assistant-spanish-pofi-v2
|
||||
inference: true
|
||||
language:
|
||||
- es
|
||||
license: mit
|
||||
model_creator: Bluckr
|
||||
model_name: Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2
|
||||
pipeline_tag: text-generation
|
||||
quantized_by: afrideva
|
||||
tags:
|
||||
- nlp
|
||||
- code
|
||||
- phi-3
|
||||
- chat
|
||||
- function-call
|
||||
- gguf
|
||||
- ggml
|
||||
- quantized
|
||||
widget:
|
||||
- messages:
|
||||
- content: '### Input: Que sabes hacer? ### Response:'
|
||||
role: user
|
||||
---
|
||||
|
||||
# Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2-GGUF
|
||||
|
||||
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)
|
||||
|
||||
## Original Model Card:
|
||||
|
||||
<div style="text-align: center;">
|
||||
<img src="https://cdn-uploads.huggingface.co/production/uploads/64beeb8f4b4ff0d5097ddcfc/HF124f84-X7L_rPynRa4n.gif" alt="Pofi" width="300" style="display: block; margin: 0 auto;" />
|
||||
</div>
|
||||
|
||||
Phi 3 adjusted to behave like assistant Pofi, training data works with the function calling method.
|
||||
is a fine-tuned version of ["unsloth/Phi-3-mini-4k-instruct"](https://huggingface.co/unsloth/Phi-3-mini-4k-instruct)
|
||||
Pofi can:
|
||||
|
||||
| Utilities |
|
||||
|-----------------------------|
|
||||
| Setting alarms |
|
||||
| Connecting to the web |
|
||||
| Sending files |
|
||||
| Sending messages |
|
||||
| Saving strings of characters|
|
||||
| Opening applications |
|
||||
| Creating files |
|
||||
| Manipulating the system |
|
||||
|
||||
|
||||
## Simple Inference API
|
||||
```python
|
||||
import requests
|
||||
|
||||
API_URL = "https://api-inference.huggingface.co/models/Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2"
|
||||
headers = {"Authorization": "Bearer %s"%token_id}
|
||||
def query(payload):
|
||||
response = requests.post(API_URL, headers=headers, json=payload)
|
||||
print(response.json())
|
||||
|
||||
prompt = """### Input: cómo te llamas? ### Response:"""
|
||||
|
||||
output = query({
|
||||
"inputs": prompt
|
||||
})
|
||||
```
|
||||
# Response
|
||||
```python
|
||||
[{'generated_text': '### Input: cómo te llamas? ### Response: soy Pofi.'}]
|
||||
```
|
||||
|
||||
|
||||
## Unsloth Inference
|
||||
```python
|
||||
%%capture
|
||||
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
|
||||
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
||||
!pip install --no-deps "xformers<0.0.26" trl peft accelerate bitsandbytes
|
||||
```
|
||||
|
||||
```python
|
||||
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.
|
||||
|
||||
### Instruction:
|
||||
{}
|
||||
|
||||
### Input:
|
||||
{}
|
||||
|
||||
### Response:
|
||||
{}"""
|
||||
```
|
||||
|
||||
|
||||
```python
|
||||
from unsloth import FastLanguageModel
|
||||
model, tokenizer = FastLanguageModel.from_pretrained(
|
||||
model_name = "Bluckr/Phi-3-mini-4k-instruct-function-calling-assistant-spanish-pofi-v2",
|
||||
max_seq_length = 2048,
|
||||
dtype = None,
|
||||
load_in_4bit = True,
|
||||
)
|
||||
FastLanguageModel.for_inference(model)
|
||||
```
|
||||
|
||||
```python
|
||||
inputs = tokenizer(
|
||||
[
|
||||
alpaca_prompt.format(
|
||||
"""""functions":[{'name': 'fnt_programa', 'description': 'el usuario solicita un programa.', 'parameters': [{'description': 'nombre del programa solicitado.', 'name': 'programa', 'required': True, 'type': 'string'}]},
|
||||
{'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'}]},
|
||||
{'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'}]},
|
||||
{'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'}]},
|
||||
{'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'}]},
|
||||
{'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'}]},
|
||||
{'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'}]},
|
||||
{'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'}]},
|
||||
{'name': 'fnt_hora', 'description': 'el usuario solicita la hora', 'parameters': [{'description': 'ubicación donde la hora es solicitada.', 'name': 'ubicacion', 'required': True, 'type': 'string'}]},
|
||||
{'name': 'fnt_clima', 'description': 'el usuario solicita el clima', 'parameters': [{'description': 'ubicación donde se solicita el clima.', 'name': 'ubicacion', 'required': True, 'type': 'string'}]},
|
||||
{'name': 'fnt_significado', 'description': 'el usuario solicita el significado de una palabra', 'parameters': [{'description': 'palabra solicitada.', 'name': 'palabra', 'required': True, 'type': 'string'}]},""", # instruction
|
||||
"Pofi envia el archivo de selfie.jpg a drive", # input
|
||||
"", # output - leave this blank for generation!
|
||||
)
|
||||
], return_tensors = "pt").to("cuda")
|
||||
|
||||
outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = True)
|
||||
tokenizer.batch_decode(outputs)
|
||||
```
|
||||
# Response
|
||||
```python
|
||||
Response:\nEnviando el archivo de selfie.jpg a drive.{"function_call":{"name":"fnt_enviar_archivos","arguments":{"archivos":"selfie.jpg","destino":"drive"}}}<|endoftext|>']
|
||||
```
|
||||
Reference in New Issue
Block a user