# 504 Timeout when using flan-ul2

**URL:** <https://discuss.huggingface.co/t/504-timeout-when-using-flan-ul2/100770>\
**Category:** Beginners\
**Created:** [August 4, 2024, 12:47am UTC](https://discuss.huggingface.co/t/504-timeout-when-using-flan-ul2/100770 "2024-08-04T00:47:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Realmacaroni](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@Realmacaroni](https://discuss.huggingface.co/u/Realmacaroni)\
**Post date:** [August 4, 2024, 12:47am UTC](https://discuss.huggingface.co/t/504-timeout-when-using-flan-ul2/100770/1 "2024-08-04T00:47:04Z")

</div>

I constently got this error when I’m trying to use flan-ul2:  
"An error occurred: 504 Server Error: Gateway Timeout for url: [https://api-inference.huggingface.co/models/google/flan-ul2](https://api-inference.huggingface.co/models/google/flan-ul2) (Request ID: ZpqtQA6VFVaMqfN6hJmKe)

Model google/flan-ul2 time out"

Can anyone help with this?  
My code is :import os  
from langchain.llms import HuggingFaceHub  
from langchain.chains import ConversationChain  
from langchain.chains.conversation.memory import ConversationBufferMemory

# Hugging Face API token

os.environ[“HUGGINGFACEHUB\_API\_TOKEN”] = “”

flan\_ul2 = HuggingFaceHub(  
repo\_id=“google/flan-ul2”,  
model\_kwargs={“temperature”:0.5, “max\_new\_tokens”:128}  
)

# 创建内存管理器

memory = ConversationBufferMemory()

# 创建对话链

conversation = ConversationChain(  
llm=flan\_ul2,  
verbose=True,  
memory=memory  
)

try:  
response = conversation.predict(input=“Hi there! I am Sam”)  
print(response)

```
response = conversation.predict(input="How are you today?")
print(response)

response = conversation.predict(input="Can you help me with some customer support?")
print(response)

response = conversation.predict(input="My TV is broken. Can you help fix it?")
print(response)

```

except Exception as e:  
print(f"An error occurred: {e}")
