Instructions to use mofosyne/TinyLLama-v0-5M-F16-llamafile with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="mofosyne/TinyLLama-v0-5M-F16-llamafile", filename="TinyLLama-4.6M-v0.0-F16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16 # Run inference directly in the terminal: llama cli -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16 # Run inference directly in the terminal: llama cli -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16 # Run inference directly in the terminal: ./llama-cli -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
Use Docker
docker model run hf.co/mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
- LM Studio
- Jan
- vLLM
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mofosyne/TinyLLama-v0-5M-F16-llamafile" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mofosyne/TinyLLama-v0-5M-F16-llamafile", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
- Ollama
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with Ollama:
ollama run hf.co/mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
- Unsloth Studio
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for mofosyne/TinyLLama-v0-5M-F16-llamafile to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for mofosyne/TinyLLama-v0-5M-F16-llamafile to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for mofosyne/TinyLLama-v0-5M-F16-llamafile to start chatting
- Atomic Chat new
- Docker Model Runner
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with Docker Model Runner:
docker model run hf.co/mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
- Lemonade
How to use mofosyne/TinyLLama-v0-5M-F16-llamafile with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mofosyne/TinyLLama-v0-5M-F16-llamafile:F16
Run and chat with the model
lemonade run user.TinyLLama-v0-5M-F16-llamafile-F16
List all available models
lemonade list
test new proposed outfile naming convention changes to llama.cpp conversion script
Browse files- .args +1 -1
- .gitmodules +3 -3
- TinyLLama-v0.1-5M-F16.gguf → Tinyllama-5M-v0.2-F16.gguf +2 -2
- TinyLLama-v0.1-5M-F16.llamafile → Tinyllama-5M-v0.2-F16.llamafile +2 -2
- llama.cpp +1 -1
- llamafile +1 -1
- llamafile-creation-legacy.sh +52 -0
- llamafile-creation.sh +2 -2
- maykeye_tinyllama-metadata.json +2 -2
.args
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-m
|
| 2 |
-
|
|
|
|
| 1 |
-m
|
| 2 |
+
Tinyllama-5M-v0.2-F16.gguf
|
.gitmodules
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
[submodule "maykeye_tinyllama"]
|
| 2 |
path = maykeye_tinyllama
|
| 3 |
url = https://huggingface.co/Maykeye/TinyLLama-v0
|
| 4 |
-
[submodule "llama.cpp"]
|
| 5 |
-
path = llama.cpp
|
| 6 |
-
url = git@github.com:ggerganov/llama.cpp.git
|
| 7 |
[submodule "llamafile"]
|
| 8 |
path = llamafile
|
| 9 |
url = git@github.com:Mozilla-Ocho/llamafile.git
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
[submodule "maykeye_tinyllama"]
|
| 2 |
path = maykeye_tinyllama
|
| 3 |
url = https://huggingface.co/Maykeye/TinyLLama-v0
|
|
|
|
|
|
|
|
|
|
| 4 |
[submodule "llamafile"]
|
| 5 |
path = llamafile
|
| 6 |
url = git@github.com:Mozilla-Ocho/llamafile.git
|
| 7 |
+
[submodule "llama.cpp"]
|
| 8 |
+
path = llama.cpp
|
| 9 |
+
url = git@github.com:mofosyne/llama.cpp.git
|
TinyLLama-v0.1-5M-F16.gguf → Tinyllama-5M-v0.2-F16.gguf
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0422a7e84b0d8a6ebc77513ec4fe53979850b9f6235265eba76e3e954072f86
|
| 3 |
+
size 10008256
|
TinyLLama-v0.1-5M-F16.llamafile → Tinyllama-5M-v0.2-F16.llamafile
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0098e4ca8bbf84474fc65105d9149047d73ad964481182b954efae4ab5a9bfe9
|
| 3 |
+
size 19281727
|
llama.cpp
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit 00ff73a90101c76108131a5867a3c3c78a42ee8c
|
llamafile
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit 9cd8d70942a049ba3c3bddd12e87e1fb599fbd49
|
llamafile-creation-legacy.sh
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
MODEL_DIR="maykeye_tinyllama"
|
| 4 |
+
METADATA_FILE="maykeye_tinyllama-metadata.json"
|
| 5 |
+
|
| 6 |
+
###############################################################################
|
| 7 |
+
# Pull both model folder, llamafile (for the engine) and llama.cpp (for the conversion script)
|
| 8 |
+
echo == Prep Enviroment ==
|
| 9 |
+
git submodule update --init
|
| 10 |
+
|
| 11 |
+
###############################################################################
|
| 12 |
+
echo == Build and prep the llamafile engine execuable ==
|
| 13 |
+
pushd llamafile
|
| 14 |
+
make -j8
|
| 15 |
+
make
|
| 16 |
+
# This is where each executables is located for reference purpose for now as of 2024-04-05
|
| 17 |
+
# and was determined by running `sudo make install PREFIX=/usr/local`
|
| 18 |
+
# ./o/llamafile/zipalign --> /usr/local/bin/zipalign
|
| 19 |
+
# ./o/llama.cpp/main/main --> /usr/local/bin/llamafile
|
| 20 |
+
# ./o/llama.cpp/imatrix/imatrix --> /usr/local/bin/llamafile-imatrix
|
| 21 |
+
# ./o/llama.cpp/quantize/quantize --> /usr/local/bin/llamafile-quantize
|
| 22 |
+
# ./build/llamafile-convert --> /usr/local/bin/llamafile-convert
|
| 23 |
+
# ./o/llama.cpp/perplexity/perplexity --> /usr/local/bin/llamafile-perplexity
|
| 24 |
+
# ./o/llama.cpp/llava/llava-quantize --> /usr/local/bin/llava-quantize
|
| 25 |
+
popd
|
| 26 |
+
|
| 27 |
+
###############################################################################
|
| 28 |
+
echo == What is our llamafile name going to be? ==
|
| 29 |
+
OUTFILE=$(./llama.cpp/examples/convert-legacy-llama.py ${MODEL_DIR} --metadata ${METADATA_FILE} --outtype f16 --get-outfile)
|
| 30 |
+
echo We will be aiming to generate $OUTFILE.llamafile
|
| 31 |
+
|
| 32 |
+
###############################################################################
|
| 33 |
+
echo == Convert from safetensor to gguf ==
|
| 34 |
+
./llama.cpp/examples/convert-legacy-llama.py ${MODEL_DIR} --metadata ${METADATA_FILE} --outtype f16
|
| 35 |
+
mv ${MODEL_DIR}/${OUTFILE}.gguf ${OUTFILE}.gguf
|
| 36 |
+
|
| 37 |
+
###############################################################################
|
| 38 |
+
echo == Generating Llamafile ==
|
| 39 |
+
cp ./llamafile/o/llama.cpp/main/main ${OUTFILE}.llamafile
|
| 40 |
+
|
| 41 |
+
# Create an .args file with settings defaults
|
| 42 |
+
cat >.args <<EOF
|
| 43 |
+
-m
|
| 44 |
+
${OUTFILE}.gguf
|
| 45 |
+
EOF
|
| 46 |
+
|
| 47 |
+
# zip align engine, gguf and default args
|
| 48 |
+
./llamafile/o/llamafile/zipalign -j0 ${OUTFILE}.llamafile ${OUTFILE}.gguf .args
|
| 49 |
+
|
| 50 |
+
###############################################################################
|
| 51 |
+
echo == Test Output ==
|
| 52 |
+
./${OUTFILE}.llamafile --cli -p "hello world the gruff man said"
|
llamafile-creation.sh
CHANGED
|
@@ -26,12 +26,12 @@ popd
|
|
| 26 |
|
| 27 |
###############################################################################
|
| 28 |
echo == What is our llamafile name going to be? ==
|
| 29 |
-
OUTFILE=$(./llama.cpp/convert.py ${MODEL_DIR} --metadata ${METADATA_FILE} --outtype f16 --get-outfile)
|
| 30 |
echo We will be aiming to generate $OUTFILE.llamafile
|
| 31 |
|
| 32 |
###############################################################################
|
| 33 |
echo == Convert from safetensor to gguf ==
|
| 34 |
-
./llama.cpp/convert.py ${MODEL_DIR} --metadata ${METADATA_FILE} --outtype f16
|
| 35 |
mv ${MODEL_DIR}/${OUTFILE}.gguf ${OUTFILE}.gguf
|
| 36 |
|
| 37 |
###############################################################################
|
|
|
|
| 26 |
|
| 27 |
###############################################################################
|
| 28 |
echo == What is our llamafile name going to be? ==
|
| 29 |
+
OUTFILE=$(./llama.cpp/convert-hf-to-gguf.py ${MODEL_DIR} --metadata ${METADATA_FILE} --outtype f16 --get-outfile)
|
| 30 |
echo We will be aiming to generate $OUTFILE.llamafile
|
| 31 |
|
| 32 |
###############################################################################
|
| 33 |
echo == Convert from safetensor to gguf ==
|
| 34 |
+
./llama.cpp/convert-hf-to-gguf.py ${MODEL_DIR} --metadata ${METADATA_FILE} --outtype f16 --verbose
|
| 35 |
mv ${MODEL_DIR}/${OUTFILE}.gguf ${OUTFILE}.gguf
|
| 36 |
|
| 37 |
###############################################################################
|
maykeye_tinyllama-metadata.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
{
|
| 2 |
"general.name": "TinyLLama",
|
| 3 |
-
"general.version": "v0.
|
| 4 |
"general.author": "mofosyne",
|
| 5 |
"general.url": "https://huggingface.co/mofosyne/TinyLLama-v0-llamafile",
|
| 6 |
"general.description": "This gguf is ported from a first version of Maykeye attempt at recreating roneneldan/TinyStories-1M but using Llama architecture",
|
| 7 |
"general.license": "apache-2.0",
|
| 8 |
"general.source.url": "https://huggingface.co/Maykeye/TinyLLama-v0",
|
| 9 |
-
"general.source.huggingface.repository": "
|
| 10 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"general.name": "TinyLLama",
|
| 3 |
+
"general.version": "v0.2",
|
| 4 |
"general.author": "mofosyne",
|
| 5 |
"general.url": "https://huggingface.co/mofosyne/TinyLLama-v0-llamafile",
|
| 6 |
"general.description": "This gguf is ported from a first version of Maykeye attempt at recreating roneneldan/TinyStories-1M but using Llama architecture",
|
| 7 |
"general.license": "apache-2.0",
|
| 8 |
"general.source.url": "https://huggingface.co/Maykeye/TinyLLama-v0",
|
| 9 |
+
"general.source.huggingface.repository": "Maykeye/TinyLLama-v0"
|
| 10 |
}
|