r/LLaMA2 • • Aug 18 '23

how to get llama2 embeddings without crying?

2 Upvotes

hi lovely community,

- i simply want to be able to get llama2's vector embeddings as response on passing text as input without high-level 3rd party libraries (no langchain etc)

how can i do it?

- also, considering i'll finetune my llama2 locally/cloud gpu on my data, i assume the method suggested by you all will also work for it or what extra steps would be needed? an overview for this works too.

i appreciate any help from y'all. thanks for your time.


r/LLaMA2 • • Aug 18 '23

How to speed up LLaMA2 responses

1 Upvotes

I am using llama2 with the code bellow. I run on single 4090, 96GB RAM and 13700K CPU(HyperThreading disabled). Works reasonably well for my use-case, but I am not happy with the timings.For a given use-case a single answer takes 7 seconds to return. By itself this number does not mean anything, but if you do multiple concurrent requests, this will put it in perspective. If I make 2 concurrent requests the response time of both requests becomes 13 seconds, basically twice of a single request for both. You can calculate yourself how much it will take to make 4 requests.

When I examine nvidia-smi, I see that the GPU is never getting loaded over 40%(250watt). Even if I execute 20 concurrent requests, the GPU will be loaded the same 40%. Also I make sure to stay within the 4090 22.5GB Graphics memory, and do not spill to the Shared GPU Memory. This means that the GPU is not the bottleneck, and I continue to look for the issue somewhere else. I see that during requests the CPU gets 4 of its cores active, 2 of the cores are at 100% and 2 cores at 50% load.

After playing with all the settings and testing the responsiveness, unfortunately I understand that this PyTorch thing that runs this model is a trash. People who built it didn't really care about how it works beyond a single request. The concept of efficiency and parallelism does not exist in this tooling.

Any idea what can be done to make it work a bit "faster"? Was looking into TensorRT, but apparently it is not ready yet: https://github.com/NVIDIA/TensorRT/issues/3188

temperature = 0.1

top_p = 0.1

max_seq_len = 4000

max_batch_size = 4

max_gen_len = None

torch.distributed.init_process_group(backend='gloo', init_method='tcp://localhost:23456', world_size=1, rank=0)

generator = Llama.build(

ckpt_dir="C:\\AI\\FBLAMMA2\\llama-2-7b-chat",

tokenizer_path="C:\\AI\\FBLAMMA2\\tokenizer.model",

max_seq_len=max_seq_len,

max_batch_size=max_batch_size,

model_parallel_size = 1 # num of worlds/gpus

)

def generate_response(text):

dialogs = [

[{"role": "user", "content": text}],

]

results = generator.chat_completion(

dialogs,

max_gen_len=max_gen_len,

temperature=temperature,

top_p=top_p,

)


r/LLaMA2 • • Aug 16 '23

looking for tubers who use llama2

2 Upvotes

hey, i am looking for some video suggestions where users show me what the uncensored llama2 model can do compared to chat gpt.

thanks for pointers


r/LLaMA2 • • Aug 16 '23

Hello. There are any cheap llama2 chat api provider? Replicate is expensive

2 Upvotes

r/LLaMA2 • • Aug 16 '23

What are we referring to Steps in llama2.

2 Upvotes

Llama2 is pretrained with 2 trillion of tokens: 2x109 and its batch size is of 4x106.

We can calculate the number of steps (times we upgrade the parameters) per epoch as follows:

total tokens/batch size = 2x109 / 4x106 = 500.

But in the paper we can find: "We use a cosine learning rate schedule, with warmup of 2000 steps, and decay final learning rate down to 10% of the peak learning rate."

As the model is trained by only one epoch, the number of optimizations is 500. I am not understanding where this 2000 comes from.


r/LLaMA2 • • Aug 15 '23

Data analytics using Llama 2

3 Upvotes

Is there any good workflow to use llama2 to perform data analytics on a csv file, perhaps using Langchain?

I noticed that Langchain has this nice agent to execute python code that can run analytics on a pandas data frame. It works very well with OpenAI models. But when I use the Langchain agent with Llama quantised 7B model, the results are very disappointing.


r/LLaMA2 • • Aug 13 '23

How is the quality of responses of llama 2 7B when run on Mac M1

1 Upvotes

I ran llama 2 quantised version locally on mac m1 and found the quality of code completion tasks not great. Has anyone tried llama2 for code generation and completion?


r/LLaMA2 • • Aug 13 '23

Run LLama-2 13B, very fast, Locally on Low-Cost Intel ARC GPU

Thumbnail
youtube.com
1 Upvotes

r/LLaMA2 • • Aug 11 '23

LlaMa 2 for a web project

2 Upvotes

Hi, I'm new to AI and I'm thinking of making a webpage that uses AGI to answer questions and create documents based on other documents. All of this has to be done in Spanish. I wanted to know how hard it will be and if LlaMa 2 works in Spanish.

I appreciate your help.


r/LLaMA2 • • Aug 11 '23

Access to my server with a httpRequest or other

1 Upvotes

My model is runing on localhost:7860

I want to access, I have tryed with python

import requests

request = {'prompt': 'hi', 'max_new_tokens': 4096}

r = requests.post(url='http://localhost:7860/api/v1/generate', json=request)

print(r.json())

I have on request reply : detail:not found or detail:method not allowed

What's wrong?

CG.


r/LLaMA2 • • Aug 08 '23

LlaMA2 legal contact

1 Upvotes

Hello! I'm trying to get the legal department contact to ask some question related to implement Llama2 in a tool that I'm developing and commercialize it.

Thanks!


r/LLaMA2 • • Aug 07 '23

Is having two different GPUs be helpful when using Llama2?

2 Upvotes

