Text Generation
Transformers
Safetensors
GGUF
llama
chatbot
multilingual
arabic
french
tamazight
english
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use kaisser/LLM-Maroc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kaisser/LLM-Maroc with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kaisser/LLM-Maroc") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kaisser/LLM-Maroc") model = AutoModelForCausalLM.from_pretrained("kaisser/LLM-Maroc", device_map="auto") 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 Settings
- llama.cpp
How to use kaisser/LLM-Maroc 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 kaisser/LLM-Maroc:BF16 # Run inference directly in the terminal: llama cli -hf kaisser/LLM-Maroc:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf kaisser/LLM-Maroc:BF16 # Run inference directly in the terminal: llama cli -hf kaisser/LLM-Maroc:BF16
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 kaisser/LLM-Maroc:BF16 # Run inference directly in the terminal: ./llama-cli -hf kaisser/LLM-Maroc:BF16
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 kaisser/LLM-Maroc:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf kaisser/LLM-Maroc:BF16
Use Docker
docker model run hf.co/kaisser/LLM-Maroc:BF16
- LM Studio
- Jan
- vLLM
How to use kaisser/LLM-Maroc with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kaisser/LLM-Maroc" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaisser/LLM-Maroc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kaisser/LLM-Maroc:BF16
- SGLang
How to use kaisser/LLM-Maroc 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 "kaisser/LLM-Maroc" \ --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": "kaisser/LLM-Maroc", "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 "kaisser/LLM-Maroc" \ --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": "kaisser/LLM-Maroc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use kaisser/LLM-Maroc with Ollama:
ollama run hf.co/kaisser/LLM-Maroc:BF16
- Unsloth Desktop
- Docker Model Runner
How to use kaisser/LLM-Maroc with Docker Model Runner:
docker model run hf.co/kaisser/LLM-Maroc:BF16
- Lemonade
How to use kaisser/LLM-Maroc with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull kaisser/LLM-Maroc:BF16
Run and chat with the model
lemonade run user.LLM-Maroc-BF16
List all available models
lemonade list
- Atomic Chat
| // | |
| // llama_memory_recurrent | |
| // | |
| // TODO: extract the cache state used for graph computation into llama_memory_recurrent_context_i | |
| // see the implementation of llama_kv_cache_unified_context_i for an example how to do it | |
| class llama_memory_recurrent : public llama_memory_i { | |
| public: | |
| // this callback is used to filter out layers that should not be included in the cache | |
| using layer_filter_cb = std::function<bool(int32_t il)>; | |
| llama_memory_recurrent( | |
| const llama_model & model, | |
| layer_filter_cb && filter, | |
| ggml_type type_r, | |
| ggml_type type_s, | |
| bool offload, | |
| uint32_t mem_size, | |
| uint32_t n_seq_max); | |
| ~llama_memory_recurrent() = default; | |
| // | |
| // llama_memory_i | |
| // | |
| llama_memory_context_ptr init_batch( | |
| llama_batch_allocr & balloc, | |
| uint32_t n_ubatch, | |
| bool embd_all) override; | |
| llama_memory_context_ptr init_full() override; | |
| llama_memory_context_ptr init_update(llama_context * lctx, bool optimize) override; | |
| void clear(bool data) override; | |
| bool seq_rm (llama_seq_id seq_id, llama_pos p0, llama_pos p1) override; | |
| void seq_cp (llama_seq_id seq_id_src, llama_seq_id seq_id_dst, llama_pos p0, llama_pos p1) override; | |
| void seq_keep(llama_seq_id seq_id) override; | |
| void seq_add (llama_seq_id seq_id, llama_pos p0, llama_pos p1, llama_pos shift) override; | |
| void seq_div (llama_seq_id seq_id, llama_pos p0, llama_pos p1, int d) override; | |
| llama_pos seq_pos_min(llama_seq_id seq_id) const override; | |
| llama_pos seq_pos_max(llama_seq_id seq_id) const override; | |
| bool prepare(const std::vector<llama_ubatch> & ubatches); | |
| // find a contiguous slot of memory cells and emplace the ubatch there | |
| bool find_slot(const llama_ubatch & ubatch); | |
| bool get_can_shift() const override; | |
| // state write/load | |
| void state_write(llama_io_write_i & io, llama_seq_id seq_id = -1) const override; | |
| void state_read (llama_io_read_i & io, llama_seq_id seq_id = -1) override; | |
| uint32_t head = 0; // the location where the batch will be placed in the cache (see find_slot()) | |
| uint32_t size = 0; // total number of cells, shared across all sequences | |
| uint32_t used = 0; // used cells (i.e. at least one seq_id) | |
| // computed before each graph build | |
| uint32_t n = 0; | |
| // first zero-ed state | |
| int32_t rs_z = -1; | |
| // TODO: optimize for recurrent state needs | |
| struct mem_cell { | |
| llama_pos pos = -1; | |
| int32_t src = -1; // used to know where states should be copied from | |
| int32_t src0 = -1; // like src, but only used when setting the inputs (allowing to copy once) | |
| int32_t tail = -1; | |
| std::set<llama_seq_id> seq_id; | |
| bool has_seq_id(const llama_seq_id & id) const { | |
| return seq_id.find(id) != seq_id.end(); | |
| } | |
| bool is_empty() const { | |
| return seq_id.empty(); | |
| } | |
| bool is_same_seq(const mem_cell & other) const { | |
| return seq_id == other.seq_id; | |
| } | |
| }; | |
| std::vector<mem_cell> cells; | |
| // per layer | |
| std::vector<ggml_tensor *> r_l; | |
| std::vector<ggml_tensor *> s_l; | |
| private: | |
| //const llama_model & model; | |
| const llama_hparams & hparams; | |
| const uint32_t n_seq_max = 1; | |
| std::vector<ggml_context_ptr> ctxs; | |
| std::vector<ggml_backend_buffer_ptr> bufs; | |
| size_t total_size() const; | |
| size_t size_r_bytes() const; | |
| size_t size_s_bytes() const; | |
| void state_write_meta(llama_io_write_i & io, const std::vector<std::pair<uint32_t, uint32_t>> & cell_ranges, llama_seq_id seq_id = -1) const; | |
| void state_write_data(llama_io_write_i & io, const std::vector<std::pair<uint32_t, uint32_t>> & cell_ranges) const; | |
| bool state_read_meta(llama_io_read_i & io, uint32_t cell_count, llama_seq_id dest_seq_id = -1); | |
| bool state_read_data(llama_io_read_i & io, uint32_t cell_count); | |
| }; | |
| class llama_memory_recurrent_context : public llama_memory_context_i { | |
| public: | |
| // used for errors | |
| llama_memory_recurrent_context(llama_memory_status status); | |
| // used to create a full-cache or update context | |
| llama_memory_recurrent_context( | |
| llama_memory_recurrent * mem); | |
| // used to create a batch processing context from a batch | |
| llama_memory_recurrent_context( | |
| llama_memory_recurrent * mem, | |
| std::vector<llama_ubatch> ubatches); | |
| virtual ~llama_memory_recurrent_context(); | |
| // | |
| // llama_memory_context_i | |
| // | |
| bool next() override; | |
| bool apply() override; | |
| llama_memory_status get_status() const override; | |
| const llama_ubatch & get_ubatch() const override; | |
| // | |
| // llama_memory_recurrent_context specific API | |
| // | |
| uint32_t get_n_rs() const; | |
| uint32_t get_head() const; | |
| int32_t get_rs_z() const; | |
| uint32_t get_size() const; | |
| ggml_tensor * get_r_l(int32_t il) const; | |
| ggml_tensor * get_s_l(int32_t il) const; | |
| int32_t s_copy(int i) const; | |
| private: | |
| const llama_memory_status status; | |
| llama_memory_recurrent * mem; | |
| size_t i_next = 0; | |
| std::vector<llama_ubatch> ubatches; | |
| // | |
| // data needed for building the compute graph for the current ubatch: | |
| // TODO: extract all the state like `head` and `n` here | |
| // | |
| const bool is_full = false; | |
| }; | |