Text Generation
Transformers
Safetensors
Catalan
Spanish
English
llama
query-parsing
semantic-search
structured-output
json-generation
multilingual
catalan
spanish
LoRA
fine-tuned
AINA
R&D
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use SIRIS-Lab/impuls-salamandra-7b-query-parser with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SIRIS-Lab/impuls-salamandra-7b-query-parser with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SIRIS-Lab/impuls-salamandra-7b-query-parser") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SIRIS-Lab/impuls-salamandra-7b-query-parser") model = AutoModelForCausalLM.from_pretrained("SIRIS-Lab/impuls-salamandra-7b-query-parser") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SIRIS-Lab/impuls-salamandra-7b-query-parser with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SIRIS-Lab/impuls-salamandra-7b-query-parser" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SIRIS-Lab/impuls-salamandra-7b-query-parser", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SIRIS-Lab/impuls-salamandra-7b-query-parser
- SGLang
How to use SIRIS-Lab/impuls-salamandra-7b-query-parser with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SIRIS-Lab/impuls-salamandra-7b-query-parser" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SIRIS-Lab/impuls-salamandra-7b-query-parser", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SIRIS-Lab/impuls-salamandra-7b-query-parser" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SIRIS-Lab/impuls-salamandra-7b-query-parser", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SIRIS-Lab/impuls-salamandra-7b-query-parser with Docker Model Runner:
docker model run hf.co/SIRIS-Lab/impuls-salamandra-7b-query-parser
File size: 3,794 Bytes
91261b2 | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | {%- set tools = tools if tools is defined else None -%}
{%- set date_string = date_string if date_string is defined else "1 Sep 2024" -%}
{%- set system_message = messages[0].content if messages[0].role == "system" else "" -%}
{%- if messages[0].role == "system" -%}
{%- set messages = messages[1:] -%}
{%- endif -%}
{%- if not tool_prompt -%}
{%- set tool_prompt = "For each function call return a json object with function name and arguments within <tool_call> </tool_call> tags with the following schema:
<tool_call>
{\"name\": <function-name>, \"arguments\": <args-dict>}
</tool_call>" -%}
{%- endif -%}
{%- if system_message or tools -%}
{{- '<|im_start|>system
'}}
{%- endif -%}
{%- if system_message %}
{{- system_message + "
"}}
{%- endif -%}
{%- if tools -%}
{{- "You have function-calling capabilities. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions.
" }}
{{- "<tools>
" }}
{{- tools }}
{{- "
</tools>
" }}
{{- tool_prompt -}}
{%- endif -%}
{%- if system_message or tools -%}
{{- '<|im_end|>
'}}
{%- endif -%}
{# Main message loop #}
{%- for message in messages -%}
{%- if message.role == "user" or message.role == "assistant" or message.role == "tool" -%}
{%- if loop.first and message.role != "user" -%}
{{ raise_exception("Invalid sequence: The first message role must be 'user' after 'system' if provided .") }}
{%- endif -%}
{%- if not loop.first and message.role in ["user", "assistant"] and message.role == loop.previtem.role -%}
{{ raise_exception("Invalid sequence: Consecutive messages cannot have the same role ('user' or 'assistant').") }}
{%- endif -%}
{%- if message.role == "user" and not loop.first and loop.previtem.role != "assistant" -%}
{{ raise_exception("Invalid sequence: A 'user' message must be preceded by an 'assistant' message.") }}
{%- endif -%}
{%- if message.role == "tool" and not loop.first and loop.previtem.role not in ["assistant", "tool"] -%}
{{ raise_exception("Invalid sequence: A 'tool' message must be preceded by 'assistant' or 'tool'.") }}
{%- endif -%}
{%- else -%}
{{- raise_exception("Invalid role detected: only 'user', 'assistant', or 'tool' roles are accepted.") }}
{%- endif -%}
{%- if message.role == "user" or (message.role == "assistant" and message.tool_calls is not defined) -%}
{{- '<|im_start|>' + message.role + '
' + message.content | trim + '<|im_end|>
'}}
{%- elif message.role == "assistant" -%}
{{- '<|im_start|>' + message.role }}
{%- for tool_call in message.tool_calls -%}
{{ '
<tool_call>
' }}
{%- if tool_call.function -%}
{"name": "{{ tool_call.function.name }}", "arguments": {{ tool_call.function.arguments | tojson }} }
{%- else -%}
{"name": "{{ tool_call.name }}", "arguments": {{ tool_call.arguments | tojson }} }
{%- endif -%}
{{ '
</tool_call>' }}
{%- endfor -%}
{{- '<|im_end|>
' }}
{%- elif message.role == "tool" -%}
{%- if loop.previtem and loop.previtem.role != "tool" -%}
{{- '<|im_start|>tool
' }}
{%- endif -%}
{{- '<tool_response>
' }}
{{- message.content }}
{{- '
</tool_response>
' }}
{%- if loop.last or loop.nextitem.role != "tool" -%}
{{- '<|im_end|>
'}}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{# Prompt for assistant generation if needed #}
{%- if add_generation_prompt -%}
{{- '<|im_start|>assistant
' }}
{%- endif -%} |