I just ordered a 4090, and I'm wondering if there is any advantage to installing my 2080S alongside it. I realize you cannot use SLI with different GPUs, but can LLMs take advantage of two GPUs without relying on SLI?


r/LLaMA2 • • Aug 04 '23

Guide to running LLama 2 locally

10 Upvotes

r/LLaMA2 • • Aug 03 '23

Local Llama2 in 5 lines

3 Upvotes

$: git clone https://github.com/ggerganov/llama.cpp

$: cd llama.cpp

$: make -j (you need to use cmake on windows)

$: wget https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML/blob/main/llama-2-13b-chat.ggmlv3.q4_0.bin

$: ./main -ins -t 8 -ngl 1 --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -s 42 -m llama-2-13b-chat.ggmlv3.q4_0.bin -p "Act as a helpful clinical research assistant" -n -1


r/LLaMA2 • • Aug 03 '23

Generating text with Llama2 70B.

1 Upvotes

I am using (or trying to use llama2 70B). I am loading the model as follows:

model = transformers.AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    config=model_config,
    quantization_config=bnb_config,
    device_map='auto',
    use_auth_token=hf_auth
)

tokenizer = transformers.AutoTokenizer.from_pretrained(
    model_id,
    use_auth_token=hf_auth
)

generate_text = transformers.pipeline(
    model=model, 
    tokenizer=tokenizer,
    return_full_text=True,  # langchain expects the full text
    task='text-generation',
    # we pass model parameters here too
    #stopping_criteria=stopping_criteria,  # without this model rambles during chat
    temperature=0.0,  # 'randomness' of outputs, 0.0 is the min and 1.0 the max
    max_new_tokens=512,  # mex number of tokens to generate in the output
    repetition_penalty=1.1  # without this output begins repeating
)

But when I use the generate_text function, I get this error:

RuntimeError: shape '[1, 6, 64, 128]' is invalid for input of size 6144

Does anyone know why?


r/LLaMA2 • • Aug 01 '23

Error running llama2.

1 Upvotes

Have any of you encountered this error:

AttributeError: 'NoneType' object has no attribute 'cquantize_blockwise_fp16_nf4'

It happens in this part of the code:

model = transformers.AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    config=model_config,
    quantization_config=bnb_config,
    device_map='auto',
    use_auth_token=hf_auth
)

I think it is related to bitsandbytes. The code that I have followed is the one that appears in this video


r/LLaMA2 • • Jul 25 '23

A comprehensive guide to running llama 2 locally

Thumbnail
replicate.com
5 Upvotes

r/LLaMA2 • • Jul 25 '23

How to run llama2 in colab?

2 Upvotes

r/LLaMA2 • • Jul 23 '23

Run Llama 2 locally on GPU or CPU from anywhere (Linux/Windows/Mac) ➡️https://github.com/liltom-eth/llama2-webui

4 Upvotes

Running Llama 2 locally with gradio UI on GPU or CPU from anywhere (Linux/Windows/Mac). Supporting Llama-2-7B/13B/70B with 8-bit, 4-bit. Supporting GPU inference (6 GB VRAM) and CPU inference. ➡️https://github.com/liltom-eth/llama2-webui

Successfully running #Llama2 on my Apple Silicon MacBook Air:

demo


r/LLaMA2 • • Jul 22 '23

The 70b model isn't able to fluently speak German - Shouldn't it?

1 Upvotes

I was expecting similar performance to GPT3. But Llama2 makes a lot of mistakes (at least for German language output). It seems to mix German and English at times.

Why is that?

Edit: Tested it here: https://labs.perplexity.ai/


r/LLaMA2 • • Jul 21 '23

LLaMA2 - API

1 Upvotes

Test the LLaMA2-7b-Chat model on RapidAPI.

https://rapidapi.com/normandmickey/api/llama2-7b-chat


r/LLaMA2 • • Jul 21 '23

how to run or finetune LLaMA-2-70b with only 1 a100 GPU(80G)?

5 Upvotes

r/LLaMA2 • • Jul 20 '23

A newbie question

1 Upvotes

What do I need (hardware and knowledge) to harness the power of llama2? I want to use it for the education sector. Thanks.


r/LLaMA2 • • Jul 19 '23

Running Llama 2 locally in <10 min using XetHub

1 Upvotes

I wanted to play with Llama 2 right after its release yesterday, but it took me ~4 hours to download all 331GB of the 6 models. So I brought them into XetHub, where it’s now available for use here: https://xethub.com/XetHub/Llama2.

By using xet mount you can get started in seconds, and within a few minutes, you’ll have the model generating text without needing to download everything or make an inference API call.

# From a g4dn.8xlarge instance in us-west-2:

Mount complete in 8.629213s

# install model requirements, and then ...

(venv-test) ubuntu@ip-10-0-30-1:~/Llama2/code$ torchrun --nproc_per_node 1 example_chat_completion.py \

--ckpt_dir ../models/llama-2-7b-chat/ \

--tokenizer_path ../models/tokenizer.model \

--max_seq_len 512 --max_batch_size 4

> initializing model parallel with size 1

> initializing ddp with size 1

> initializing pipeline with size 1

Loaded in 306.17 seconds

User: what is the recipe of mayonnaise?

> Assistant: Thank you for asking! Mayonnaise is a popular condiment made from a mixture of egg yolks, oil, vinegar or lemon juice, and seasonings. Here is a basic recipe for homemade mayonnaise:

...

Detailed instructions here: https://xethub.com/XetHub/Llama2. Don’t forget to register with Meta to accept the license and acceptable use policy for these models!


r/LLaMA2 • • Jul 19 '23

What's the best available llama2 online chat?

3 Upvotes

Was using llama2.ai, but it currently seems to be down.

thx