# Use alpaca with local embedding

**URL:** <https://discuss.huggingface.co/t/use-alpaca-with-local-embedding/39535>\
**Category:** Beginners\
**Created:** [May 11, 2023, 12:42pm UTC](https://discuss.huggingface.co/t/use-alpaca-with-local-embedding/39535 "2023-05-11T12:42:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmcf1902](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@rmcf1902](https://discuss.huggingface.co/u/rmcf1902)\
**Post date:** [May 11, 2023, 12:42pm UTC](https://discuss.huggingface.co/t/use-alpaca-with-local-embedding/39535/1 "2023-05-11T12:42:29Z")

</div>

Hi there!

I am using huggingface model chavinlo/alpaca-native.  
However, when i use local embeddings, my output is always only 1 word long. Can anyone explain this?

```auto
model_nm = 'chavinlo/alpaca-native' 
save_path = '/content/drive/MyDrive/alpaca_native_pretrained_model_pytorch'

model = LlamaForCausalLM.from_pretrained(save_path, return_dict=True, load_in_8bit=True, device_map='auto')

tokenizer = AutoTokenizer.from_pretrained(save_path)

pipe = pipeline(
    "text-generation",
    model=model, 
    tokenizer=tokenizer, 
    max_length=248,
    temperature=0.4,
    top_p=0.95,
    repetition_penalty=1.2
)

local_llm = HuggingFacePipeline(pipeline=pipe)

qa = RetrievalQA.from_chain_type(
    llm=local_llm,
    chain_type="stuff", # "map_reduce",
    retriever=retriever,
    return_source_documents=True,
)

query = "xyz"
llm_response = qa(query)

```

Can anyone help me with that or suggest me alternative ways to embed pdf’s with an LLM, everything locally on colab?

Thanks!  
Yves
