Spaces:
Build error
Build error
Download LLMS.py from karthik45456e/phi2: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/spaces/karthik45456e/phi2/resolve/main/LLMS.py
- Command line
-
hf download hf://spaces/karthik45456e/phi2/LLMS.py
-
curl -L -o LLMS.py https://huggingface.co/spaces/karthik45456e/phi2/resolve/main/LLMS.py
1.77 kB
| from llama_cpp import Llama | |
| def die(type): | |
| llm = Llama(model_path="./DeepSeek-Coder-V2-Lite-Instruct-Q5_K_S.gguf") | |
| responses = llm( | |
| f"""I am a {type} person | |
| Create a diet plan to lose weight for a month i Want in the format : | |
| Week 1:\n | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| Week 2:\n | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| Week 3:\n | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| Week 4: | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| """, | |
| max_tokens=1000, | |
| temperature=0.7, | |
| top_p=0.95, | |
| top_k=40 | |
| ) | |
| return responses['choices'][0]['text'] | |
| def di(type): | |
| llm = Llama(model_path="./DeepSeek-Coder-V2-Lite-Instruct-Q5_K_S.gguf") | |
| responses = llm( | |
| f""" I am a person | |
| Create a diet plan to {di} for a month i Want in the format : | |
| Week 1:\n | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| Week 2:\n | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| Week 3:\n | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| Week 4: | |
| - Breakfast:\n | |
| - Lunch:\n | |
| - Dinner:\n | |
| """, | |
| max_tokens=600, | |
| temperature=0.7, | |
| top_p=0.95, | |
| top_k=40 | |
| ) | |
| return responses['choices'][0]['text'] | |
| def chats(type): | |
| llm = Llama(model_path="./metamath-13b-v10Q4_K_M.gguf") | |
| responses = llm( | |
| type, | |
| max_tokens=100, # Increased token limit to ensure full plan generation | |
| temperature=0.6, # Lower temperature for more deterministic output | |
| top_p=0.8, # Adjusted for balance between speed and quality | |
| top_k=50 | |
| ) | |
| return responses['choices'][0]['text'] |