- February 2024: [π Model Release π] We are excited to announce the release of our initial models for the Korean language processing community! Check them out:
from transformers import AutoTokenizer, pipeline
import torch
model_and_tokenizer_path = "nlpai-lab/ko-gemma-7b-v1"
tokenizer = AutoTokenizer.from_pretrained(model_and_tokenizer_path)
pipeline = pipeline(
"text-generation",
model=model_and_tokenizer_path,
tokenizer=tokenizer,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda",
)
tokenizer = AutoTokenizer.from_pretrained(model_and_tokenizer_path)
messages = [
{"role": "user",
"content": "μ΄μμ μ₯κ΅°μ λν΄ μ€λͺ
ν΄μ£ΌμΈμ."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) # Don't use `pipeline.tokenizer`
print(prompt) # <bos><start_of_turn>user\nμ΄μμ μ₯κ΅°μ λν΄ μ€λͺ
ν΄μ£ΌμΈμ.<end_of_turn>\n<start_of_turn>model\n
outputs = pipeline(
prompt,
max_new_tokens=4096,
add_special_tokens=True
)
print(outputs[0]["generated_text"][len(prompt):]) # 'μ΄μμ μ₯κ΅°μ μ‘°μ μλμ λνμ μΈ κ΅°μ¬ μ§λμμ΄μ μ λ΅κ°μ
λλ€. κ·Έλ μ‘°μ μλμ μλμΈ νμμμ νμ΄λ¬μΌλ©°, μ‘°μ μλ κ΅°λμμ λ€μν μ§λμλ‘ νλνμ΅λλ€.\n\nμ΄μμ μ₯κ΅°μ κ°μ₯ μ£Όλͺ©ν λ§ν μ
μ μ€ νλλ 1592λ
λΆν° 1598λ
κΉμ§ μΌλ³Έμ΄ μ‘°μ μ 침곡ν μΌλ³Έ μ μμμμ νλμ
λλ€. μ΄ μ μμμ μ΄μμ μ₯κ΅°μ μ‘°μ κ΅°λμ μ λ΅μ μΈ μ§λμλ‘ νλνλ©° μΌλ³Έμ μΉ¨λ΅μ μ ννλ λ° ν° μν μ νμ΅λλ€.\n\nμ΄μμ μ₯κ΅°μ μ ν¬μμμ μ©κΈ°μ μ μ μ μ§μ±μΌλ‘ μ λͺ
νμ΅λλ€. κ·Έλ μ ν¬μμ μ μ μ μΈ μ¬κ³ λ₯Ό λ°ννκ³ μ μ μ½μ μ 곡격νλ κ²μΌλ‘ μ λͺ
νμ΅λλ€. λν κ·Έλ μ‘°μ κ΅°λμ μ λ ₯μ κ³ μ·¨νκ³ μ ν¬μμ μΉλ¦¬νλ λ° λμμ΄ λλ μ°μ€κ³Ό κ²©λ €μ λ§μ μ νλ κ²μΌλ‘λ μ λͺ
νμ΅λλ€.\n\nμ΄μμ μ₯κ΅°μ μ μμ΄ λλ νμλ μ‘°μ κ΅°λμμ κ³μ νλνλ©° μ‘°μ κ΅°λμ μ§λμλ‘ νλνμ΅λλ€. κ·Έλ μ‘°μ κ΅°λμ μ λ ₯μ μ μ§νκ³ μ‘°μ μ μ보λ₯Ό μ§ν€λ λ° ν° μν μ νμ΅λλ€.\n\nμ΄μμ μ₯κ΅°μ μ‘°μ μλμ λνμ μΈ κ΅°μ¬ μ§λμμ΄μ μ λ΅κ°λ‘ κΈ°μ΅λκ³ μμ΅λλ€. κ·Έμ μ©κΈ°μ μ μ μ μ§μ±, κ·Έλ¦¬κ³ μ‘°μ κ΅°λμ μ λ ₯μ μ μ§νλ λ° κΈ°μ¬ν 곡λ‘λ κ·Έλ₯Ό μ μ€μ μΈ μΈλ¬Όλ‘ λ§λ€μμ΅λλ€.'
License Copyright 2024 DeepMind Technologies Limited
This code is 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.