Views
No views yet
llama-2-13b-code-122k is a Llama 2 versionllama-2-13b-chat-hf model, fine-tuned using QLoRA. It was trained on an Colab Pro+It was trained Colab Pro+. It is mainly designed for educational purposes, not for inference but can be used exclusively with BBVA Group, GarantiBBVA and its subsidiaries.1# pip install transformers accelerate
2
3from transformers import AutoTokenizer
4import transformers
5import torch
6
7model = "emre/llama-2-13b-code-122k"
8prompt = "Write Python code to generate an array with all the numbers from 1 to 100"
9
10tokenizer = AutoTokenizer.from_pretrained(model)
11pipeline = transformers.pipeline(
12 "text-generation",
13 model=model,
14 torch_dtype=torch.float16,
15 device_map="auto",
16)
17
18sequences = pipeline(
19 f'<s>[INST] {prompt} [/INST]',
20 do_sample=True,
21 top_k=10,
22 num_return_sequences=1,
23 eos_token_id=tokenizer.eos_token_id,
24 max_length=200,
25)
26for seq in sequences:
27 print(f"Result: {seq['generated_text']}")Here is a Python code to generate an array with all the numbers from 1 to 100:
```
numbers = []
for i in range(1,101):
numbers.append(i)
```
This code generates an array with all the numbers from 1 to 100 in Python. It uses a loop that iterates over the range of numbers from 1 to 100, and for each number, it appends that number to the array 'numbers'. The variable 'numbers' is initialized to a list, and its length is set to 101 by using the range of numbers (0-99).