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

Performance on Apple silicon #5

Closed
marella opened this issue May 21, 2023 · 3 comments
Closed

Performance on Apple silicon #5

marella opened this issue May 21, 2023 · 3 comments

Comments

@marella
Copy link
Owner

marella commented May 21, 2023

Context: #1 (comment)

@bgonzalezfractal did you notice any performance improvement just by changing the threads parameter?

If you don't have the latest quantized models, you can go back to the previous commit using:

git checkout e707f99
git submodule update

Here you can run the build commands and check:

cmake -S . -B build
cmake --build build
@bgonzalezfractal
Copy link

@marella I haven't been able to use the llm again, once we manage to solve the starcoder quantize issue, I can post the M1 Pro 64GB performance.

@marella
Copy link
Owner Author

marella commented May 21, 2023

Hi, I'm guessing the issue might be related to performance - it is running too slow so taking time to print the output.

By default print(llm(...)) function doesn't show any output until all the text is generated. So you can try the new stream option to see text as soon as a token is generated:

for token in llm('def fibo(', max_new_tokens=5, stream=True):
    print(token, end='', flush=True)

The code used by starcoder example and this library is same. The only difference is in the way it is built. So building the library from source can help validate if building locally improves performance and may prevent the library from being stuck:

git clone --recurse-submodules https://github.com/marella/ctransformers
cd ctransformers
./scripts/build.sh
llm = AutoModelForCausalLM.from_pretrained(..., lib='/path/to/ctransformers/build/lib/libctransformers.dylib')

@marella
Copy link
Owner Author

marella commented May 24, 2023

See #8

@marella marella closed this as completed May 24, 2023
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

2 participants