philschmid HF staff commited on
Commit
f274875
1 Parent(s): ba606a6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -0
README.md CHANGED
@@ -15,6 +15,43 @@ Code Llama is a collection of pretrained and fine-tuned generative text models r
15
  | 13B | [codellama/CodeLlama-13b-hf](https://huggingface.co/codellama/CodeLlama-13b-hf) | [codellama/CodeLlama-13b-Python-hf](https://huggingface.co/codellama/CodeLlama-13b-Python-hf) | [codellama/CodeLlama-13b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf) |
16
  | 34B | [codellama/CodeLlama-34b-hf](https://huggingface.co/codellama/CodeLlama-34b-hf) | [codellama/CodeLlama-34b-Python-hf](https://huggingface.co/codellama/CodeLlama-34b-Python-hf) | [codellama/CodeLlama-34b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf) |
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ## Model Details
19
  *Note: Use of this model is governed by the Meta license. Meta developed and publicly released the Code Llama family of large language models (LLMs).
20
 
 
15
  | 13B | [codellama/CodeLlama-13b-hf](https://huggingface.co/codellama/CodeLlama-13b-hf) | [codellama/CodeLlama-13b-Python-hf](https://huggingface.co/codellama/CodeLlama-13b-Python-hf) | [codellama/CodeLlama-13b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf) |
16
  | 34B | [codellama/CodeLlama-34b-hf](https://huggingface.co/codellama/CodeLlama-34b-hf) | [codellama/CodeLlama-34b-Python-hf](https://huggingface.co/codellama/CodeLlama-34b-Python-hf) | [codellama/CodeLlama-34b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf) |
17
 
18
+
19
+ Make sure to be using this fork of transformers unit support is fully merged and released.
20
+
21
+ ```bash
22
+ pip install git+https://github.com/huggingface/transformers.git@refs/pull/25740/head accelerate
23
+ ```
24
+
25
+
26
+ ```python
27
+ from transformers import AutoTokenizer
28
+ import transformers
29
+ import torch
30
+
31
+ model = "codellama/CodeLlama-7b-hf"
32
+
33
+ tokenizer = AutoTokenizer.from_pretrained(model)
34
+ pipeline = transformers.pipeline(
35
+ "text-generation",
36
+ model=model,
37
+ torch_dtype=torch.float16,
38
+ device_map="auto",
39
+ )
40
+
41
+ sequences = pipeline(
42
+ 'import socket\n\ndef ping_exponential_backoff(host: str):',
43
+ do_sample=True,
44
+ top_k=10,
45
+ temperature=0.1,
46
+ top_p=0.95
47
+ num_return_sequences=1,
48
+ eos_token_id=tokenizer.eos_token_id,
49
+ max_length=200,
50
+ )
51
+ for seq in sequences:
52
+ print(f"Result: {seq['generated_text']}")
53
+ ```
54
+
55
  ## Model Details
56
  *Note: Use of this model is governed by the Meta license. Meta developed and publicly released the Code Llama family of large language models (LLMs).
57