Safetensors
GGUF
Turkish
llama
Llama-3
instruct
finetune
chatml
gpt4
synthetic data
distillation
function calling
json mode
axolotl
roleplaying
chat
Instructions to use tda45/TdAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use tda45/TdAI with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="tda45/TdAI", filename="llama.cpp/models/ggml-vocab-aquila.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use tda45/TdAI with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf tda45/TdAI # Run inference directly in the terminal: llama cli -hf tda45/TdAI
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf tda45/TdAI # Run inference directly in the terminal: llama cli -hf tda45/TdAI
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 tda45/TdAI # Run inference directly in the terminal: ./llama-cli -hf tda45/TdAI
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 tda45/TdAI # Run inference directly in the terminal: ./build/bin/llama-cli -hf tda45/TdAI
Use Docker
docker model run hf.co/tda45/TdAI
- LM Studio
- Jan
- Ollama
How to use tda45/TdAI with Ollama:
ollama run hf.co/tda45/TdAI
- Unsloth Studio
How to use tda45/TdAI 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 tda45/TdAI 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 tda45/TdAI to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for tda45/TdAI to start chatting
- Atomic Chat new
- Docker Model Runner
How to use tda45/TdAI with Docker Model Runner:
docker model run hf.co/tda45/TdAI
- Lemonade
How to use tda45/TdAI with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull tda45/TdAI
Run and chat with the model
lemonade run user.TdAI-{{QUANT_TAG}}List all available models
lemonade list
| from __future__ import annotations | |
| import json | |
| from typing import Iterable, TYPE_CHECKING | |
| if TYPE_CHECKING: | |
| from torch import Tensor | |
| from .base import MmprojModel, ModelBase, gguf, logger | |
| from .llama import LlamaModel | |
| class LlavaVisionModel(MmprojModel): | |
| img_break_tok_id = -1 | |
| use_break_tok = True | |
| def __init__(self, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| if self.hparams.get("model_type") == "pixtral": | |
| # layer_norm_eps is not in config.json, it is hard-coded in modeling_pixtral.py | |
| self.hparams["layer_norm_eps"] = self.hparams.get("layer_norm_eps", 1e-5) | |
| if self.use_break_tok: | |
| self.img_break_tok_id = self.get_token_id("[IMG_BREAK]") | |
| elif self.is_mistral_format: | |
| # hparams is already vision config here so norm_eps is only defined in global_config. | |
| self.hparams["norm_eps"] = self.global_config.get("norm_eps", None) | |
| assert self.hparams["norm_eps"] is not None, "norm_eps not found in params.json" | |
| if self.use_break_tok: | |
| self.img_break_tok_id = self.find_vparam(["image_break_token_id"]) | |
| # params.json may ship -1 placeholders (Mistral Medium 3.5) | |
| # resolve the real id from the bundled tokenizer in that case | |
| if self.img_break_tok_id < 0: | |
| self.img_break_tok_id = self.get_mistral_token_id("[IMG_BREAK]") | |
| else: | |
| raise ValueError(f"Unsupported model type: {self.hparams['model_type']}") | |
| logger.info(f"Image break token id: {self.img_break_tok_id}") | |
| def get_token_id(self, token: str) -> int: | |
| tokenizer_config_file = self.dir_model / 'tokenizer_config.json' | |
| with open(tokenizer_config_file, "r", encoding="utf-8") as f: | |
| added_tokens_decoder = json.load(f).get('added_tokens_decoder') or {} | |
| for id_, token_data in added_tokens_decoder.items(): | |
| if token_data.get("content") == token: | |
| return int(id_) | |
| # fallthrough to tokenizer.json | |
| with open(self.dir_model / "tokenizer.json", "r", encoding="utf-8") as f: | |
| tokenizer_json = json.load(f) | |
| for token_data in tokenizer_json["added_tokens"]: | |
| if token_data["content"] == token: | |
| return int(token_data["id"]) | |
| raise ValueError(f"Token '{token}' not found in tokenizer config.") | |
| def get_mistral_token_id(self, token: str) -> int: | |
| # mistral native format ships tekken.json or a versioned spm tokenizer | |
| tekken_file = self.dir_model / "tekken.json" | |
| if tekken_file.is_file(): | |
| with open(tekken_file, "r", encoding="utf-8") as f: | |
| data = json.load(f) | |
| for entry in data.get("special_tokens", []): | |
| if entry.get("token_str") == token: | |
| return int(entry["rank"]) | |
| tokenizer_json_file = self.dir_model / "tokenizer.json" | |
| if tokenizer_json_file.is_file(): | |
| with open(tokenizer_json_file, "r", encoding="utf-8") as f: | |
| data = json.load(f) | |
| for entry in data.get("added_tokens", []): | |
| if entry.get("content") == token: | |
| return int(entry["id"]) | |
| raise ValueError(f"Token '{token}' not found in mistral tokenizer files.") | |
| def set_gguf_parameters(self): | |
| super().set_gguf_parameters() | |
| hparams = self.hparams | |
| if hparams.get("model_type") == "pixtral": | |
| self.gguf_writer.add_clip_projector_type(gguf.VisionProjectorType.PIXTRAL) | |
| self.gguf_writer.add_vision_attention_layernorm_eps(hparams["layer_norm_eps"]) | |
| # hidden_act | |
| if hparams["hidden_act"] == "silu": | |
| self.gguf_writer.add_vision_use_silu(True) | |
| elif hparams["hidden_act"] == "gelu": | |
| self.gguf_writer.add_vision_use_gelu(True) | |
| else: | |
| raise ValueError(f"Unsupported hidden_act: {hparams['hidden_act']}") | |
| # spatial_merge_size | |
| if "spatial_merge_size" in self.global_config: | |
| self.gguf_writer.add_vision_spatial_merge_size(self.global_config["spatial_merge_size"]) | |
| def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]: | |
| n_head = ( | |
| self.hparams["num_attention_heads"] if not self.is_mistral_format else self.find_vparam(["num_attention_heads"]) | |
| ) | |
| n_kv_head = n_head | |
| valid_prefixes = ( | |
| "multi_modal_projector.", | |
| "vision_tower.", | |
| "vision_encoder.", | |
| "vision_language_adapter.", | |
| "patch_merger.", | |
| "pre_mm_projector_norm", | |
| ) | |
| if any(name.startswith(prefix) for prefix in valid_prefixes): | |
| # process vision tensors | |
| if name.endswith(("q_proj.weight", "q_proj.bias")) and not self.is_mistral_format: | |
| data_torch = LlamaModel.permute(data_torch, n_head, n_head) | |
| if name.endswith(("k_proj.weight", "k_proj.bias")) and not self.is_mistral_format: | |
| data_torch = LlamaModel.permute(data_torch, n_head, n_kv_head) | |
| yield from super().modify_tensors(data_torch, name, bid) | |
| return | |
| embed_key = "embed_tokens.weight" if not self.is_mistral_format else "tok_embeddings.weight" | |
| if self.img_break_tok_id > 0 and embed_key in name: | |
| logger.info(f"Extracting [IMG_BREAK] token embedding from {name}") | |
| # for pixtral model, we need to extract the [IMG_BREAK] token embedding | |
| img_break_embd = data_torch[self.img_break_tok_id] | |
| name = gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_TOK_EMBD_IMG_BREAK] | |
| yield from super().modify_tensors(img_break_embd, name, bid) | |
| return # skip other tensors | |