Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is model.score_sync not deterministic ? #357

Open
4mbroise opened this issue Jun 25, 2024 · 0 comments
Open

is model.score_sync not deterministic ? #357

4mbroise opened this issue Jun 25, 2024 · 0 comments

Comments

@4mbroise
Copy link

4mbroise commented Jun 25, 2024

I need a consistent prediction score on tokens generated, i'm facing issues with model.score(...) function. Same behavior with the model.score_sync(...) function.

Am i missing something ?

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lmql
>>> model = lmql.model("local:mistralai/Mistral-7B-v0.1")
>>> model.score_sync("Hello", ["World", "Apples", "Oranges"]).probs()
mistralai/Mistral-7B-v0.1
[Loading mistralai/Mistral-7B-v0.1 with AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1")]]
Loading checkpoint shards: 100%|████████| 2/2 [00:29<00:00, 14.82s/it]
[mistralai/Mistral-7B-v0.1 ready on device cpu]
CompletedProcess(args=['pip', 'show', 'bitsandbytes'], returncode=0, stdout=b'Name: bitsandbytes\nVersion: 0.43.1\nSummary: k-bit optimizers and matrix multiplication routines.\nHome-page: https://github.com/TimDettmers/bitsandbytes\nAuthor: Tim Dettmers\nAuthor-email: [email protected]\nLicense: MIT\nLocation: /home2/efaugier/lqml/lib/python3.10/site-packages\nRequires: numpy, torch\nRequired-by: \n', stderr=b'')
array([9.99373272e-01, 3.40812384e-04, 2.85915910e-04])
>>> model.score_sync("Hello", ["World", "Apples", "Oranges"]).probs()
array([9.99373270e-01, 3.40813439e-04, 2.85917000e-04])
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lmql
>>> model = lmql.model("local:mistralai/Mistral-7B-v0.1", cuda=True)
>>> model.score_sync("Hello", ["World", "Apples", "Oranges"]).probs()
mistralai/Mistral-7B-v0.1
[Loading mistralai/Mistral-7B-v0.1 with AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", device_map=auto)]]
Loading checkpoint shards: 100%|████████| 2/2 [00:14<00:00,  7.41s/it]
[mistralai/Mistral-7B-v0.1 ready on device cuda:0]
CompletedProcess(args=['pip', 'show', 'bitsandbytes'], returncode=0, stdout=b'Name: bitsandbytes\nVersion: 0.43.1\nSummary: k-bit optimizers and matrix multiplication routines.\nHome-page: https://github.com/TimDettmers/bitsandbytes\nAuthor: Tim Dettmers\nAuthor-email: [email protected]\nLicense: MIT\nLocation: /home2/efaugier/lqml/lib/python3.10/site-packages\nRequires: numpy, torch\nRequired-by: \n', stderr=b'')
array([9.99373271e-01, 3.40813521e-04, 2.85915365e-04])
>>> model.score_sync("Hello", ["World", "Apples", "Oranges"]).probs()
array([9.99373272e-01, 3.40812384e-04, 2.85915637e-04])
@4mbroise 4mbroise changed the title Why model.score_sync is not determinist ? is model.score_sync not determinist ? Jun 26, 2024
@4mbroise 4mbroise changed the title is model.score_sync not determinist ? is model.score_sync not deterministic ? Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant