Skip to content

Commit 3eeabc7

Browse files
authored
Merge pull request #220 from alexanderbkl/feature/hf_hub_timeout
Fix Hugging Face Hub timeout issues in PEFT model loading
2 parents 4776475 + 23d7e38 commit 3eeabc7

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

fingpt/FinGPT_Benchmark/benchmarks/benchmarks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
from peft import PeftModel, get_peft_model, LoraConfig, TaskType # 0.4.0
33
import torch
44
import argparse
5+
import os
56

67

78
from fpb import test_fpb, test_fpb_mlt
8-
from fiqa import test_fiqa, test_fiqa_mlt
9+
from fiqa import test_fiqa, test_fiqa_mlt
910
from tfns import test_tfns
1011
from nwgi import test_nwgi
1112
from headline import test_headline
@@ -15,6 +16,9 @@
1516
from finred import test_re
1617

1718

19+
# Increase HuggingFace Hub timeout to handle slow network connections or large file downloads
20+
os.environ.setdefault("HF_HUB_TIMEOUT", "120")
21+
1822
import sys
1923
sys.path.append('../')
2024
from utils import *

fingpt/FinGPT_Forecaster/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from datetime import date, datetime, timedelta
1515
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
1616

17+
# Increase HuggingFace Hub timeout to handle slow network connections or large file downloads
18+
os.environ.setdefault("HF_HUB_TIMEOUT", "120")
1719

1820
access_token = os.environ["HF_TOKEN"]
1921
finnhub_client = finnhub.Client(api_key=os.environ["FINNHUB_API_KEY"])

finogrid/fingpt_integration/sentiment/crypto_sentiment.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
"""
99
from __future__ import annotations
1010

11+
import os
1112
import structlog
1213
from typing import Optional
1314
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
1415
from peft import PeftModel
1516
import torch
1617

18+
# Increase HuggingFace Hub timeout to handle slow network connections or large file downloads
19+
os.environ.setdefault("HF_HUB_TIMEOUT", "120")
20+
1721
log = structlog.get_logger()
1822

1923
# FinGPT sentiment labels

0 commit comments

Comments
 (0)