Spaces:
Running
Running
Download engine/models.py from cereeenn120/StoryChatBot: direct link, hf CLI and curl.
- Browser
- Download file 4.76 kB
-
https://huggingface.co/spaces/cereeenn120/StoryChatBot/resolve/main/engine/models.py
- Command line
-
hf download hf://spaces/cereeenn120/StoryChatBot/engine/models.py
-
curl -L -o models.py https://huggingface.co/spaces/cereeenn120/StoryChatBot/resolve/main/engine/models.py
4.76 kB
| """Model and language choices shared by the browser UI and chat backend.""" | |
| MODELS = [ | |
| ("DeepSeek V3", "deepseek-ai/DeepSeek-V3"), | |
| ("DeepSeek V3.2", "deepseek-ai/DeepSeek-V3.2"), | |
| ("DeepSeek V4 Flash", "deepseek-ai/DeepSeek-V4-Flash"), | |
| ("DeepSeek V4 Pro", "deepseek-ai/DeepSeek-V4-Pro"), | |
| ("DeepSeek R1 Distill Llama 70B abliterated", "huihui-ai/DeepSeek-R1-Distill-Llama-70B-abliterated:featherless-ai"), | |
| ("DeepSeek R1 Distill NSFW", "mergekit-community/Deepseek-R1-Distill-NSFW-RPv1:featherless-ai"), | |
| ("GPT OSS 120B", "openai/gpt-oss-120b"), | |
| ("GLM 4.5", "zai-org/GLM-4.5"), | |
| ("GLM 5.2", "zai-org/GLM-5.2"), | |
| ("GLM 5.3", "zai-org/GLM-5.3"), | |
| ("Gemma 3 27B", "google/gemma-3-27b-it"), | |
| ("Gemma 4 E4B OBLITERATED", "OBLITERATUS/gemma-4-E4B-it-OBLITERATED:featherless-ai"), | |
| ("Gemma 4 26B A4B uncensored", "TrevorJS/gemma-4-26B-A4B-it-uncensored:featherless-ai"), | |
| ("Gemma 4 26B A4B uncensored GGUF", "TrevorJS/gemma-4-26B-A4B-it-uncensored-GGUF:featherless-ai"), | |
| ("Gemma 4 31B uncensored", "TrevorJS/gemma-4-31B-it-uncensored:featherless-ai"), | |
| ("Gemma 4 31B uncensored GGUF", "TrevorJS/gemma-4-31B-it-uncensored-GGUF:featherless-ai"), | |
| ("Gemma The Writer 9B HERETIC", "DavidAU/Gemma-The-Writer-9B-HERETIC-Uncensored-Abliterated:featherless-ai"), | |
| ("Microsoft Phi 4", "microsoft/phi-4"), | |
| ("Kimi K2 Instruct", "moonshotai/Kimi-K2-Instruct:novita"), | |
| ("Kimi K2 Thinking", "moonshotai/Kimi-K2-Thinking"), | |
| ("MiniMax M2.5", "MiniMaxAI/MiniMax-M2.5"), | |
| ("MiniMax M2.7", "MiniMaxAI/MiniMax-M2.7"), | |
| ("Llama 3.3 70B Instruct", "meta-llama/Llama-3.3-70B-Instruct"), | |
| ("Llama 3.3 70B abliterated", "huihui-ai/Llama-3.3-70B-Instruct-abliterated:featherless-ai"), | |
| ("Llama 3.3 8B Thinking HERETIC", "DavidAU/Llama3.3-8B-Instruct-Thinking-Heretic-Uncensored-Claude-4.5-Opus-High-Reasoning:featherless-ai"), | |
| ("Qwen 2.5 72B Instruct", "Qwen/Qwen2.5-72B-Instruct"), | |
| ("Qwen 2.5 72B abliterated", "huihui-ai/Qwen2.5-72B-Instruct-abliterated:featherless-ai"), | |
| ("Qwen 3 235B Instruct", "Qwen/Qwen3-235B-A22B-Instruct-2507"), | |
| ("Qwen 3 32B abliterated", "huihui-ai/Qwen3-32B-abliterated:featherless-ai"), | |
| ("Qwen3.8 27B OBLITERATED", "OBLITERATUS/Qwen3.8-27B-OBLITERATED:featherless-ai"), | |
| ("Qwen3.8 27B AEON Ultimate", "AEON-7/Qwen3.8-27B-AEON-ULTIMATE-UNCENSORED-BF16:featherless-ai"), | |
| ("NeuralDaredevil 8B abliterated", "mlabonne/NeuralDaredevil-8B-abliterated:featherless-ai"), | |
| ("Huihui Qwen 3 14B abliterated v2", "huihui-ai/Huihui-Qwen3-14B-abliterated-v2:featherless-ai"), | |
| ("Huihui Qwen 3 8B abliterated v2", "huihui-ai/Huihui-Qwen3-8B-abliterated-v2:featherless-ai"), | |
| ("Huihui Qwythos 9B abliterated", "huihui-ai/Huihui-Qwythos-9B-Claude-Mythos-5-1M-abliterated:featherless-ai"), | |
| ("Qwythos 9B Claude Mythos", "empero-ai/Qwythos-9B-Claude-Mythos-5-1M:featherless-ai"), | |
| ] | |
| LANGUAGES = ["English", "Chinese", "Hindi", "Spanish", "Arabic", "French", "Bengali", "Portuguese", "Indonesian", "Russian", "German", "Japanese", "Turkish"] | |
| DEFAULT_MODEL = "deepseek-ai/DeepSeek-V3" | |
| TRANSLATION_MODEL = "deepseek-ai/DeepSeek-V4-Pro" | |
| STORY_THEMES = ["Adventure", "Mystery", "Fantasy", "Science fiction", "Horror", "Romance", "Drama", "Comedy", "Thriller", "Slice of life", "Historical", "Coming of age", "Supernatural", "Political intrigue", "Erotic"] | |
| # Story-chat controls are user-facing presets resolved to provider parameters. | |
| # Keep one entry per selectable model so models can be tuned independently. | |
| _STORY_LENGTHS = {"short": 800, "balanced": 1400, "long": 2400} | |
| _STORY_STYLES = { | |
| "grounded": {"temperature": 0.55, "frequency_penalty": 0.45}, | |
| "balanced": {"temperature": 0.75, "frequency_penalty": 0.55}, | |
| "imaginative": {"temperature": 0.95, "frequency_penalty": 0.65}, | |
| } | |
| STORY_PARAMETER_TABLE = { | |
| model_id: {"lengths": dict(_STORY_LENGTHS), "styles": {key: dict(value) for key, value in _STORY_STYLES.items()}} | |
| for _, model_id in MODELS | |
| } | |
| def story_generation_parameters(model_id: str, length: str, style: str) -> dict: | |
| """Resolve simple Story Chat settings to this model's generation parameters.""" | |
| if length not in _STORY_LENGTHS or style not in _STORY_STYLES: | |
| raise ValueError("Choose a supported story length and style.") | |
| preset = STORY_PARAMETER_TABLE.get(model_id, { | |
| "lengths": _STORY_LENGTHS, "styles": _STORY_STYLES, | |
| }) | |
| result = {"max_tokens": preset["lengths"][length]} | |
| result.update(preset["styles"][style]) | |
| return result | |
| def is_mature_model(label: str, model_id: str) -> bool: | |
| markers = ("abliterated", "uncensored", "unrestricted", "heretic", "nsfw", "obliterated") | |
| text = f"{label} {model_id}".casefold() | |
| return any(marker in text for marker in markers) | |