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
| // keep this struct lightweight | |
| struct llama_ubatch { | |
| bool equal_seqs() const { | |
| return b_equal_seqs != 0; | |
| } | |
| // typical for M-RoPE cases: | |
| // 0 - sequential position of the tokens/embeddings in the sequence | |
| // 1 - y position in the image | |
| // 2 - x position in the image | |
| // 3 - other | |
| bool is_pos_2d() const { | |
| // TODO @ngxson : we may need to check for model arch when more models use >1 positions | |
| return n_pos >= 3; | |
| } | |
| uint32_t b_equal_seqs; // note: this is a boolean, but we use an int32_t for alignment | |
| // otherwise address sanitizer complains | |
| // TODO: whole_seqs for embeddings? | |
| uint32_t n_tokens; // total tokens (n_seq_tokens * n_seqs) | |
| uint32_t n_seq_tokens; // tokens per sequence set | |
| uint32_t n_seqs; // sequence sets in the ubatch | |
| uint32_t n_seqs_unq; // unique sequence ids in the ubatch | |
| uint32_t n_pos; // number of position inputs for each token/embedding | |
| // seq_id_unq: unique sequence ids in the ubatch | |
| // seq_idx: indices of the unique sequence ids in the ubatch in [0, n_seqs_unq) | |
| // used for extracting sequence pooled embeddings | |
| // // size | idx | val | |
| llama_token * token; // [n_tokens] | i | id, token | |
| float * embd; // [n_embd, n_tokens] | i | embd | |
| llama_pos * pos; // [n_tokens*n_pos] | i | pos | |
| int32_t * n_seq_id; // [n_tokens] | i | - | |
| llama_seq_id ** seq_id; // [n_tokens] | s | s0, s1, seq_id | |
| llama_seq_id * seq_id_unq; // [n_seqs_unq] | s | seq_id | |
| int32_t * seq_idx; // [LLAMA_MAX_SEQ] | - | seq_idx | |
| int8_t * output; // [n_tokens] | i | - | |
| struct data_t { | |
| std::vector<llama_token> token; | |
| std::vector<float> embd; | |
| std::vector<llama_pos> pos; | |
| std::vector<int32_t> n_seq_id; | |
| std::vector<llama_seq_id *> seq_id; // these point into the seq_id_data below | |
| std::vector<llama_seq_id> seq_id_unq; | |
| std::vector<int32_t> seq_idx; | |
| std::vector<int8_t> output; | |
| std::vector<llama_seq_id> seq_id_data; | |
| }; | |
| // the llama_ubatch pointers above point to this data if set. otherwise - point to external non-owning data | |
| std::shared_ptr<data_t> data; | |
| }; | |
| // a helper for sanitizing, fulfilling and splitting a batch | |
| class llama_batch_allocr { | |
| public: | |
| llama_batch_allocr(uint32_t n_pos_per_embd); | |
| // sanitize and auto-gen missing data in the input batch | |
| // memory is optional. if provided will be used to check for sequence continuity and to determine the positions | |
| bool init( | |
| const llama_batch & batch_inp, | |
| const llama_vocab & vocab, | |
| const llama_memory_i * memory, | |
| uint32_t n_embd, | |
| uint32_t n_seq_max, | |
| bool output_all); | |
| const llama_batch & get_batch() const; | |
| uint32_t get_n_tokens() const; | |
| uint32_t get_n_outputs() const; | |
| uint32_t get_n_used() const; | |
| // the array of output indices in the order they were encountered during the ubatch splitting | |
| std::vector<int32_t> & get_out_ids(); | |
| // min/max positions of each sequence in the current ubatch | |
| llama_pos seq_pos_min(llama_seq_id seq_id) const; | |
| llama_pos seq_pos_max(llama_seq_id seq_id) const; | |
| // call once before splitting the batch to reset the internal state | |
| void split_reset(); | |
| // simple split, unknown number of sequence sets of unequal lengths | |
| llama_ubatch split_simple(uint32_t n_ubatch); | |
| // make ubatches of equal-length sequences sets | |
| // if sequential == true, the tokens in the ubatch will have increasing sequential sequence ids | |
| llama_ubatch split_equal(uint32_t n_ubatch, bool sequential); | |
| // sequence-set-wise split - each ubatch contains a single sequence-set | |
| llama_ubatch split_seq(uint32_t n_ubatch); | |
| // a helper method for creating a well-defined ubatch of tokens | |
| // TODO: support embeddings if needed in the future | |
| llama_ubatch ubatch_reserve(uint32_t n_seq_tokens, uint32_t n_seqs); | |
| private: | |
| void clear(); | |
| // create the next ubatch based on the provided batch indices (idxs) and the number of sequence sets (n_seqs) | |
| // return llama_ubatch.n_tokens == 0 if the entire batch was consumed | |
| llama_ubatch ubatch_add(const std::vector<int32_t> & idxs, uint32_t n_seqs, bool equal_seqs); | |
| // for debugging, start with LLAMA_BATCH_DEBUG=2 | |
| void ubatch_print(const llama_ubatch & ubatch, int debug); | |
| llama_batch batch; | |
| // only for debugging purposes | |
| const llama_vocab * vocab; | |
| // TODO: this is more of a temporary solution until we have a better way to handle multiple positions per token/embd | |
| // ref: https://github.com/ggml-org/llama.cpp/issues/13694#issuecomment-2983871762 | |
| const uint32_t n_pos_per_embd; | |
| uint32_t n_embd; | |
| uint32_t n_seq_max; | |
| uint32_t n_outputs; | |
| std::array<llama_seq_id, 1> seq_id_0 = {{ 0 }}; // default sequence id | |
| std::vector<llama_pos> pos; | |
| std::vector<int32_t> n_seq_id; | |
| std::vector<llama_seq_id *> seq_id; | |
| std::vector<llama_seq_id> seq_id_unq; | |
| std::vector<int32_t> seq_idx; | |
| std::vector<int8_t> output; | |
| using pos_set_t = std::set<llama_pos>; | |
| using seq_cpl_t = std::vector<bool>; | |
| // helper flag to quickly determine if there are any coupled sequences in the batch | |
| bool has_cpl = false; | |
| std::vector<pos_set_t> seq_pos; // seq_pos[s]: the set of positions in sequence s | |
| std::vector<seq_cpl_t> seq_cpl; // seq_cpl[s0][s1]: if sequence s0 is coupled to sequence s1 | |
| using idx_vec_t = std::vector<int32_t>; | |
| using seq_set_t = std::bitset<LLAMA_MAX_SEQ>; | |
| std::vector<seq_set_t> seq_set; // seq_set[i]: the sequence set of token i | |
| std::unordered_map<seq_set_t, idx_vec_t> seq_set_map; // the indices at which the sequence set appears | |
| // batch indices of the output | |
| std::vector<int32_t> out_ids; | |
| uint32_t n_used; | |
| // used[i] indicates if token i has already been used in a previous ubatch | |
| std::vector<bool> used; | |
| int debug; | |
| }; | |