Text Generation
PEFT
Safetensors
English
gemma
gemma-4
lora
unsloth
litertlm
on-device
function-calling
tool-use
mobile
flutter
Instructions to use jtmuller/roadside-gemma-e2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use jtmuller/roadside-gemma-e2b with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
Upload folder using huggingface_hub
Browse filesFiles changed (7)
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textlora-adapter/tokenizer.json filter=lfs diff=lfs merge=lfs -text
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{ "alora_invocation_tokens": null, "alpha_pattern": {}, "arrow_config": null, "auto_mapping": { "base_model_class": "Gemma4ForConditionalGeneration", "parent_library": "transformers.models.gemma4.modeling_gemma4", "unsloth_fixed": true }, "base_model_name_or_path": "unsloth/gemma-4-E2B-it", "bias": "none", "corda_config": null, "ensure_weight_tying": false, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": true, "init_lora_weights": true, "layer_replication": null, "layers_pattern": null, "layers_to_transform": null, "loftq_config": {}, "lora_alpha": 128, "lora_bias": false, "lora_dropout": 0.0, "lora_ga_config": null, "megatron_config": null, "megatron_core": "megatron.core", "modules_to_save": null, "peft_type": "LORA", "peft_version": "0.19.1", "qalora_group_size": 16, "r": 128, "rank_pattern": {}, "revision": null, "target_modules": [ "up_proj", "down_proj", "gate_proj", "v_proj", "q_proj", "o_proj", "k_proj" ], "target_parameters": null, "task_type": "CAUSAL_LM", "trainable_token_indices": null, "use_bdlora": null, "use_dora": false, "use_qalora": false, "use_rslora": false}123version https://git-lfs.github.com/spec/v1oid sha256:960b73cadfed30e4e1ae1c27e7594a6b0228c26492190b55d0c672567213bd39size 993385184123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266{%- 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 -%} {%- set add_comma = false -%} {%- if key not in standard_keys -%} {%- if ns.found_first %},{% endif -%} {%- set ns.found_first = true -%} {{ key }}:{ {%- if value['description'] -%} description:<|"|>{{ value['description'] }}<|"|> {%- set add_comma = true -%} {%- endif -%} {%- if value['nullable'] %} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} nullable:true {%- endif -%} {%- if value['type'] | upper == 'STRING' -%} {%- if value['enum'] -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} 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([]) -%} <|"|>{{- item -}}<|"|> {%- 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 -%} <|"|>{{- req_item -}}<|"|> {%- 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 -%} {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%} type:<|"|>{{ value['type'] | upper }}<|"|>} {%- endif -%} {%- endfor -%}{%- endmacro -%}{%- macro format_function_declaration(tool_data) -%} declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|> {%- 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'] -%} <|"|>{{- item -}}<|"|> {{- ',' if not loop.last -}} {%- endfor -%} ], {%- endif -%} {%- if params['type'] -%} type:<|"|>{{- params['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} {%- if 'response' in tool_data['function'] -%} {%- set response_declaration = tool_data['function']['response'] -%} ,response:{ {%- if response_declaration['description'] -%} description:<|"|>{{- response_declaration['description'] -}}<|"|>, {%- endif -%} {%- if response_declaration['type'] | upper == 'OBJECT' -%} type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>} {%- endif -%} {%- endif -%} }{%- endmacro -%}{%- macro format_argument(argument, escape_keys=True) -%} {%- if argument is string -%} {{- '<|"|>' + argument + '<|"|>' -}} {%- elif argument is boolean -%} {{- 'true' if argument else 'false' -}} {%- 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 -%} {{- '<|"|>' + key + '<|"|>' -}} {%- 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 -%}{%- macro strip_thinking(text) -%} {%- set ns = namespace(result='') -%} {%- for part in text.split('<channel|>') -%} {%- if '<|channel>' in part -%} {%- set ns.result = ns.result + part.split('<|channel>')[0] -%} {%- else -%} {%- set ns.result = ns.result + part -%} {%- endif -%} {%- endfor -%} {{- ns.result | trim -}}{%- endmacro -%}
{%- set ns = namespace(prev_message_type=None) -%}{%- set loop_messages = messages -%}{{ bos_token }}{#- Handle System/Tool Definitions Block -#}{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%} {{- '<|turn>system\n' -}}
{#- Inject Thinking token at the very top of the FIRST system turn -#} {%- if enable_thinking is defined and enable_thinking -%} {{- '<|think|>' -}} {%- endif -%}
{%- if messages[0]['role'] in ['system', '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:] -%} {%- endif -%}
{%- if tools -%} {{- '\n\n' -}} {%- for tool in tools %} {{- '<|tool>' -}} {{- format_function_declaration(tool) | trim -}} {{- '<tool|>' -}} {%- endfor %} {%- endif -%}
{{- '<turn|>\n' -}}{%- endif %}
{#- Loop through messages -#}{%- for message in loop_messages -%} {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%} {%- if role != 'tool' -%} {{- '<|turn>' + role + '\n' }} {%- endif -%}
{%- if message['tool_calls'] -%} {%- for tool_call in message['tool_calls'] -%} {%- set function = tool_call['function'] -%} {{- '<|tool_call>call:' + function['name'] + '{' -}} {%- if function['arguments'] is mapping -%} {%- set ns_args = namespace(found_first=false) -%} {%- for key, value in function['arguments'] | dictsort -%} {%- if ns_args.found_first %},{% endif -%} {%- set ns_args.found_first = true -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- endfor -%} {%- elif function['arguments'] is string -%} {{- function['arguments'] -}} {%- endif -%} {{- '}<tool_call|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_call' -%} {%- endif -%}
{%- if role == 'tool' and message['content'] is sequence -%} {#- Tool Response handling -#} {%- for item in message['content'] -%} {{- '<|tool_response>' -}} {%- if item['response'] is mapping -%} {{- 'response:' + item['name'] | default('unknown') + '{' -}} {%- for key, value in item['response'] | dictsort -%} {{- key -}}:{{- format_argument(value, escape_keys=False) -}} {%- if not loop.last %},{% endif -%} {%- endfor -%} {{- '}' -}} {%- else -%} {{- 'response:' + item['name'] | default('unknown') + '{value:' + format_argument(item['response'], escape_keys=False) + '}' -}} {%- endif -%} {{- '<tool_response|>' -}} {%- endfor -%} {%- set ns.prev_message_type = 'tool_response' -%} {%- else -%} {%- if message['content'] is string -%} {%- if role == 'model' -%} {{- strip_thinking(message['content']) -}} {%- else -%} {{- message['content'] | trim -}} {%- endif -%} {%- elif message['content'] is sequence -%} {%- for item in message['content'] -%} {%- if item['type'] == 'text' -%} {%- if role == 'model' -%} {{- strip_thinking(item['text']) -}} {%- else -%} {{- item['text'] | trim -}} {%- endif -%} {%- elif item['type'] == 'image' -%} {{- '\n\n<|image|>\n\n' -}} {%- elif item['type'] == 'audio' -%} {{- '<|audio|>' -}} {%- endif -%} {%- endfor -%} {%- endif -%} {%- set ns.prev_message_type = None -%} {%- endif -%} {%- if ns.prev_message_type == None -%} {{- '<turn|>\n' -}} {%- endif -%}{%- endfor -%}
{%- if add_generation_prompt -%} {%- if ns.prev_message_type != 'tool_response' -%} {{- '<|turn>model\n' -}} {%- endif -%}{%- endif -%}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475{ "audio_ms_per_token": 40, "audio_seq_length": 750, "feature_extractor": { "dither": 0.0, "feature_extractor_type": "Gemma4AudioFeatureExtractor", "feature_size": 128, "fft_length": 512, "fft_overdrive": false, "frame_length": 320, "hop_length": 160, "input_scale_factor": 1.0, "max_frequency": 8000.0, "mel_floor": 0.001, "min_frequency": 0.0, "padding_side": "left", "padding_value": 0.0, "per_bin_mean": null, "per_bin_stddev": null, "preemphasis": 0.0, "preemphasis_htk_flavor": true, "return_attention_mask": true, "sampling_rate": 16000 }, "image_processor": { "do_convert_rgb": true, "do_normalize": false, "do_rescale": true, "do_resize": true, "image_mean": [ 0.0, 0.0, 0.0 ], "image_processor_type": "Gemma4ImageProcessor", "image_seq_length": 280, "image_std": [ 1.0, 1.0, 1.0 ], "max_soft_tokens": 280, "patch_size": 16, "pooling_kernel_size": 3, "resample": 3, "rescale_factor": 0.00392156862745098 }, "image_seq_length": 280, "processor_class": "Gemma4Processor", "video_processor": { "do_convert_rgb": true, "do_normalize": true, "do_rescale": true, "do_resize": true, "do_sample_frames": true, "image_mean": [ 0.0, 0.0, 0.0 ], "image_std": [ 1.0, 1.0, 1.0 ], "max_soft_tokens": 70, "num_frames": 32, "patch_size": 16, "pooling_kernel_size": 3, "resample": 3, "rescale_factor": 0.00392156862745098, "return_metadata": false, "video_processor_type": "Gemma4VideoProcessor" }}123version https://git-lfs.github.com/spec/v1oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0fsize 32169626123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289{ "audio_token": "<|audio|>", "backend": "tokenizers", "boa_token": "<|audio>", "boi_token": "<|image>", "bos_token": "<bos>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eos_token": "<turn|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "extra_special_tokens": [ "<|video|>" ], "image_token": "<|image|>", "is_local": false, "mask_token": "<mask>", "model_max_length": 131072, "model_specific_special_tokens": { "audio_token": "<|audio|>", "boa_token": "<|audio>", "boi_token": "<|image>", "eoa_token": "<audio|>", "eoc_token": "<channel|>", "eoi_token": "<image|>", "eot_token": "<turn|>", "escape_token": "<|\"|>", "etc_token": "<tool_call|>", "etd_token": "<tool|>", "etr_token": "<tool_response|>", "image_token": "<|image|>", "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>" }, "pad_token": "<pad>", "padding_side": "right", "processor_class": "Gemma4Processor", "response_schema": { "properties": { "content": { "type": "string" }, "role": { "const": "assistant" }, "thinking": { "type": "string" }, "tool_calls": { "items": { "properties": { "function": { "properties": { "arguments": { "additionalProperties": {}, "type": "object", "x-parser": "gemma4-tool-call" }, "name": { "type": "string" } }, "type": "object", "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})" }, "type": { "const": "function" } }, "type": "object" }, "type": "array", "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>" } }, "type": "object", "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?" }, "soc_token": "<|channel>", "sot_token": "<|turn>", "stc_token": "<|tool_call>", "std_token": "<|tool>", "str_token": "<|tool_response>", "think_token": "<|think|>", "tokenizer_class": "GemmaTokenizer", "unk_token": "<unk>", "added_tokens_decoder": { "0": { "content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "1": { "content": "<eos>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "2": { "content": "<bos>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "3": { "content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "4": { "content": "<mask>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "46": { "content": "<|tool>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "47": { "content": "<tool|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "48": { "content": "<|tool_call>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "49": { "content": "<tool_call|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "50": { "content": "<|tool_response>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "51": { "content": "<tool_response|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "52": { "content": "<|\"|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "98": { "content": "<|think|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "100": { "content": "<|channel>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "101": { "content": "<channel|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "105": { "content": "<|turn>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "106": { "content": "<turn|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "255999": { "content": "<|image>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "256000": { "content": "<|audio>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "258880": { "content": "<|image|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "258881": { "content": "<|audio|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "258882": { "content": "<image|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "258883": { "content": "<audio|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true }, "258884": { "content": "<|video|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": false, "special": true } }}.gitattributes+1
lora-adapter/adapter_config.jsonAdded+52
lora-adapter/adapter_model.safetensorsAdded+3
lora-adapter/chat_template.jinjaAdded+266
lora-adapter/processor_config.jsonAdded+75
lora-adapter/tokenizer.jsonAdded+3
lora-adapter/tokenizer_config.jsonAdded+289