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
| // AMX type_trais | |
| namespace ggml::cpu::amx { | |
| class tensor_traits : public ggml::cpu::tensor_traits { | |
| bool work_size(int /* n_threads */, const struct ggml_tensor * op, size_t & size) override { | |
| size = ggml_backend_amx_desired_wsize(op); | |
| return true; | |
| } | |
| bool compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op) override { | |
| if (op->op == GGML_OP_MUL_MAT) { | |
| ggml_backend_amx_mul_mat(params, op); | |
| return true; | |
| } | |
| return false; | |
| } | |
| }; | |
| static ggml::cpu::tensor_traits * get_tensor_traits(ggml_backend_buffer_t, struct ggml_tensor *) { | |
| static tensor_traits traits; | |
| return &traits; | |
| } | |
| } // namespace ggml::cpu::amx | |
| // AMX buffer interface | |
| static void ggml_backend_amx_buffer_free_buffer(ggml_backend_buffer_t buffer) { | |
| free(buffer->context); | |
| } | |
| static void * ggml_backend_amx_buffer_get_base(ggml_backend_buffer_t buffer) { | |
| return (void *) (buffer->context); | |
| } | |
| static enum ggml_status ggml_backend_amx_buffer_init_tensor(ggml_backend_buffer_t buffer, struct ggml_tensor * tensor) { | |
| tensor->extra = (void *) ggml::cpu::amx::get_tensor_traits(buffer, tensor); | |
| GGML_UNUSED(buffer); | |
| return GGML_STATUS_SUCCESS; | |
| } | |
| static void ggml_backend_amx_buffer_memset_tensor(ggml_backend_buffer_t buffer, struct ggml_tensor * tensor, | |
| uint8_t value, size_t offset, size_t size) { | |
| memset((char *) tensor->data + offset, value, size); | |
| GGML_UNUSED(buffer); | |
| } | |
| static void ggml_backend_amx_buffer_set_tensor(ggml_backend_buffer_t buffer, struct ggml_tensor * tensor, | |
| const void * data, size_t offset, size_t size) { | |
| if (qtype_has_amx_kernels(tensor->type)) { | |
| GGML_LOG_DEBUG("%s: amx repack tensor %s of type %s\n", __func__, tensor->name, ggml_type_name(tensor->type)); | |
| ggml_backend_amx_convert_weight(tensor, data, offset, size); | |
| } else { | |
| memcpy((char *) tensor->data + offset, data, size); | |
| } | |
| GGML_UNUSED(buffer); | |
| } | |
| /* | |
| // need to figure what we need to do with buffer->extra. | |
| static void ggml_backend_amx_buffer_get_tensor(ggml_backend_buffer_t buffer, const struct ggml_tensor * tensor, void * data, size_t offset, size_t size) { | |
| GGML_ASSERT(!qtype_has_amx_kernels(tensor->type)); | |
| memcpy(data, (const char *)tensor->data + offset, size); | |
| GGML_UNUSED(buffer); | |
| } | |
| static bool ggml_backend_amx_buffer_cpy_tensor(ggml_backend_buffer_t buffer, const struct ggml_tensor * src, struct ggml_tensor * dst) { | |
| if (ggml_backend_buffer_is_host(src->buffer)) { | |
| if (qtype_has_amx_kernels(src->type)) { | |
| ggml_backend_amx_convert_weight(dst, src->data, 0, ggml_nbytes(dst)); | |
| } else { | |
| memcpy(dst->data, src->data, ggml_nbytes(src)); | |
| } | |
| return true; | |
| } | |
| return false; | |
| GGML_UNUSED(buffer); | |
| } | |
| */ | |
| static void ggml_backend_amx_buffer_clear(ggml_backend_buffer_t buffer, uint8_t value) { | |
| memset(buffer->context, value, buffer->size); | |
| } | |
| static ggml_backend_buffer_i ggml_backend_amx_buffer_interface = { | |
| /* .free_buffer = */ ggml_backend_amx_buffer_free_buffer, | |
| /* .get_base = */ ggml_backend_amx_buffer_get_base, | |
| /* .init_tensor = */ ggml_backend_amx_buffer_init_tensor, | |
| /* .memset_tensor = */ ggml_backend_amx_buffer_memset_tensor, | |
| /* .set_tensor = */ ggml_backend_amx_buffer_set_tensor, | |
| /* .get_tensor = */ nullptr, | |
| /* .set_tensor_2d = */ nullptr, | |
| /* .get_tensor_2d = */ nullptr, | |
| /* .cpy_tensor = */ nullptr, | |
| /* .clear = */ ggml_backend_amx_buffer_clear, | |
| /* .reset = */ nullptr, | |
| }; | |
| static const char * ggml_backend_amx_buffer_type_get_name(ggml_backend_buffer_type_t buft) { | |
| return "AMX"; | |
| GGML_UNUSED(buft); | |
| } | |
| static ggml_backend_buffer_t ggml_backend_amx_buffer_type_alloc_buffer(ggml_backend_buffer_type_t buft, size_t size) { | |
| void * data = ggml_aligned_malloc(size); | |
| if (data == NULL) { | |
| fprintf(stderr, "%s: failed to allocate buffer of size %zu\n", __func__, size); | |
| return NULL; | |
| } | |
| return ggml_backend_buffer_init(buft, ggml_backend_amx_buffer_interface, data, size); | |
| } | |
| static size_t ggml_backend_amx_buffer_type_get_alignment(ggml_backend_buffer_type_t buft) { | |
| return TENSOR_ALIGNMENT; | |
| GGML_UNUSED(buft); | |
| } | |
| namespace ggml::cpu::amx { | |
| class extra_buffer_type : ggml::cpu::extra_buffer_type { | |
| bool supports_op(ggml_backend_dev_t, const struct ggml_tensor * op) override { | |
| if (op->op != GGML_OP_MUL_MAT) { | |
| return false; | |
| } | |
| auto * src0 = op->src[0]; | |
| auto * src1 = op->src[1]; | |
| if (!ggml_is_contiguous(src0) || !ggml_is_contiguous(src1)) { | |
| return false; | |
| } | |
| if (!src0->buffer || src0->buffer->buft != ggml_backend_amx_buffer_type()) { | |
| return false; | |
| } | |
| if (src1->buffer && !ggml_backend_buft_is_host(src1->buffer->buft)) { | |
| return false; | |
| } | |
| if (op->ne[0] % (TILE_N * 2)) { | |
| return false; | |
| } | |
| int alignment; | |
| switch (src0->type) { | |
| case GGML_TYPE_Q4_0: | |
| case GGML_TYPE_Q4_1: | |
| case GGML_TYPE_Q8_0: | |
| alignment = TILE_K; | |
| break; | |
| case GGML_TYPE_Q4_K: | |
| case GGML_TYPE_Q5_K: | |
| case GGML_TYPE_Q6_K: | |
| case GGML_TYPE_IQ4_XS: | |
| alignment = 256; // QK_K | |
| break; | |
| case GGML_TYPE_F16: | |
| alignment = 16; | |
| break; | |
| default: | |
| return false; | |
| } | |
| if (src0->ne[0] % alignment) { | |
| return false; | |
| } | |
| if (src1->type != GGML_TYPE_F32) { | |
| return false; | |
| } | |
| return true; | |
| } | |
| ggml::cpu::tensor_traits * get_tensor_traits(const struct ggml_tensor * op) override { | |
| if (op->op == GGML_OP_MUL_MAT && op->src[0]->buffer && | |
| op->src[0]->buffer->buft == ggml_backend_amx_buffer_type()) { | |
| return (ggml::cpu::tensor_traits *) op->src[0]->extra; | |
| } | |
| return nullptr; | |
| } | |
| }; | |
| } // namespace ggml::cpu::amx | |
| static size_t ggml_backend_amx_buffer_type_get_alloc_size(ggml_backend_buffer_type_t buft, const ggml_tensor * tensor) { | |
| return ggml_backend_amx_get_alloc_size(tensor); | |
| GGML_UNUSED(buft); | |
| } | |
| static bool ggml_amx_init() { | |
| if (syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_PERM, XFEATURE_XTILEDATA)) { | |
| fprintf(stderr, "AMX is not ready to be used!\n"); | |
| return false; | |
| } | |
| return true; | |
| return true; | |
| return false; | |
| } | |
| ggml_backend_buffer_type_t ggml_backend_amx_buffer_type() { | |
| static struct ggml_backend_buffer_type ggml_backend_buffer_type_amx = { | |
| /* .iface = */ { | |
| /* .get_name = */ ggml_backend_amx_buffer_type_get_name, | |
| /* .alloc_buffer = */ ggml_backend_amx_buffer_type_alloc_buffer, | |
| /* .get_alignment = */ ggml_backend_amx_buffer_type_get_alignment, | |
| /* .get_max_size = */ nullptr, // defaults to SIZE_MAX | |
| /* .get_alloc_size = */ ggml_backend_amx_buffer_type_get_alloc_size, | |
| /* .is_host = */ nullptr, | |
| }, | |
| /* .device = */ ggml_backend_reg_dev_get(ggml_backend_cpu_reg(), 0), | |
| /* .context = */ new ggml::cpu::amx::extra_buffer_type(), | |
| }; | |
| if (!ggml_amx_init()) { | |
| return nullptr; | |
| } | |
| return &ggml_backend_buffer_type_amx; | |
| } | |