enable gpu on llama docker

This commit is contained in:
Simon Larsen
2023-10-18 12:07:37 +01:00
parent c629921d01
commit b3cfdbf45a
2 changed files with 10 additions and 1 deletions

View File

@@ -13,6 +13,14 @@ docker build -t llama . -f ./Llama/Dockerfile
## Run
### For Linux
```
docker run --gpus all -p 8547:8547 -it -v ./Llama/Models:/app/Models llama
```
### For MacOS
```
docker run -p 8547:8547 -it -v ./Llama/Models:/app/Models llama
```

View File

@@ -15,7 +15,8 @@ tokenizer = AutoTokenizer.from_pretrained(model_path, local_files_only=True)
pipeline = transformers.pipeline(
"text-generation",
model=model_path,
torch_dtype=torch.float32,
# torch_dtype=torch.float32, # for CPU
torch_dtype=torch.float16, # for GPU
device_map="auto",
)