Instructions to use RecursiveSI/flint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RecursiveSI/flint with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RecursiveSI/flint") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RecursiveSI/flint") model = AutoModelForCausalLM.from_pretrained("RecursiveSI/flint", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RecursiveSI/flint with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RecursiveSI/flint" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RecursiveSI/flint", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RecursiveSI/flint
- SGLang
How to use RecursiveSI/flint 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 "RecursiveSI/flint" \ --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": "RecursiveSI/flint", "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 "RecursiveSI/flint" \ --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": "RecursiveSI/flint", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RecursiveSI/flint with Docker Model Runner:
docker model run hf.co/RecursiveSI/flint
Download sglang/fa4-learned-sink-fix.patch from RecursiveSI/flint: direct link, hf CLI and curl.
- Browser
- Download file 5.08 kB
-
https://huggingface.co/RecursiveSI/flint/resolve/main/sglang/fa4-learned-sink-fix.patch
- Command line
-
hf download hf://RecursiveSI/flint/sglang/fa4-learned-sink-fix.patch
-
curl -L -o fa4-learned-sink-fix.patch https://huggingface.co/RecursiveSI/flint/resolve/main/sglang/fa4-learned-sink-fix.patch
5.08 kB
| --- a/python/sglang/jit_kernel/flash_attn/cute/flash_fwd_sm100.py | |
| +++ b/python/sglang/jit_kernel/flash_attn/cute/flash_fwd_sm100.py | |
| self.load_warp_ids = (14, 15) | |
| self.empty_warp_ids = () | |
| + self.tmem_alloc_warp_ids = ( | |
| + self.mma_warp_id, | |
| + *self.softmax0_warp_ids, | |
| + *self.softmax1_warp_ids, | |
| + *self.correction_warp_ids, | |
| + ) | |
| if self.use_correction_warps_for_epi: | |
| self.empty_warp_ids = self.empty_warp_ids + self.epilogue_warp_ids | |
| self.epilogue_warp_ids = self.correction_warp_ids | |
| tmem_alloc_barrier = pipeline.NamedBarrier( | |
| barrier_id=int(NamedBarrierFwdSm100.TmemPtr), | |
| - num_threads=cute.arch.WARP_SIZE | |
| - * len( | |
| - ( | |
| - self.mma_warp_id, | |
| - *self.softmax0_warp_ids, | |
| - *self.softmax1_warp_ids, | |
| - *self.correction_warp_ids, | |
| - ) | |
| - ), | |
| + num_threads=cute.arch.WARP_SIZE * len(self.tmem_alloc_warp_ids), | |
| ) | |
| # Tensor memory dealloc barrier init | |
| tmem = cutlass.utils.TmemAllocator( | |
| # /////////////////////////////////////////////////////////////////////////////// | |
| # MMA | |
| # /////////////////////////////////////////////////////////////////////////////// | |
| + tmem.allocate(cute.arch.get_max_tmem_alloc_cols("sm_100")) | |
| + if warp_idx in self.tmem_alloc_warp_ids: | |
| + tmem.wait_for_alloc() | |
| if warp_idx == self.mma_warp_id: | |
| cute.arch.setmaxregister_decrease(self.num_regs_other) | |
| - # Alloc tensor memory buffer | |
| - tmem.allocate(cute.arch.get_max_tmem_alloc_cols("sm_100")) | |
| - tmem.wait_for_alloc() | |
| tmem_ptr = tmem.retrieve_ptr(self.qk_acc_dtype) | |
| self.mma( | |
| tiled_mma_qk, | |
| ) or (const_expr(self.q_stage == 1) and warp_idx <= self.softmax0_warp_ids[-1]): | |
| # increase register after decreasing | |
| cute.arch.setmaxregister_increase(self.num_regs_softmax) | |
| - # sync with mma warp before retrieving tmem ptr | |
| - tmem.wait_for_alloc() | |
| tmem_ptr = tmem.retrieve_ptr(self.qk_acc_dtype) | |
| softmax_loop = partial( | |
| self.softmax_loop, | |
| # /////////////////////////////////////////////////////////////////////////////// | |
| if warp_idx >= self.correction_warp_ids[0] and warp_idx < self.mma_warp_id: | |
| cute.arch.setmaxregister_decrease(self.num_regs_correction) | |
| - # sync with mma warp before retrieving tmem ptr | |
| - tmem.wait_for_alloc() | |
| tmem_ptr = tmem.retrieve_ptr(self.qk_acc_dtype) | |
| self.correction_loop( | |
| thr_mma_qk, | |
| else: | |
| row_max = None | |
| pipeline_sm_stats.consumer_release_w_index(stage) | |
| + sink_rescale = Float32(1.0) | |
| if const_expr(learnable_sink is not None): | |
| LOG2_E = math.log2(math.e) | |
| sink_val = learnable_sink_val[stage] | |
| row_max = sink_val * (LOG2_E / softmax_scale_log2_eff) | |
| row_sum = max_offset_scale | |
| else: | |
| - row_sum += cute.math.exp2( | |
| - sink_val * LOG2_E | |
| - - row_max * softmax_scale_log2_eff | |
| - + max_offset, | |
| + old_max_log2 = row_max * softmax_scale_log2_eff | |
| + new_max_log2 = max(old_max_log2, sink_val * LOG2_E) | |
| + sink_rescale = cute.math.exp2( | |
| + old_max_log2 - new_max_log2, fastmath=True | |
| + ) | |
| + row_sum = row_sum * sink_rescale + cute.math.exp2( | |
| + sink_val * LOG2_E - new_max_log2 + max_offset, | |
| fastmath=True, | |
| ) | |
| + row_max = new_max_log2 / softmax_scale_log2_eff | |
| acc_O_mn_row_is_zero_or_nan = row_sum == 0.0 or row_sum != row_sum | |
| stats[stage] = (row_sum, row_max, acc_O_mn_row_is_zero_or_nan) | |
| scale = cute.arch.rcp_approx( | |
| row_sum if not acc_O_mn_row_is_zero_or_nan else 1.0 | |
| ) | |
| - scale = scale * v_descale | |
| + scale = scale * sink_rescale * v_descale | |
| # Wait for the last O to be ready from the MMA warp | |
| pipeline_o_acc.consumer_wait_w_index_phase( | |
| stage, o_corr_consumer_phase | |