boriszverkov commited on
Commit
4c7c56b
·
verified ·
1 Parent(s): 61a99de

Added code example

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md CHANGED
@@ -42,6 +42,26 @@ This model is a **preview release** intended for:
42
  - Evaluation and benchmarking
43
  - Research in low- and high-resource European languages
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ## Limitations
46
 
47
  - This version is a first-stage SFT release; alignment steps is not applied.
 
42
  - Evaluation and benchmarking
43
  - Research in low- and high-resource European languages
44
 
45
+
46
+ ## Use with transformers
47
+
48
+ Quick start with `Transformers` both for GPU and CPU enabled envs:
49
+
50
+ ```python
51
+ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
52
+ import torch
53
+
54
+ model_name = "minilingua-ai/MiniLingua-1b-Instruct"
55
+
56
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
57
+ model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", dtype=torch.float16)
58
+ gen = pipeline("text-generation", model=model, tokenizer=tokenizer, trust_remote_code=True)
59
+
60
+ prompt = "Translate from Bulgarian: Здравейте! Как сте? Translation:"
61
+ out = gen(prompt, max_new_tokens=128, do_sample=False)
62
+ print(out[0])
63
+ ```
64
+
65
  ## Limitations
66
 
67
  - This version is a first-stage SFT release; alignment steps is not applied.