Files
Magicoder-S-DS-6.7B-MLX/run.py
ModelHub XC 3cd658815f 初始化项目,由ModelHub XC社区提供模型
Model: davideuler/Magicoder-S-DS-6.7B-MLX
Source: Original Platform
2026-05-02 20:16:58 +08:00

6 lines
723 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from mlx_lm import load, generate
#model, tokenizer = load("mlx-community/Magicoder-S-DS-6.7B-MLX")
model, tokenizer = load("./")
response = generate(model, tokenizer, max_tokens=1024, prompt="Python 里面如何按照方法的调用次数以及方法参数值 limit_key 来做限流?需要考虑到滑动窗口,使用函数的第一个参数作 limit_key按照每5分钟对于每一个 limit_key 参数值,仅允许调用 20次请给出代码实现。 要考虑到滑动窗口需要清空滑动窗口前的数据而不是最后一次调用之后5分钟清空所有计数。 最后请给出单元测试用例,以及执行测试用例的方法; It is used in rate limiting API calls.", verbose=True)