VINUK commited on
Commit
f8bc266
1 Parent(s): 7d7c0d0

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +68 -0
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - HuggingFaceH4/no_robots
4
+ - yahma/alpaca-cleaned
5
+ language:
6
+ - en
7
+ library_name: transformers
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - instruct
11
+ - OpenELM
12
+ ---
13
+
14
+ ### [Model Information]
15
+
16
+ - *This is a fine-tuned version of `Apple/OpenELM` model series; created in hopes of testing the limitations of `OpenELM` architecture. And maybe it had something to do with Apple's instruct models not providing the inst format.*
17
+
18
+ - *This language model is trained on a total estimated sample size of `61k` lines of data without giving a system prompt.*
19
+
20
+ ### [Model Usage]
21
+
22
+ - *Tokenizer is included in this repo, so you may use the model as any other model.*
23
+
24
+ - *Model currently can handle up to `2048/T` maximum embeddings. This is the default limit imposed by `Apple` during the original training process.*
25
+
26
+ - *In the training process of the language model, I didn't use any moderation filtration's; so this model might generate unwanted surprises.*
27
+
28
+ - ***Please be aware that this model is trained on a tiny fraction of, what other models are trained on; as of `2024/5/12`, you may consider this model as a research-model `(This might change, if I feel like continuing improvement)`.***
29
+
30
+ ### [How to utilize the model to it's full capacity.]
31
+
32
+ - *First you will need the basic dependencies that are required for operations, you may install it by running this command:*
33
+ ```python
34
+ pip install -U transformers torch torchvision torchaudio accelerate
35
+ ```
36
+ - *Secondly you may run this code, and remember to replace the `What can you do.` example question with your own.*
37
+ ```python
38
+ from accelerate import Accelerator
39
+ from transformers import AutoModelForCausalLM, AutoTokenizer
40
+ import torch
41
+
42
+ accelerator = Accelerator()
43
+
44
+ tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path="VINUK/OpenELM_Instruct_272M_V1.0", trust_remote_code=True)
45
+ model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path="VINUK/OpenELM_Instruct_272M_V1.0", trust_remote_code=True, torch_dtype=torch.bfloat16)
46
+
47
+ model = accelerator.prepare_model(model=model, evaluation_mode=True)
48
+
49
+
50
+
51
+ with torch.no_grad():
52
+ inputs = tokenizer(text=f"[|=U=|]\nWhat can you do.\n[|=M=|]\n", return_tensors='pt').to(accelerator.device)
53
+ response = model.generate(inputs=inputs['input_ids'],
54
+ attention_mask=inputs['attention_mask'],
55
+ max_new_tokens=1024,
56
+ min_new_tokens=10,
57
+ do_sample=True,
58
+ top_p=0.95,
59
+ top_k=50,
60
+ temperature=0.6,
61
+ repetition_penalty=1.0,
62
+ use_cache=True,
63
+ pad_token_id=tokenizer.eos_token_id,
64
+ )
65
+ decoded = tokenizer.decode(response[:, inputs['input_ids'].shape[-1]:][0], skip_special_tokens=True)
66
+
67
+ print(decoded.replace('\\n', '\n'))
68
+ ```