Spaces:
Running on Zero
Running on Zero
Download appTest.py from AnilNiraula/FineTune: direct link, hf CLI and curl.
- Browser
- Download file 550 Bytes
-
https://huggingface.co/spaces/AnilNiraula/FineTune/resolve/main/appTest.py
- Command line
-
hf download hf://spaces/AnilNiraula/FineTune/appTest.py
-
curl -L -o appTest.py https://huggingface.co/spaces/AnilNiraula/FineTune/resolve/main/appTest.py
550 Bytes
| from encoding_dsv4 import encode_messages, parse_message_from_completion_text | |
| messages = [ | |
| {"role": "user", "content": "hello"}, | |
| {"role": "assistant", "content": "Hello! I am DeepSeek.", "reasoning_content": "thinking..."}, | |
| {"role": "user", "content": "1+1=?"} | |
| ] | |
| # messages -> string | |
| prompt = encode_messages(messages, thinking_mode="thinking", reasoning_effort="max") | |
| # string -> tokens | |
| import transformers | |
| tokenizer = transformers.AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V4-Flash-0731") | |
| tokens = tokenizer.encode(prompt) | |