当前位置: 首页 > news >正文

非常棒的推理项目FreeToken,据说非常快!

repo:GitHub - FlashML-org/FreeToken · GitHub

实践

下载模型

注意modelscope要升级到新版本,比如openi里面自带的版本低,下载会报错.

pip install modelscope -U
modelscope download --model empero-ai/Qwen3.8-4B-Distill

Downloading snapshot of empero-ai/Qwen3.8-4B-Distill (model)…
2026-08-22 14:39:01,641 | INFO | modelscope_hub.download | Downloading 14 files from empero-ai/Qwen3.8-4B-Distill@master
Downloading: 100%|███████████████████████████| 14/14 [15:30<00:00, 66.49s/file]
✓ Snapshot ready at /home/skywalk/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master

安装FreeToken

pip install uv uv venv uv pip install "freetoken[accel]"

uv 安装的时候如果慢就加上清华源

-i https://pypi.tuna.tsinghua.edu.cn/simple

启动

ft serve --model ~/models/Qwen3.6-35B-A3B # ft serve --model /home/skywalk/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master/

可惜啊,这个显卡太老了,还是跑不起来

(root) root@fb98:~# ft serve --model /home/skywalk/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master/ [2026-08-22|15:56:13] INFO Parsed arguments: ServerArgs(model_path='/home/skywalk/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master/', tp_info=DistributedInfo(rank=0, size=1), dtype=torch.bfloat16, max_running_req=4, attention_backend='auto', moe_backend='auto', nvfp4_backend='triton', expert_load='auto', moe_cache_size=0, moe_cache_rate=None, moe_cache_auto=False, kv_reserve_tokens=8192, moe_cache_policy='lru', moe_prefill_overlap=True, moe_prefill_hit_d2d=False, moe_collect_stats=False, moe_cpu_threads=0, moe_cpu_layers=None, moe_hybrid_max_fetch=-1, cuda_graph_bs=None, cuda_graph_max_bs=None, page_size=1, memory_ratio=0.9, linear_state_cache_ratio=2.0, swa_full_tokens_ratio=0.2, swa_num_pages_override=None, distributed_timeout=60.0, use_dummy_weight=False, use_pynccl=True, max_seq_len_override=None, num_page_override=None, num_token_override=None, max_extend_tokens=8192, cache_type='radix', offline_mode=False, decode_log_interval=40, special_token_ckpt=False, _unique_suffix='.pid=5761', server_host='127.0.0.1', server_port=1919, num_tokenizer=0, silent_output=False, shell_mode=False, served_model_name='master', tool_call_parser='qwen3_coder', reasoning_parser='qwen3', sampling_defaults='model', max_output_tokens=None, enable_cache_report=False, cors_origins='tauri://localhost,http://tauri.localhost,http://localhost:1420') [2026-08-22|15:56:13|FrontendAPI] INFO Default sampling config (source=framework): temperature=0.0, top_k=-1, top_p=1.0 INFO: Started server process [5761] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:1919 (Press CTRL+C to quit) /root/.venv/lib/python3.10/site-packages/freetoken/engine/engine.py:967: FutureWarning: torch.cuda._set_allocator_settings is deprecated. Use torch._C._accelerator_setAllocatorSettings instead. torch.cuda.memory._set_allocator_settings("expandable_segments:True") [2026-08-22|15:56:19|core|rank=0] INFO Enabled expandable_segments (override via PYTORCH_ALLOC_CONF) /root/.venv/lib/python3.10/site-packages/torch/cuda/__init__.py:180: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 304: OS call failed or operation not supported on this OS (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:119.) return torch._C._cuda_getDeviceCount() > 0 [2026-08-22|15:56:19|core|rank=0] INFO Auto-selected attention backend: fi [2026-08-22|15:56:19|core|rank=0] INFO Resolved config: attention_backend='fi', cache_type='hybrid_radix', page_size=1 [2026-08-22|15:56:19|FrontendAPI] ERROR Backend supervisor: RuntimeError: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 304: OS call failed or operation not supported on this OS Process freetoken-TP0-scheduler: Traceback (most recent call last): File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/root/.venv/lib/python3.10/site-packages/freetoken/server/launch.py", line 74, in _run_scheduler scheduler = Scheduler(args) File "/root/.venv/lib/python3.10/site-packages/freetoken/scheduler/scheduler.py", line 64, in __init__ self.engine = Engine(config) File "/root/.venv/lib/python3.10/site-packages/freetoken/engine/engine.py", line 300, in __init__ torch.cuda.set_device(self.device) File "/root/.venv/lib/python3.10/site-packages/torch/cuda/__init__.py", line 638, in set_device torch._C._cuda_setDevice(device) File "/root/.venv/lib/python3.10/site-packages/torch/cuda/__init__.py", line 478, in _lazy_init torch._C._cuda_init() RuntimeError: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 304: OS call failed or operation not supported on this OS [2026-08-22|15:56:29|FrontendAPI] ERROR Backend worker is gone and cannot be restarted; stopping the API server INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [5761] /usr/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 3 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '

