warshanks commited on
Commit
496e535
·
verified ·
1 Parent(s): 5328dc1

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: mit
4
+ tags:
5
+ - mlx
6
+ base_model: openai-community/gpt2-xl
7
+ ---
8
+
9
+ # warshanks/gpt2-xl-bf16
10
+
11
+ The Model [warshanks/gpt2-xl-bf16](https://huggingface.co/warshanks/gpt2-xl-bf16) was converted to MLX format from [openai-community/gpt2-xl](https://huggingface.co/openai-community/gpt2-xl) using mlx-lm version **0.24.1**.
12
+
13
+ ## Use with mlx
14
+
15
+ ```bash
16
+ pip install mlx-lm
17
+ ```
18
+
19
+ ```python
20
+ from mlx_lm import load, generate
21
+
22
+ model, tokenizer = load("warshanks/gpt2-xl-bf16")
23
+
24
+ prompt="hello"
25
+
26
+ if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
27
+ messages = [{"role": "user", "content": prompt}]
28
+ prompt = tokenizer.apply_chat_template(
29
+ messages, tokenize=False, add_generation_prompt=True
30
+ )
31
+
32
+ response = generate(model, tokenizer, prompt=prompt, verbose=True)
33
+ ```