Skip to content

Commit

Permalink
Consolidate pyton samples
Browse files Browse the repository at this point in the history
  • Loading branch information
olpipi committed Jan 8, 2025
1 parent 51292b5 commit 9a9d41c
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 313 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/causal_lm_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
PYTHONPATH: "./build"
- run: >
. ./ov/setupvars.sh
&& timeout 25s ./samples/python/multinomial_causal_lm/multinomial_causal_lm.py ./open_llama_3b_v2/ b
&& timeout 25s ./samples/python/text_generation/multinomial_causal_lm.py ./open_llama_3b_v2/ b
env:
PYTHONPATH: "./build"
- run: >
Expand All @@ -79,7 +79,7 @@ jobs:
executable:
[
./build/samples/cpp/text_generation/beam_search_causal_lm,
python ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py,
python ./samples/python/text_generation/beam_search_causal_lm.py,
]
runs-on: ubuntu-20.04
defaults:
Expand Down Expand Up @@ -339,7 +339,7 @@ jobs:
- run: >
. ./ov/setupvars.sh
&& timeout 50s ./build/samples/cpp/text_generation/beam_search_causal_lm ./Qwen1.5-7B-Chat/ "你好!"
| diff <(timeout 50s ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py ./Qwen1.5-7B-Chat/ "你好!") -
| diff <(timeout 50s ./samples/python/text_generation/beam_search_causal_lm.py ./Qwen1.5-7B-Chat/ "你好!") -
env:
PYTHONPATH: "./build"
Expand Down Expand Up @@ -374,7 +374,7 @@ jobs:
- run: >
. ./ov/setupvars.sh
&& timeout 50s ./build/samples/cpp/text_generation/beam_search_causal_lm ./phi-2/ 69
| diff <(timeout 50s ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py ./phi-2/ 69) -
| diff <(timeout 50s ./samples/python/text_generation/beam_search_causal_lm.py ./phi-2/ 69) -
env:
PYTHONPATH: "./build"
Expand Down Expand Up @@ -409,7 +409,7 @@ jobs:
- run: >
. ./ov/setupvars.sh
&& timeout 50s ./build/samples/cpp/text_generation/beam_search_causal_lm ./notus-7b-v1/ 69
| diff <(timeout 50s ./samples/python/beam_search_causal_lm/beam_search_causal_lm.py ./notus-7b-v1/ 69) -
| diff <(timeout 50s ./samples/python/text_generation/beam_search_causal_lm.py ./notus-7b-v1/ 69) -
env:
PYTHONPATH: "./build"
Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:
source ./ov/setupvars.sh
./build/samples/cpp/text_generation/speculative_decoding_lm ./dolly-v2-7b/ ./dolly-v2-3b/ "Alan Turing was a" > predictions_speculative.txt
./build/samples/cpp/text_generation/greedy_causal_lm ./dolly-v2-7b/ "Alan Turing was a" > predictions_greedy.txt
python ./samples/python/speculative_decoding_lm/speculative_decoding_lm.py ./dolly-v2-7b/ ./dolly-v2-3b/ "Alan Turing was a" > predictions_py.txt
python ./samples/python/text_generation/speculative_decoding_lm.py ./dolly-v2-7b/ ./dolly-v2-3b/ "Alan Turing was a" > predictions_py.txt
python -c "
with open('predictions_greedy.txt', 'r') as f:
predicted_greedy = f.readline()
Expand Down Expand Up @@ -504,7 +504,7 @@ jobs:
./build/samples/cpp/text_generation/prompt_lookup_decoding_lm ./TinyLlama-1.1B-Chat-v1.0/ "$(<prompt.txt)" > predictions_prompt_lookup.txt
./build/samples/cpp/text_generation/greedy_causal_lm ./TinyLlama-1.1B-Chat-v1.0/ "$(<prompt.txt)" > predictions_greedy.txt
python ./samples/python/prompt_lookup_decoding_lm/prompt_lookup_decoding_lm.py ./TinyLlama-1.1B-Chat-v1.0/ "$(<prompt.txt)" > predictions_py.txt
python ./samples/python/text_generation/prompt_lookup_decoding_lm.py ./TinyLlama-1.1B-Chat-v1.0/ "$(<prompt.txt)" > predictions_py.txt
python -c "
with open('predictions_greedy.txt', 'r') as f:
predicted_greedy = f.readline()
Expand Down Expand Up @@ -693,7 +693,7 @@ jobs:
"
diff pred.txt ref.txt
echo "Chat sample cpp" passed
timeout 30s ./samples/python/chat_sample/chat_sample.py ./TinyLlama-1.1B-Chat-v1.0/ < input.txt > ./pred2.txt
timeout 30s ./samples/python/text_generation/chat_sample.py ./TinyLlama-1.1B-Chat-v1.0/ < input.txt > ./pred2.txt
diff pred2.txt ref.txt
echo "Chat sample python" passed
Expand Down
5 changes: 0 additions & 5 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@ install(DIRECTORY
DESTINATION samples/cpp COMPONENT cpp_samples_genai)

install(DIRECTORY
python/beam_search_causal_lm
python/benchmark_genai
python/chat_sample
python/text_generation
python/image_generation
python/multinomial_causal_lm
python/speculative_decoding_lm
python/visual_language_chat
python/whisper_speech_recognition
DESTINATION samples/python COMPONENT cpp_samples_genai
Expand Down
38 changes: 0 additions & 38 deletions samples/python/beam_search_causal_lm/README.md

This file was deleted.

50 changes: 0 additions & 50 deletions samples/python/benchmark_genai/README.md

This file was deleted.

46 changes: 0 additions & 46 deletions samples/python/chat_sample/README.md

This file was deleted.

48 changes: 0 additions & 48 deletions samples/python/multinomial_causal_lm/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions samples/python/prompt_lookup_decoding_lm/README.md

This file was deleted.

Loading

0 comments on commit 9a9d41c

Please sign in to comment.