mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	* model-conversion : remove hardcoded /bin/bash shebangs [no ci] This commit updates the bash scripts to use env instead of using hardcoded /bin/bash in the shebang line. The motivation for this is that some systems may have bash installed in a different location, and using /usr/bin/env bash ensures that the script will use the first bash interpreter found in the user's PATH, making the scripts more portable across different environments. * model-conversion : rename script to .py [no ci] This commit renames run-casual-gen-embeddings-org.sh to run-casual-gen-embeddings-org.py to reflect its Python nature.
		
			
				
	
	
		
			36 lines
		
	
	
		
			897 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			897 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
set -e
 | 
						|
 | 
						|
CONVERTED_MODEL="${1:-"$CONVERTED_MODEL"}"
 | 
						|
 | 
						|
# Final check if we have a model path
 | 
						|
if [ -z "$CONVERTED_MODEL" ]; then
 | 
						|
    echo "Error: Model path must be provided either as:" >&2
 | 
						|
    echo "  1. Command line argument" >&2
 | 
						|
    echo "  2. CONVERTED_MODEL environment variable" >&2
 | 
						|
    exit 1
 | 
						|
fi
 | 
						|
 | 
						|
# Check if data/wikitext-2-raw directory exists
 | 
						|
if [ ! -d "ppl/wikitext-2-raw" ]; then
 | 
						|
    echo "ppl/wikitext-2-raw directory does not exist. Downloading..." >&2
 | 
						|
    mkdir -p ppl
 | 
						|
    pushd ppl
 | 
						|
    ./../../../scripts/get-wikitext-2.sh
 | 
						|
    popd
 | 
						|
fi
 | 
						|
 | 
						|
mkdir -p ppl
 | 
						|
OUTPUTFILE="ppl/$(basename $CONVERTED_MODEL).kld"
 | 
						|
echo "Model: $CONVERTED_MODEL"
 | 
						|
 | 
						|
cmake --build ../../build --target llama-perplexity -j8
 | 
						|
 | 
						|
../.././build/bin/llama-perplexity -m $CONVERTED_MODEL \
 | 
						|
    -f ppl/wikitext-2-raw/wiki.test.raw \
 | 
						|
    --kl-divergence-base $OUTPUTFILE
 | 
						|
 | 
						|
echo "Generated logits in $OUTPUTFILE"
 | 
						|
 |