Created
November 7, 2023 15:10
-
-
Save goneri/5097b602b0c09a348e6821507263cfa4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from sentence_transformers import SentenceTransformer | |
model = SentenceTransformer( | |
f"sentence-transformers/all-MiniLM-L6-v2", device="cpu" | |
) | |
suggestion = """ | |
- name: Git checkout | |
ansible.builtin.git: | |
accept_newhostkey: true | |
repo: '[email protected]:goneri/nowhere.git' | |
dest: ~/my-pipeline | |
- name: Install the dependencies | |
package: | |
update_cache: true | |
name: | |
- python3-venv | |
- awscli | |
state: present | |
become: true | |
- name: Prepare the virtualenv | |
ansible.builtin.pip: | |
requirements: ~/somewhere/requirements.txt | |
virtualenv: ~/venv | |
virtualenv_command: /usr/bin/python3 -m ven | |
""" | |
start_time = time.time() | |
encoded = model.encode(sentences=suggestion, batch_size=16) | |
encode_duration = round((time.time() - start_time) * 1000, 2) | |
print(encode_duration) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment