Update README.md
Browse files
README.md
CHANGED
@@ -20,3 +20,68 @@ tags:
|
|
20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
This llama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
23 |
+
|
24 |
+
|
25 |
+
---------------------------------------------
|
26 |
+
|
27 |
+
# Setting up and testing own Endpoint Handler
|
28 |
+
|
29 |
+
Sources:
|
30 |
+
|
31 |
+
- https://www.philschmid.de/custom-inference-handler
|
32 |
+
- https://discuss.huggingface.co/t/model-wont-load-on-custom-inference-endpoint/91780
|
33 |
+
- https://huggingface.co/docs/inference-endpoints/guides/custom_handler
|
34 |
+
|
35 |
+
|
36 |
+
### Setup Environment
|
37 |
+
|
38 |
+
Install necessary packages to set up and test endpoint handler.
|
39 |
+
|
40 |
+
```
|
41 |
+
# install git-lfs to interact with the repository
|
42 |
+
sudo apt-get update
|
43 |
+
sudo apt-get install git-lfs
|
44 |
+
# install transformers (not needed for inference since it is installed by default in the container)
|
45 |
+
pip install transformers[sklearn,sentencepiece,audio,vision]
|
46 |
+
```
|
47 |
+
|
48 |
+
Clone model weights of interest.
|
49 |
+
|
50 |
+
```
|
51 |
+
git lfs install
|
52 |
+
git clone https://huggingface.co/tykiww/llama3-8b-quantized
|
53 |
+
```
|
54 |
+
|
55 |
+
Login to huggingface
|
56 |
+
|
57 |
+
```
|
58 |
+
# setup cli with token
|
59 |
+
huggingface-cli login
|
60 |
+
git config --global credential.helper store
|
61 |
+
```
|
62 |
+
|
63 |
+
Confirm login in case you are unsure.
|
64 |
+
|
65 |
+
```
|
66 |
+
huggingface-cli whoami
|
67 |
+
```
|
68 |
+
|
69 |
+
Navigate to repo and create a handler.py file
|
70 |
+
|
71 |
+
```
|
72 |
+
cd llama3-8b-bnb-4bit-lora #&& touch handler.py
|
73 |
+
```
|
74 |
+
|
75 |
+
Create a requirements.txt file with the following items
|
76 |
+
|
77 |
+
```
|
78 |
+
huggingface_hub
|
79 |
+
unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git
|
80 |
+
xformers
|
81 |
+
trl<0.9.0
|
82 |
+
peft==0.11.1
|
83 |
+
bitsandbytes
|
84 |
+
transformers==4.41.2 # must use /:
|
85 |
+
```
|
86 |
+
|
87 |
+
Must have a GPU compatible with Unsloth.
|