在openi尝试

设置加速镜像

export HF_ENDPOINT=https://hf-mirror.com

启动

ft serve --model empero-ai/Qwen3.8-4B-Distill

使用先前下载的模型,模型下载到:

/mnt/workspace/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master
ft serve --model /mnt/workspace/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master

调试

碰到报错

启动模型报错,使用命令:ft serve --model /mnt/workspace/.cache/modelscope/models/empero-ai--Qwen3.8-4B-Distill/snapshots/master,报错信息:
: /usr/local/cuda/bin/nvcc --generate-dependencies-with-compile -MF /root/.cache/flashinfer/0.6.18/80/cached_ops/batch_prefill_with_kv_cache_dtype_q_bf16_dtype_kv_bf16_dtype_o_bf16_dtype_idx_i32_head_dim_qk_256_head_dim_vo_256_posenc_0_use_swa_False_use_logits_cap_False_f16qk_False/batch_prefill_with_kv_cache_dtype_q_bf16_dtype_kv_bf16_dtype_o_bf16_dtype_idx_i32_head_dim_qk_256_head_dim_vo_256_posenc_0_use_swa_False_use_logits_cap_False_f16qk_False_batch_prefill_jit_binding.cuda.o.d -DPy_LIMITED_API=0x03090000 -D_GLIBCXX_USE_CXX11_ABI=1 -I/root/.venv/lib/python3.10/site-packages/flashinfer/data/cccl/cub -I/root/.venv/lib/python3.10/site-packages/flashinfer/data/cccl/libcudacxx/include -I/root/.venv/lib/python3.10/site-packages/flashinfer/data/cccl/thrust -isystem /opt/conda/include/python3.10 -isystem /usr/local/cuda/include -isystem /root/.venv/lib/python3.10/site-packages/tvm_ffi/include -isystem /root/.venv/lib/python3.10/site-packages/tvm_ffi/include -isystem /root/.venv/lib/python3.10/site-packages/flashinfer/data/include -isystem /root/.venv/lib/python3.10/site-packages/flashinfer/data/csrc -isystem /root/.venv/lib/python3.10/site-packages/flashinfer/data/cutlass/include -isystem /root/.venv/lib/python3.10/site-packages/flashinfer/data/cutlass/tools/util/include -isystem /root/.venv/lib/python3.10/site-packages/flashinfer/data/spdlog/include --compiler-options=-fPIC --expt-relaxed-constexpr -gencode=arch=compute_80,code=sm_80 -DFLASHINFER_ENABLE_FP8_E8M0 -DFLASHINFER_ENABLE_FP4_E2M1 -std=c++17 --threads=1 -use_fast_math -Xfatbin=-compress-all --compress-mode=size -DFLASHINFER_ENABLE_F16 -DFLASHINFER_ENABLE_BF16 -DFLASHINFER_ENABLE_FP8_E4M3 -DFLASHINFER_ENABLE_FP8_E5M2 -DNDEBUG -O3 -c /root/.cache/flashinfer/0.6.18/80/generated/batch_prefill_with_kv_cache_dtype_q_bf16_dtype_kv_bf16_dtype_o_bf16_dtype_idx_i32_head_dim_qk_256_head_dim_vo_256_posenc_0_use_swa_False_use_logits_cap_False_f16qk_False/batch_prefill_jit_binding.cu -o /root/.cache/flashinfer/0.6.18/80/cached_ops/batch_prefill_with_kv_cache_dtype_q_bf16_dtype_kv_bf16_dtype_o_bf16_dtype_idx_i32_head_dim_qk_256_head_dim_vo_256_posenc_0_use_swa_False_use_logits_cap_False_f16qk_False/batch_prefill_with_kv_cache_dtype_q_bf16_dtype_kv_bf16_dtype_o_bf16_dtype_idx_i32_head_dim_qk_256_head_dim_vo_256_posenc_0_use_swa_False_use_logits_cap_False_f16qk_False_batch_prefill_jit_binding.cuda.o
nvcc fatal : Unknown option '--compress-mode=size'
ninja: build stopped: subcommand failed.

