Commit Graph

25 Commits

Author SHA1 Message Date
Mahimai Raja J
f7c1b27656 Added cuda config on Sample Code
I tried to replicate the `sample code` in the free versions of `kaggle`, `Colab` and `SageMaker Studio Lab`. 
When running on GPU:
``` bash
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
```

And While running on CPU:
```
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'
```

| Changes I made:

```diff
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("microsoft/phi-1_5", trust_remote_code=True, torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-1_5", trust_remote_code=True, torch_dtype="auto")

+ device = torch.device("cuda:0")
+ model.cuda()

inputs = tokenizer('''```python
def print_prime(n):
   """
   Print all primes between 1 and n
-   """''', return_tensors="pt", return_attention_mask=False)
+   """''', return_tensors="pt", return_attention_mask=False).to('cuda')

outputs = model.generate(**inputs, max_length=200)
text = tokenizer.batch_decode(outputs)[0]
print(text)
```


I could resolve the runtime issue on `GPU` by adding cuda settiings. I beleive this would help the co-developers to try out phi-1_5. Thanks!!!
2023-09-12 15:23:58 +00:00
Gunasekar
ea95720a35 Update README.md 2023-09-12 01:38:42 +00:00
Gunasekar
4bba51c9b5 Update README.md 2023-09-11 21:45:49 +00:00
Gunasekar
52e294acfe Update README.md 2023-09-11 21:44:15 +00:00
Gunasekar
9efbcafbe4 Upload tokenizer 2023-09-11 21:30:53 +00:00
Gunasekar
d655135ca1 Upload MixFormerSequentialForCausalLM 2023-09-11 21:30:53 +00:00
Gunasekar
07a048efa7 Update README.md 2023-09-11 07:57:24 +00:00
Gunasekar
b63051536f Update README.md 2023-09-11 07:56:12 +00:00
Gunasekar
40b496f7e0 Update README.md 2023-09-11 07:50:39 +00:00
Gunasekar
d9c7521001 Update README.md 2023-09-11 07:46:06 +00:00
Gunasekar
6ddac37bb9 Update README.md 2023-09-11 07:35:26 +00:00
Gunasekar
cd4510ca85 Update README.md 2023-09-11 07:33:48 +00:00
Gunasekar
34046b03b7 Update README.md 2023-09-11 07:32:34 +00:00
Gunasekar
24ad69c3c0 Update README.md 2023-09-11 02:12:39 +00:00
Gunasekar
b3d67f3c44 Update README.md 2023-09-11 01:01:17 +00:00
Gunasekar
14be6562c1 Upload Research License.docx 2023-09-11 01:00:01 +00:00
Gunasekar
6157c47c1f Upload tokenizer 2023-09-10 06:28:52 +00:00
Gunasekar
e656142af4 Upload MixFormerSequentialForCausalLM 2023-09-10 06:28:51 +00:00
Gunasekar
4b752e7b2d Upload tokenizer 2023-09-10 06:16:33 +00:00
Gunasekar
2bfd6ef82c Upload MixFormerSequentialForCausalLM 2023-09-10 06:16:29 +00:00
Gunasekar
67f350b99d Upload tokenizer 2023-09-10 06:15:56 +00:00
Gunasekar
ba44a904e2 Upload MixFormerSequentialForCausalLM 2023-09-10 06:15:55 +00:00
Gunasekar
67a43eb1b5 Upload tokenizer 2023-09-10 05:42:14 +00:00
Gunasekar
16982066f0 Upload MixFormerSequentialForCausalLM 2023-09-10 05:42:14 +00:00
Gunasekar
98416e6398 initial commit 2023-09-10 04:03:46 +00:00