|
22 | 22 | w_ov_link: https://storage.openvinotoolkit.org/repositories/openvino/packages/nightly/2025.1.0-18343-5e16b688156/openvino_toolkit_windows_2025.1.0.dev20250304_x86_64.zip |
23 | 23 |
|
24 | 24 | jobs: |
25 | | - cpp-chat_sample-ubuntu: |
26 | | - runs-on: ubuntu-24.04 |
27 | | - defaults: |
28 | | - run: |
29 | | - shell: bash |
30 | | - steps: |
31 | | - - uses: actions/checkout@v4 |
32 | | - with: |
33 | | - submodules: recursive |
34 | | - - uses: actions/setup-python@v4 |
35 | | - with: |
36 | | - python-version: 3.11 |
37 | | - - name: Install OpenVINO |
38 | | - run: | |
39 | | - mkdir ./ov/ |
40 | | - curl ${{ env.l_ov_link }} | tar --directory ./ov/ --strip-components 1 -xz |
41 | | - sudo ./ov/install_dependencies/install_openvino_dependencies.sh |
42 | | - - name: Build app |
43 | | - run: | |
44 | | - source ./ov/setupvars.sh |
45 | | - cmake -DCMAKE_BUILD_TYPE=Release -S ./ -B ./build/ |
46 | | - cmake --build ./build/ --config Release -j |
47 | | - - name: Download and convert and model |
48 | | - run: | |
49 | | - source ./ov/setupvars.sh |
50 | | - python -m pip install ./thirdparty/openvino_tokenizers/[transformers] --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly |
51 | | - python -m pip install -r ./samples/requirements.txt |
52 | | - optimum-cli export openvino --trust-remote-code --weight-format fp16 --model TinyLlama/TinyLlama-1.1B-Chat-v1.0 TinyLlama-1.1B-Chat-v1.0 |
53 | | - - name: Compare |
54 | | - env: |
55 | | - PYTHONPATH: "./build" |
56 | | - run: | |
57 | | - source ./ov/setupvars.sh |
58 | | - printf 'What is 2 + 2?\nWhat is the previous answer?\nAdd 1 to it.\nSubtract 5 from it.\nWhy is the sun yellow?\nWhat was my first question?\n' > ./input.txt |
59 | | - timeout 30s ./build/samples/cpp/text_generation/chat_sample ./TinyLlama-1.1B-Chat-v1.0/ < input.txt > ./pred.txt |
60 | | - python -c " |
61 | | - from transformers import AutoTokenizer, AutoModelForCausalLM |
62 | | - model_id = 'TinyLlama/TinyLlama-1.1B-Chat-v1.0' |
63 | | - tokenizer = AutoTokenizer.from_pretrained(model_id) |
64 | | - model = AutoModelForCausalLM.from_pretrained(model_id) |
65 | | - prompts = ['What is 2 + 2?', 'What is the previous answer?', 'Add 1 to it.', 'Subtract 5 from it.', 'Why is the sun yellow?', 'What was my first question?'] |
66 | | - def gen_prompt(prompt): |
67 | | - return {'role': 'user', 'content': prompt} |
68 | | - def gen_answer(answer): |
69 | | - return {'role': 'assistant', 'content': answer} |
70 | | - chat_history = [] |
71 | | - chat_prompt = '' |
72 | | - output = open('ref.txt', 'w') |
73 | | - for prompt in prompts: |
74 | | - output.write('question:\n') |
75 | | - chat_history.append(gen_prompt(prompt)) |
76 | | - chat_prompt = tokenizer.apply_chat_template(chat_history, tokenize=False, add_generation_prompt=True) |
77 | | - tokenized = tokenizer(chat_prompt, return_tensors='pt', add_special_tokens=False) |
78 | | - answer = model.generate(**tokenized, max_length=1000, do_sample=False) |
79 | | - answer_str = tokenizer.decode(answer[0, tokenized['input_ids'].numel():], skip_special_tokens=True) |
80 | | - chat_history.append(gen_answer(answer_str)) |
81 | | - output.write(answer_str) |
82 | | - output.write('\n----------\n') |
83 | | - output.write('question:\n') |
84 | | - output.close() |
85 | | - " |
86 | | - diff pred.txt ref.txt |
87 | | - echo "Chat sample cpp" passed |
88 | | - timeout 30s ./samples/python/text_generation/chat_sample.py ./TinyLlama-1.1B-Chat-v1.0/ < input.txt > ./pred2.txt |
89 | | - diff pred2.txt ref.txt |
90 | | - echo "Chat sample python" passed |
91 | | -
|
92 | 25 | cpp-continuous-batching-ubuntu: |
93 | 26 | runs-on: ubuntu-22.04-8-cores |
94 | 27 | defaults: |
@@ -226,7 +159,7 @@ jobs: |
226 | 159 |
|
227 | 160 | Overall_Status: |
228 | 161 | name: ci/gha_overall_status_causal_lm |
229 | | - needs: [cpp-chat_sample-ubuntu, cpp-continuous-batching-ubuntu, cpp-continuous-batching-windows, cpp-continuous-batching-macos] |
| 162 | + needs: [cpp-continuous-batching-ubuntu, cpp-continuous-batching-windows, cpp-continuous-batching-macos] |
230 | 163 | if: ${{ always() }} |
231 | 164 | runs-on: ubuntu-latest |
232 | 165 | steps: |
|
0 commit comments