GyuHyeonWkdWkdMan's picture
Update README.md
c07db2d verified
---
license: apache-2.0
datasets:
- MarkrAI/KOpen-HQ-Hermes-2.5-60K
language:
- ko
base_model:
- meta-llama/Meta-Llama-3.1-8B-Instruct
pipeline_tag: text-generation
library_name: adapter-transformers
---
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
unsloth๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ meta-llama/Meta-Llama-3.1-8B-Instruct ๋ชจ๋ธ์— LORA ํŒŒ์ธํŠœ๋‹์„ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค.
MarkrAI/KOpen-HQ-Hermes-2.5-60k ๋ฐ์ดํ„ฐ๋ฅผ ํ•™์Šต์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.
## How to use
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("NAPS-ai/naps-llama-3.1-8b-instruct-v0.4")
model = AutoModelForCausalLM.from_pretrained("NAPS-ai/naps-llama-3.1-8b-instruct-v0.4")
```
## Chatbot
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6699b80354725cd6e0ae8e19/1J506GxR0eT6XnKsGVbye.png)
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
tokenizer = AutoTokenizer.from_pretrained("NAPS-ai/naps-llama-3.1-8b-instruct-v0.4")
model = AutoModelForCausalLM.from_pretrained("NAPS-ai/naps-llama-3.1-8b-instruct-v0.4")
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
model_kwargs={"torch_dtype": torch.bfloat16},
device=0,
)
def answering(question):
messages = [
{"role": "system", "content": "๋‹น์‹ ์€ ํ•ญ์ƒ ์นœ์ ˆํ•˜๊ฒŒ ๋Œ€๋‹ตํ•˜๋Š” ์•ˆ๋‚ด์›์ž…๋‹ˆ๋‹ค."},
{"role": "user", "content": question},
]
outputs = pipeline(
messages,
max_new_tokens=1024,
pad_token_id = pipeline.tokenizer.eos_token_id
)
return outputs[0]["generated_text"][2]['content']
while True:
question = input("์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š” : ")
if question == "์ข…๋ฃŒ":
print("ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ")
break
answer = answering(question)
print(f"AI์˜ ๋‹ต๋ณ€: {answer}")
```
Contact : [email protected]