Edit model card
  • maywell/Synatra-7B-v0.3-Translation λͺ¨λΈμ΄ ν”„λ‘œκ·Έλž¨ μ½”λ“œκ°€ ν¬ν•¨λœ μ—¬λŸ¬ μ€„μ˜ κΈ΄ ν…μŠ€νŠΈλ₯Ό λ²ˆμ—­ν•˜λŠ”λ° μ œν•œμ΄ μžˆμ–΄μ„œ ν•΄λ‹Ή 뢀뢄을 LoRA둜 μΆ”κ°€ ν•™μŠ΅ν–ˆμŠ΅λ‹ˆλ‹€.

μ‚¬μš© μ˜ˆμ‹œ

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

device = "cuda:0" if torch.cuda.is_available() else "cpu"

model_id = "maywell/Synatra-7B-v0.3-Translation"
tokenizer = AutoTokenizer.from_pretrained(model_id, revision=model_revision)
model = AutoModelForCausalLM.from_pretrained(model_id, revision=model_revision, device_map=device, torch_dtype=torch.float16).eval()

# LoRA μ–΄λŒ‘ν„° 뢈러였기
model.load_adapter("heegyu/Synatra-7B-v0.3-Translation-glaive")


def generate(prompt, *messages):
  messages = [
      {
          "role": "system",
          "content": prompt.strip(),
      },
      *[{"role": "user" if i % 2 == 0 else "assistant", "content": m.strip()} for i, m in enumerate(messages)],
  ]
  inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(device)
  outs = model.generate(inputs, do_sample=True, max_new_tokens=256, early_stopping=True)
  print(tokenizer.batch_decode(outs)[0])

generate(
    "λ§ˆν¬λ‹€μš΄μœΌλ‘œ μž‘μ„±λœ μ˜μ–΄ λŒ€ν™”λ₯Ό ν•œκ΅­μ–΄λ‘œ λ²ˆμ—­ν•˜μ„Έμš”. ν”„λ‘œκ·Έλž¨ μ½”λ“œλŠ” λ²ˆμ—­ν•˜λ©΄ μ•ˆλ©λ‹ˆλ‹€.",
"""
### User:
Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index 1?

### Assistant:
```python
>>> ["foo", "bar", "baz"].index("bar")
1
```
See the documentation for the built-in .index() method of the list:

list.index(x[, start[, end]])
Return zero-based index in the list of the first item whose value is equal to x. Raises a ValueError if there is no such item.

The optional arguments start and end are interpreted as in the slice notation and are used to limit the search to a particular subsequence of the list. The returned index is computed relative to the beginning of the full sequence rather than the start argument.
"""
)

μ‹€ν–‰ κ²°κ³Ό

<|im_start|> system
λ§ˆν¬λ‹€μš΄μœΌλ‘œ μž‘μ„±λœ μ˜μ–΄ λŒ€ν™”λ₯Ό ν•œκ΅­μ–΄λ‘œ λ²ˆμ—­ν•˜μ„Έμš”. ν”„λ‘œκ·Έλž¨ μ½”λ“œλŠ” λ²ˆμ—­ν•˜λ©΄ μ•ˆλ©λ‹ˆλ‹€.<|im_end|> 
<|im_start|> user
### User:
Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index 1?

### Assistant:
```python
>>> ["foo", "bar", "baz"].index("bar")
1
```
See the documentation for the built-in .index() method of the list:

list.index(x[, start[, end]])
Return zero-based index in the list of the first item whose value is equal to x. Raises a ValueError if there is no such item.

The optional arguments start and end are interpreted as in the slice notation and are used to limit the search to a particular subsequence of the list. The returned index is computed relative to the beginning of the full sequence rather than the start argument.<|im_end|> 
<|im_start|> assistant
 ### User:
"foo", "bar", "baz" λ¦¬μŠ€νŠΈκ°€ 있고 λ¦¬μŠ€νŠΈμ—μ„œ "bar"λΌλŠ” ν•­λͺ©μ΄ μžˆλ‹€λ©΄, κ·Έ 인덱슀 1을 μ–΄λ–»κ²Œ κ°€μ Έμ˜¬ 수 μžˆμ„κΉŒμš”?

### Assistant:
```python
>>> ["foo", "bar", "baz"].index("bar")
1
```
리슀트의 λ‚΄μž₯된 .index() λ©”μ„œλ“œμ— λŒ€ν•œ λ¬Έμ„œλ₯Ό μ°Έμ‘°ν•˜μ„Έμš”:

list.index(x[, start[, end]])
값이 x와 같은 첫 번째 ν•­λͺ©μ˜ 0 기반 인덱슀λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€. κ·ΈλŸ¬ν•œ ν•­λͺ©μ΄ μ—†λŠ” 경우 ValueError κ°€ λ°œμƒν•©λ‹ˆλ‹€.

선택적인 인수 start와 endλŠ” 슬라이슀 ν‘œκΈ°λ²•μ—μ„œμ˜ 식별에 ν•΄λ‹Ήν•˜λ©° 리슀트의 νŠΉμ • ν•˜μœ„ μ‹œν€€μŠ€λ‘œ 검색을 μ œν•œν•˜λŠ” 데 μ‚¬μš©λ©λ‹ˆλ‹€. λ°˜ν™˜λœ μΈλ±μŠ€λŠ” μ‹œμž‘ μΈμžκ°€ μ•„λ‹Œ 전체 μ‹œν€€μŠ€μ˜ μ‹œμž‘μ„ κΈ°μ€€μœΌλ‘œ κ³„μ‚°λ©λ‹ˆλ‹€.<|im_end|>
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .

Dataset used to train heegyu/Synatra-7B-v0.3-Translation-glaive