[2026-08-30|00:52:01|FrontendAPI] ERROR Backend worker is gone and cannot be restarted; stopping the API server
INFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [1751]
已终止
(root) root@c85df02bb3364d1ba93b8f3bdb8fc6ea-task0-0:~# /opt/conda/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 3 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '

说是cuda版本低,问题我这就是cuda13啊! 但是nvcc确实低

root@c85df02bb3364d1ba93b8f3bdb8fc6ea-task0-0:~# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:16:06_PDT_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0

升级所有的

pip install pip -U uv pip install uv -U uv pip install "freetoken[accel]" -U

还是不行!

http://www.cnnetsun.cn/news/4322380.html

相关文章:

  • STM32H757驱动MIPI DSI竖屏:LVGL V9移植与动画实战
  • Claude Code Token不够用?六个实用技巧省下近一半成本
  • 智能体轨迹压缩成自动机:行为分析的新思路
  • Arduino IDE板级包路径配置与ESP32/ESP8266环境搭建实战
  • conda环境管理实战:从创建环境到Jupyter运行NumPy
  • 原生影视APP源码拆解:播放器内核与运营功能全解析
  • 多Agent协作实战:Hermes与DeepSeek Harness从配置到排错
  • TensorFlow vs PyTorch:深度学习框架选型与实战指南
  • 绿联DH4300 Plus评测:四盘位8G内存+NFC一碰连接的家庭私有云
  • 真人跑团综艺制作全流程:从TRPG规则到角色卡与发音统一
  • MATLAB极限学习机ELM多特征分类预测完整实战代码
  • 2025款马自达EZ-6澳洲全面测试:传统车企的电动化答卷
  • linux之域套接字
  • 市场温度如何判断?从估值、资金到交易结构的实用分析框架
  • Roblox《子货物》新手攻略:电量控制、职位分工与接敌策略全解析
  • 掼蛋7分牌首发策略与出牌权控制技巧
  • Flask + Vue 全栈实现医院预约挂号系统:从架构设计到并发控制
  • 06-01-排序集合-红黑树原理-SortedSet与SortedDictionary背后的数据结构
  • Claude Code联网实战:从代码助手到互联网Agent的能力跃迁
  • 300W大功率DCDC升压模块设计实战:从双相交错拓扑到国产芯片选型
  • 汽车摩托车检测数据集 | 4000张YOLO智慧交通数据集
  • 开源AI助手双龙虾接口模块:多上游适配与故障转移实战
  • 2018年Android笔试题为何仍是筛人利器?底层考点全解析
  • 运维开发核心能力与自动化平台构建实战解析
  • STM32智能鱼缸毕业设计全解析:从电路到代码实践
  • 理性看待AI泡沫:用技术评估框架拆解大模型公司含金量
  • AI视频生成新信号:Runway峰会嘉宾阵容变化如何重塑创作工作流
  • 会议转录成为知识库资产:从语音转文字到本地Markdown Vault管线
  • android开发转到java后端开发--Stream API
  • 点我达2019届校招算法笔试高频考点与备战策略解析