Instructions to use madhuHuggingface/functiongemma-ec2-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use madhuHuggingface/functiongemma-ec2-finetuned with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("madhuHuggingface/functiongemma-ec2-finetuned", dtype="auto") - llama-cpp-python
How to use madhuHuggingface/functiongemma-ec2-finetuned with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="madhuHuggingface/functiongemma-ec2-finetuned", filename="gguf/functiongemma-270m-it.Q8_0.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use madhuHuggingface/functiongemma-ec2-finetuned with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0 # Run inference directly in the terminal: llama-cli -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0 # Run inference directly in the terminal: llama-cli -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Use Docker
docker model run hf.co/madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
- LM Studio
- Jan
- Ollama
How to use madhuHuggingface/functiongemma-ec2-finetuned with Ollama:
ollama run hf.co/madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
- Unsloth Studio new
How to use madhuHuggingface/functiongemma-ec2-finetuned with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for madhuHuggingface/functiongemma-ec2-finetuned to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for madhuHuggingface/functiongemma-ec2-finetuned to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for madhuHuggingface/functiongemma-ec2-finetuned to start chatting
- Pi new
How to use madhuHuggingface/functiongemma-ec2-finetuned with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "madhuHuggingface/functiongemma-ec2-finetuned:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use madhuHuggingface/functiongemma-ec2-finetuned with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Run Hermes
hermes
- Docker Model Runner
How to use madhuHuggingface/functiongemma-ec2-finetuned with Docker Model Runner:
docker model run hf.co/madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
- Lemonade
How to use madhuHuggingface/functiongemma-ec2-finetuned with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull madhuHuggingface/functiongemma-ec2-finetuned:Q8_0
Run and chat with the model
lemonade run user.functiongemma-ec2-finetuned-Q8_0
List all available models
lemonade list
| {%- macro format_parameters(properties, required) -%} | |
| {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%} | |
| {%- set ns = namespace(found_first=false) -%} | |
| {%- for key, value in properties | dictsort -%} | |
| {%- if key not in standard_keys -%} | |
| {%- if ns.found_first %},{% endif -%} | |
| {%- set ns.found_first = true -%} | |
| {{- key }}:{description:<escape>{{ value['description'] }}<escape> | |
| {%- if value['type'] | upper == 'STRING' -%} | |
| {%- if value['enum'] -%} | |
| ,enum:{{ format_argument(value['enum']) }} | |
| {%- endif -%} | |
| {%- elif value['type'] | upper == 'OBJECT' -%} | |
| ,properties:{ | |
| {%- if value['properties'] is defined and value['properties'] is mapping -%} | |
| {{- format_parameters(value['properties'], value['required'] | default([])) -}} | |
| {%- elif value is mapping -%} | |
| {{- format_parameters(value, value['required'] | default([])) -}} | |
| {%- endif -%} | |
| } | |
| {%- if value['required'] -%} | |
| ,required:[ | |
| {%- for item in value['required'] | default([]) -%} | |
| <escape>{{- item -}}<escape> | |
| {%- if not loop.last %},{% endif -%} | |
| {%- endfor -%} | |
| ] | |
| {%- endif -%} | |
| {%- elif value['type'] | upper == 'ARRAY' -%} | |
| {%- if value['items'] is mapping and value['items'] -%} | |
| ,items:{ | |
| {%- set ns_items = namespace(found_first=false) -%} | |
| {%- for item_key, item_value in value['items'] | dictsort -%} | |
| {%- if item_value is not none -%} | |
| {%- if ns_items.found_first %},{% endif -%} | |
| {%- set ns_items.found_first = true -%} | |
| {%- if item_key == 'properties' -%} | |
| properties:{ | |
| {%- if item_value is mapping -%} | |
| {{- format_parameters(item_value, value['items']['required'] | default([])) -}} | |
| {%- endif -%} | |
| } | |
| {%- elif item_key == 'required' -%} | |
| required:[ | |
| {%- for req_item in item_value -%} | |
| <escape>{{- req_item -}}<escape> | |
| {%- if not loop.last %},{% endif -%} | |
| {%- endfor -%} | |
| ] | |
| {%- elif item_key == 'type' -%} | |
| {%- if item_value is string -%} | |
| type:{{ format_argument(item_value | upper) }} | |
| {%- else -%} | |
| type:{{ format_argument(item_value | map('upper') | list) }} | |
| {%- endif -%} | |
| {%- else -%} | |
| {{ item_key }}:{{ format_argument(item_value) }} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| } | |
| {%- endif -%} | |
| {%- endif -%} | |
| ,type:<escape>{{ value['type'] | upper }}<escape>} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endmacro -%} | |
| {% macro format_function_declaration(tool_data) -%} | |
| declaration:{{- tool_data['function']['name'] -}} | |
| {description:<escape>{{- tool_data['function']['description'] -}}<escape> | |
| {%- set params = tool_data['function']['parameters'] -%} | |
| {%- if params -%} | |
| ,parameters:{ | |
| {%- if params['properties'] -%} | |
| properties:{ {{- format_parameters(params['properties'], params['required']) -}} }, | |
| {%- endif -%} | |
| {%- if params['required'] -%} | |
| required:[ | |
| {%- for item in params['required'] -%} | |
| <escape>{{- item -}}<escape> | |
| {{- ',' if not loop.last -}} | |
| {%- endfor -%} | |
| ], | |
| {%- endif -%} | |
| {%- if params['type'] -%} | |
| type:<escape>{{- params['type'] | upper -}}<escape>} | |
| {%- endif -%} | |
| {%- endif -%} | |
| } | |
| {%- endmacro -%} | |
| {% macro format_argument(argument, escape_keys=True) -%} | |
| {%- if argument is string -%} | |
| {{- '<escape>' + argument + '<escape>' -}} | |
| {%- elif argument is boolean -%} | |
| {%- if argument -%} | |
| {{- 'true' -}} | |
| {%- else -%} | |
| {{- 'false' -}} | |
| {%- endif -%} | |
| {%- elif argument is mapping -%} | |
| {{- '{' -}} | |
| {%- set ns = namespace(found_first=false) -%} | |
| {%- for key, value in argument | dictsort -%} | |
| {%- if ns.found_first %},{% endif -%} | |
| {%- set ns.found_first = true -%} | |
| {%- if escape_keys -%} | |
| {{- '<escape>' + key + '<escape>' -}} | |
| {%- else -%} | |
| {{- key -}} | |
| {%- endif -%} | |
| :{{- format_argument(value, escape_keys=escape_keys) -}} | |
| {%- endfor -%} | |
| {{- '}' -}} | |
| {%- elif argument is sequence -%} | |
| {{- '[' -}} | |
| {%- for item in argument -%} | |
| {{- format_argument(item, escape_keys=escape_keys) -}} | |
| {%- if not loop.last %},{% endif -%} | |
| {%- endfor -%} | |
| {{- ']' -}} | |
| {%- else -%} | |
| {{- argument -}} | |
| {%- endif -%} | |
| {%- endmacro -%} | |
| {{ bos_token }} | |
| {%- set ns = namespace(prev_message_type=None) -%} | |
| {#- Tool Declarations -#} | |
| {%- set loop_messages = messages -%} | |
| {%- if tools or messages[0]['role'] == 'system' or messages[0]['role'] == 'developer' -%} | |
| {{- '<start_of_turn>developer\n' -}} | |
| {%- if messages[0]['role'] == 'system' or messages[0]['role'] == 'developer' -%} | |
| {%- if messages[0]['content'] is string -%} | |
| {{- messages[0]['content'] | trim -}} | |
| {%- elif messages[0]['content'] is sequence -%} | |
| {%- for item in messages[0]['content'] -%} | |
| {%- if item['type'] == 'text' -%} | |
| {{- item['text'] | trim -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {%- set loop_messages = messages[1:] -%} | |
| {%- else -%} | |
| {{- 'You are a model that can do function calling with the following functions' -}} | |
| {%- set loop_messages = messages -%} | |
| {%- endif -%} | |
| {%- if tools -%} | |
| {%- for tool in tools %} | |
| {{- '<start_function_declaration>' -}} | |
| {{- format_function_declaration(tool) | trim }} | |
| {{- '<end_function_declaration>' -}} | |
| {%- endfor %} | |
| {%- endif -%} | |
| {{- '<end_of_turn>\n' }} | |
| {%- endif %} | |
| {#- Loop through messages. -#} | |
| {%- for message in loop_messages -%} | |
| {%- if (message['role'] == 'assistant') -%} | |
| {#- Rename "assistant" to "model". -#} | |
| {%- set role = "model" -%} | |
| {%- else -%} | |
| {%- set role = message['role'] -%} | |
| {%- endif -%} | |
| {%- if role != 'tool' -%} | |
| {%- if ns.prev_message_type != 'tool_response' -%} | |
| {{- '<start_of_turn>' + role + '\n' }} | |
| {%- endif -%} | |
| {%- set ns.prev_message_type = None -%} | |
| {%- if 'content' in message and message['content'] is not none -%} | |
| {%- if message['content'] is string -%} | |
| {{ message['content'] | trim }} | |
| {%- elif message['content'] is sequence -%} | |
| {%- for item in message['content'] -%} | |
| {%- if item['type'] == 'image' -%} | |
| {{ '<start_of_image>' }} | |
| {%- elif item['type'] == 'text' -%} | |
| {{ item['text'] | trim }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- else -%} | |
| {{ raise_exception("Invalid content type in user/assistant message") }} | |
| {%- endif -%} | |
| {%- set ns.prev_message_type = 'content' -%} | |
| {%- endif -%} | |
| {%- if 'tool_calls' in message and message['tool_calls'] and message['tool_calls'] is iterable -%} | |
| {#- Tool Calls -#} | |
| {%- for tool_call in message['tool_calls'] -%} | |
| {% set function = tool_call['function'] %} | |
| {{- '<start_function_call>call:' + function['name'] + '{' -}} | |
| {%- if 'arguments' in function -%} | |
| {%- if function['arguments'] is mapping -%} | |
| {%- set ns = namespace(found_first=false) -%} | |
| {%- for key, value in function['arguments'] | dictsort -%} | |
| {%- if ns.found_first %},{% endif -%} | |
| {%- set ns.found_first = true -%} | |
| {{- key -}}:{{- format_argument(value, escape_keys=False) -}} | |
| {%- endfor -%} | |
| {%- elif function['arguments'] is string -%} | |
| {# This handles string-JSON, just in case #} | |
| {{ function['arguments'] }} | |
| {%- endif %} | |
| {%- endif -%} | |
| {{- '}<end_function_call>' -}} | |
| {%- endfor -%} | |
| {%- if loop.last -%} | |
| {{ '<start_function_response>' }} | |
| {%- endif -%} | |
| {%- set ns.prev_message_type = 'tool_call' -%} | |
| {%- endif -%} | |
| {%- else -%} | |
| {#- Tool Responses -#} | |
| {%- if 'content' in message and message['content'] -%} | |
| {%- if message['content'] is mapping -%} | |
| {%- if 'name' in message['content'] and 'response' in message['content'] -%} | |
| {{ '<start_function_response>response:' + message['content']['name'] | trim + '{' }} | |
| {%- set response_ns = namespace(found_first=false) -%} | |
| {%- for key, value in message['content']['response'] | dictsort -%} | |
| {%- if response_ns.found_first %},{% endif -%} | |
| {%- set response_ns.found_first = true -%} | |
| {{- key -}}:{{- format_argument(value, escape_keys=False) -}} | |
| {%- endfor -%} | |
| {{- '}<end_function_response>' -}} | |
| {%- elif 'name' in message -%} | |
| {{ '<start_function_response>response:' + message['name'] | trim + '{' }} | |
| {%- set response_ns = namespace(found_first=false) -%} | |
| {%- for key, value in message['content'] | dictsort -%} | |
| {%- if response_ns.found_first %},{% endif -%} | |
| {%- set response_ns.found_first = true -%} | |
| {{- key -}}:{{- format_argument(value, escape_keys=False) -}} | |
| {%- endfor -%} | |
| {{- '}<end_function_response>' -}} | |
| {%- else -%} | |
| {{ raise_exception("Invalid tool response mapping: must contain 'name' and 'response' keys, or 'name' must be in the message.") }} | |
| {%- endif -%} | |
| {%- elif message['content'] is string -%} | |
| {%- if 'name' in message -%} | |
| {{ '<start_function_response>response:' + message['name'] | trim + '{value:' + format_argument(message['content'], escape_keys=False) + '}<end_function_response>' }} | |
| {%- else -%} | |
| {{ raise_exception("Invalid tool response: 'name' must be provided.") }} | |
| {%- endif -%} | |
| {%- elif message['content'] is sequence -%} | |
| {%- for item in message['content'] -%} | |
| {%- if item is mapping -%} | |
| {%- if 'name' in item and 'response' in item -%} | |
| {{ '<start_function_response>response:' + item['name'] | trim + '{' }} | |
| {%- set response_ns = namespace(found_first=false) -%} | |
| {%- for key, value in item['response'] | dictsort -%} | |
| {%- if response_ns.found_first %},{% endif -%} | |
| {%- set response_ns.found_first = true -%} | |
| {{- key -}}:{{- format_argument(value, escape_keys=False) -}} | |
| {%- endfor -%} | |
| {{- '}<end_function_response>' -}} | |
| {%- elif 'name' in message -%} | |
| {{ '<start_function_response>response:' + message['name'] | trim + '{' }} | |
| {%- set response_ns = namespace(found_first=false) -%} | |
| {%- for key, value in item | dictsort -%} | |
| {%- if response_ns.found_first %},{% endif -%} | |
| {%- set response_ns.found_first = true -%} | |
| {{- key -}}:{{- format_argument(value, escape_keys=False) -}} | |
| {%- endfor -%} | |
| {{- '}<end_function_response>' -}} | |
| {%- else -%} | |
| {{ raise_exception("Invalid tool response mapping: must contain 'name' and 'response' keys, or 'name' must be in the message.") }} | |
| {%- endif -%} | |
| {%- else -%} | |
| {{ raise_exception("Invalid tool response message: multiple responses must all be mappings") }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- else -%} | |
| {{ raise_exception("Invalid content type in tool message: must be mapping, sequence of mappings, or string.") }} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- set ns.prev_message_type = 'tool_response' -%} | |
| {%- endif -%} | |
| {%- if ns.prev_message_type not in ['tool_call', 'tool_response'] -%} | |
| {{ '<end_of_turn>\n' }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if add_generation_prompt -%} | |
| {%- if ns.prev_message_type != 'tool_response' -%} | |
| {{- '<start_of_turn>model\n' -}} | |
| {%- endif -%} | |
| {%- endif -%} | |