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

can we use a gpu for increased speed and use of a bigger better llama2 model #7

Open
stevedipaola opened this issue Jul 25, 2023 · 4 comments

Comments

@stevedipaola
Copy link

is there instructs for that - most of us AI folk have good gpus - seems silly not to use them.

@alior101
Copy link

alior101 commented Aug 1, 2023

two changes needed :
def build_llm(): # Local CTransformers model llm = CTransformers(model=cfg.MODEL_BIN_PATH, model_type=cfg.MODEL_TYPE, config={'max_new_tokens': cfg.MAX_NEW_TOKENS, 'temperature': cfg.TEMPERATURE, 'gpu_layers': 24} ) return llm

uninstall ctrasnformers and re-install with
CT_CUBLAS=1 pip install ctransformers --no-binary ctransformers

@gabacode
Copy link

two changes needed : def build_llm(): # Local CTransformers model llm = CTransformers(model=cfg.MODEL_BIN_PATH, model_type=cfg.MODEL_TYPE, config={'max_new_tokens': cfg.MAX_NEW_TOKENS, 'temperature': cfg.TEMPERATURE, 'gpu_layers': 24} ) return llm

uninstall ctrasnformers and re-install with CT_CUBLAS=1 pip install ctransformers --no-binary ctransformers

Thanks @alior101, it worked!
How would it integrate with poetry and pyproject.toml?

@alexng88
Copy link

Hello,
I made the changes of llm.py

llm = CTransformers(model=cfg.MODEL_BIN_PATH,
model_type=cfg.MODEL_TYPE,
config={'max_new_tokens': cfg.MAX_NEW_TOKENS,
'temperature': cfg.TEMPERATURE,
'gpu_layers':24}

and reinstall ctransformers (0.2.27)

but seems still running very slow seems never use GPU
I already tested GPU is ready
python -c "import torch; print(torch.cuda.is_available())"
it said "True"

then I tried "python main.py "hello"" it takes 300+s to answer
please advise

@VIGHNESH1521
Copy link

Hi @alexng88 ,

I am also facing the same issues, did you get any solutions?

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

5 participants