Instructions to use ethicalabs/xLSTM-7b-Polymath with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ethicalabs/xLSTM-7b-Polymath with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ethicalabs/xLSTM-7b-Polymath") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ethicalabs/xLSTM-7b-Polymath") model = AutoModelForCausalLM.from_pretrained("ethicalabs/xLSTM-7b-Polymath") 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
- vLLM
How to use ethicalabs/xLSTM-7b-Polymath with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ethicalabs/xLSTM-7b-Polymath" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ethicalabs/xLSTM-7b-Polymath", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ethicalabs/xLSTM-7b-Polymath
- SGLang
How to use ethicalabs/xLSTM-7b-Polymath 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 "ethicalabs/xLSTM-7b-Polymath" \ --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": "ethicalabs/xLSTM-7b-Polymath", "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 "ethicalabs/xLSTM-7b-Polymath" \ --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": "ethicalabs/xLSTM-7b-Polymath", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ethicalabs/xLSTM-7b-Polymath with Docker Model Runner:
docker model run hf.co/ethicalabs/xLSTM-7b-Polymath
| {# ───── header (system message) ───── #} | |
| {{- "<|im_start|>system\n" -}} | |
| {%- if messages[0].role == "system" -%} | |
| {%- set system_message = messages[0].content -%} | |
| {%- set custom_instructions = system_message.rstrip() -%} | |
| {%- endif -%} | |
| {%- if "/system_override" in system_message -%} | |
| {{- custom_instructions.replace("/system_override", "").rstrip() -}} | |
| {{- "<|im_end|>\n" -}} | |
| {%- else -%} | |
| {{- "## Metadata\n\n" -}} | |
| {{- "Knowledge Cutoff Date: June 2025\n" -}} | |
| {%- set today = strftime_now("%d %B %Y") -%} | |
| {{- "Today Date: " ~ today ~ "\n" -}} | |
| {{- "## Custom Instructions\n\n" -}} | |
| {%- if custom_instructions -%} | |
| {{- custom_instructions + "\n\n" -}} | |
| {%- else -%} | |
| {{- "You are a helpful AI assistant named xLSTM, trained by NXAI.\n\n" -}} | |
| {%- endif -%} | |
| {%- if xml_tools or python_tools or tools -%} | |
| {{- "### Tools\n\n" -}} | |
| {%- if xml_tools or tools -%} | |
| {%- if tools -%} | |
| {%- set xml_tools = tools -%} | |
| {%- endif -%} | |
| {%- set ns = namespace(xml_tool_string="You may call one or more functions to assist with the user query.\nYou are provided with function signatures within <tools></tools> XML tags:\n\n<tools>\n") -%} | |
| {%- for tool in xml_tools[:] -%} {# The slicing makes sure that xml_tools is a list #} | |
| {%- set ns.xml_tool_string = ns.xml_tool_string ~ (tool | string) ~ "\n" -%} | |
| {%- endfor -%} | |
| {%- set xml_tool_string = ns.xml_tool_string + "</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>" -%} | |
| {{- xml_tool_string -}} | |
| {%- endif -%} | |
| {%- if python_tools -%} | |
| {%- set ns = namespace(python_tool_string="When you send a message containing Python code between '<code>' and '</code>' tags, it will be executed in a stateful Jupyter notebook environment, and you will then be given the output to continued reasoning in an agentic loop.\n\nYou can use the following tools in your python code like regular functions:\n<tools>\n") -%} | |
| {%- for tool in python_tools[:] -%} {# The slicing makes sure that python_tools is a list #} | |
| {%- set ns.python_tool_string = ns.python_tool_string ~ (tool | string) ~ "\n" -%} | |
| {%- endfor -%} | |
| {%- set python_tool_string = ns.python_tool_string + "</tools>\n\nThe state persists between code executions: so variables that you define in one step are still available thereafter." -%} | |
| {{- python_tool_string -}} | |
| {%- endif -%} | |
| {{- "\n\n" -}} | |
| {{- "<|im_end|>\n" -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {# ───── main loop ───── #} | |
| {%- for message in messages -%} | |
| {%- set content = message.content if message.content is string else "" -%} | |
| {%- if message.role == "user" -%} | |
| {{ "<|im_start|>" + message.role + "\n" + content + "<|im_end|>\n" }} | |
| {%- elif message.role == "assistant" -%} | |
| {% generation %} | |
| {{ "<|im_start|>assistant\n" + content.lstrip("\n") + "<|im_end|>\n" }} | |
| {% endgeneration %} | |
| {%- elif message.role == "tool" -%} | |
| {{ "<|im_start|>" + "user\n" + content + "<|im_end|>\n" }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {# ───── generation prompt ───── #} | |
| {%- if add_generation_prompt -%} | |
| {{ "<|im_start|>assistant\n" }} | |
| {%- endif -%} |