Instructions to use DedeProGames/NTX-350m-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DedeProGames/NTX-350m-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DedeProGames/NTX-350m-Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DedeProGames/NTX-350m-Preview") model = AutoModelForCausalLM.from_pretrained("DedeProGames/NTX-350m-Preview") 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 DedeProGames/NTX-350m-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DedeProGames/NTX-350m-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DedeProGames/NTX-350m-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/DedeProGames/NTX-350m-Preview
- SGLang
How to use DedeProGames/NTX-350m-Preview 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 "DedeProGames/NTX-350m-Preview" \ --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": "DedeProGames/NTX-350m-Preview", "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 "DedeProGames/NTX-350m-Preview" \ --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": "DedeProGames/NTX-350m-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use DedeProGames/NTX-350m-Preview 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 DedeProGames/NTX-350m-Preview 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 DedeProGames/NTX-350m-Preview to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for DedeProGames/NTX-350m-Preview to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="DedeProGames/NTX-350m-Preview", max_seq_length=2048, ) - Docker Model Runner
How to use DedeProGames/NTX-350m-Preview with Docker Model Runner:
docker model run hf.co/DedeProGames/NTX-350m-Preview
Upload de lfm25_350m_grape_fft para DedeProGames/NTX-350m-Preview
Browse files- README.md +59 -0
- chat_template.jinja +64 -0
- config.json +62 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +22 -0
- training_args.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: LiquidAI/LFM2.5-350M
|
| 3 |
+
library_name: transformers
|
| 4 |
+
model_name: lfm25_350m_grape_fft
|
| 5 |
+
tags:
|
| 6 |
+
- generated_from_trainer
|
| 7 |
+
- sft
|
| 8 |
+
- trl
|
| 9 |
+
- unsloth
|
| 10 |
+
licence: license
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Model Card for lfm25_350m_grape_fft
|
| 14 |
+
|
| 15 |
+
This model is a fine-tuned version of [LiquidAI/LFM2.5-350M](https://huggingface.co/LiquidAI/LFM2.5-350M).
|
| 16 |
+
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 17 |
+
|
| 18 |
+
## Quick start
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from transformers import pipeline
|
| 22 |
+
|
| 23 |
+
question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
|
| 24 |
+
generator = pipeline("text-generation", model="None", device="cuda")
|
| 25 |
+
output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
|
| 26 |
+
print(output["generated_text"])
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## Training procedure
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
This model was trained with SFT.
|
| 35 |
+
|
| 36 |
+
### Framework versions
|
| 37 |
+
|
| 38 |
+
- TRL: 0.24.0
|
| 39 |
+
- Transformers: 5.5.3
|
| 40 |
+
- Pytorch: 2.11.0+cu128
|
| 41 |
+
- Datasets: 4.3.0
|
| 42 |
+
- Tokenizers: 0.22.2
|
| 43 |
+
|
| 44 |
+
## Citations
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
Cite TRL as:
|
| 49 |
+
|
| 50 |
+
```bibtex
|
| 51 |
+
@misc{vonwerra2022trl,
|
| 52 |
+
title = {{TRL: Transformer Reinforcement Learning}},
|
| 53 |
+
author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
|
| 54 |
+
year = 2020,
|
| 55 |
+
journal = {GitHub repository},
|
| 56 |
+
publisher = {GitHub},
|
| 57 |
+
howpublished = {\url{https://github.com/huggingface/trl}}
|
| 58 |
+
}
|
| 59 |
+
```
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- bos_token -}}
|
| 2 |
+
{%- set keep_past_thinking = keep_past_thinking | default(false) -%}
|
| 3 |
+
{%- set ns = namespace(system_prompt="") -%}
|
| 4 |
+
{%- if messages[0]["role"] == "system" -%}
|
| 5 |
+
{%- set sys_content = messages[0]["content"] -%}
|
| 6 |
+
{%- if sys_content is not string -%}
|
| 7 |
+
{%- for item in sys_content -%}
|
| 8 |
+
{%- if item["type"] == "text" -%}
|
| 9 |
+
{%- set ns.system_prompt = ns.system_prompt + item["text"] -%}
|
| 10 |
+
{%- endif -%}
|
| 11 |
+
{%- endfor -%}
|
| 12 |
+
{%- else -%}
|
| 13 |
+
{%- set ns.system_prompt = sys_content -%}
|
| 14 |
+
{%- endif -%}
|
| 15 |
+
{%- set messages = messages[1:] -%}
|
| 16 |
+
{%- endif -%}
|
| 17 |
+
{%- if tools -%}
|
| 18 |
+
{%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
|
| 19 |
+
{%- for tool in tools -%}
|
| 20 |
+
{%- if tool is not string -%}
|
| 21 |
+
{%- set tool = tool | tojson -%}
|
| 22 |
+
{%- endif -%}
|
| 23 |
+
{%- set ns.system_prompt = ns.system_prompt + tool -%}
|
| 24 |
+
{%- if not loop.last -%}
|
| 25 |
+
{%- set ns.system_prompt = ns.system_prompt + ", " -%}
|
| 26 |
+
{%- endif -%}
|
| 27 |
+
{%- endfor -%}
|
| 28 |
+
{%- set ns.system_prompt = ns.system_prompt + "]" -%}
|
| 29 |
+
{%- endif -%}
|
| 30 |
+
{%- if ns.system_prompt -%}
|
| 31 |
+
{{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
{%- set ns.last_assistant_index = -1 -%}
|
| 34 |
+
{%- for message in messages -%}
|
| 35 |
+
{%- if message["role"] == "assistant" -%}
|
| 36 |
+
{%- set ns.last_assistant_index = loop.index0 -%}
|
| 37 |
+
{%- endif -%}
|
| 38 |
+
{%- endfor -%}
|
| 39 |
+
{%- for message in messages -%}
|
| 40 |
+
{{- "<|im_start|>" + message["role"] + "\n" -}}
|
| 41 |
+
{%- set content = message["content"] -%}
|
| 42 |
+
{%- if content is not string -%}
|
| 43 |
+
{%- set ns.content = "" -%}
|
| 44 |
+
{%- for item in content -%}
|
| 45 |
+
{%- if item["type"] == "image" -%}
|
| 46 |
+
{%- set ns.content = ns.content + "<image>" -%}
|
| 47 |
+
{%- elif item["type"] == "text" -%}
|
| 48 |
+
{%- set ns.content = ns.content + item["text"] -%}
|
| 49 |
+
{%- else -%}
|
| 50 |
+
{%- set ns.content = ns.content + item | tojson -%}
|
| 51 |
+
{%- endif -%}
|
| 52 |
+
{%- endfor -%}
|
| 53 |
+
{%- set content = ns.content -%}
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- if message["role"] == "assistant" and not keep_past_thinking and loop.index0 != ns.last_assistant_index -%}
|
| 56 |
+
{%- if "</think>" in content -%}
|
| 57 |
+
{%- set content = content.split("</think>")[-1] | trim -%}
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{{- content + "<|im_end|>\n" -}}
|
| 61 |
+
{%- endfor -%}
|
| 62 |
+
{%- if add_generation_prompt -%}
|
| 63 |
+
{{- "<|im_start|>assistant\n" -}}
|
| 64 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Lfm2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"block_auto_adjust_ff_dim": true,
|
| 6 |
+
"block_dim": 1024,
|
| 7 |
+
"block_ffn_dim_multiplier": 1.0,
|
| 8 |
+
"block_mlp_init_scale": 1.0,
|
| 9 |
+
"block_multiple_of": 256,
|
| 10 |
+
"block_norm_eps": 1e-05,
|
| 11 |
+
"block_out_init_scale": 1.0,
|
| 12 |
+
"block_use_swiglu": true,
|
| 13 |
+
"block_use_xavier_init": true,
|
| 14 |
+
"bos_token_id": 1,
|
| 15 |
+
"conv_L_cache": 3,
|
| 16 |
+
"conv_bias": false,
|
| 17 |
+
"conv_dim": 1024,
|
| 18 |
+
"conv_use_xavier_init": true,
|
| 19 |
+
"dtype": "bfloat16",
|
| 20 |
+
"eos_token_id": 7,
|
| 21 |
+
"full_attn_idxs": null,
|
| 22 |
+
"hidden_size": 1024,
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 6656,
|
| 25 |
+
"layer_types": [
|
| 26 |
+
"conv",
|
| 27 |
+
"conv",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"conv",
|
| 30 |
+
"conv",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"conv",
|
| 33 |
+
"conv",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"conv",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"conv",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"conv",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"conv"
|
| 42 |
+
],
|
| 43 |
+
"max_position_embeddings": 128000,
|
| 44 |
+
"model_name": "LiquidAI/LFM2.5-350M",
|
| 45 |
+
"model_type": "lfm2",
|
| 46 |
+
"norm_eps": 1e-05,
|
| 47 |
+
"num_attention_heads": 16,
|
| 48 |
+
"num_heads": 16,
|
| 49 |
+
"num_hidden_layers": 16,
|
| 50 |
+
"num_key_value_heads": 8,
|
| 51 |
+
"pad_token_id": 0,
|
| 52 |
+
"rope_parameters": {
|
| 53 |
+
"rope_theta": 1000000.0,
|
| 54 |
+
"rope_type": "default"
|
| 55 |
+
},
|
| 56 |
+
"tie_word_embeddings": true,
|
| 57 |
+
"transformers_version": "5.5.3",
|
| 58 |
+
"unsloth_version": "2026.4.4",
|
| 59 |
+
"use_cache": false,
|
| 60 |
+
"use_pos_enc": true,
|
| 61 |
+
"vocab_size": 65536
|
| 62 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
7
|
| 6 |
+
],
|
| 7 |
+
"max_length": 128000,
|
| 8 |
+
"pad_token_id": 0,
|
| 9 |
+
"transformers_version": "5.5.3"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:791f611505e5cc15ea821d749c6effc6cfae66c40654420c7f8487b48ed95cef
|
| 3 |
+
size 708984464
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|startoftext|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|im_end|>",
|
| 6 |
+
"extra_special_tokens": [],
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"legacy": false,
|
| 9 |
+
"model_input_names": [
|
| 10 |
+
"input_ids",
|
| 11 |
+
"attention_mask"
|
| 12 |
+
],
|
| 13 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 14 |
+
"model_specific_special_tokens": {},
|
| 15 |
+
"pad_token": "<|pad|>",
|
| 16 |
+
"padding_side": "left",
|
| 17 |
+
"sp_model_kwargs": {},
|
| 18 |
+
"spaces_between_special_tokens": false,
|
| 19 |
+
"tokenizer_class": "TokenizersBackend",
|
| 20 |
+
"use_default_system_prompt": false,
|
| 21 |
+
"use_fast": true
|
| 22 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c079ee2ebe7bf2f73e0c6cc9c4d62cfaaa87a314dda0de66adaa04a5cf6f162
|
| 3 |
+
size 5713
|