adityaverma977 commited on
Commit
7b69e72
·
1 Parent(s): 221d021

Replace unavailable models with HF Inference API-verified models (Mistral, Llama 2, Zephyr, etc.)

Browse files
app/hf_spaces.py CHANGED
@@ -7,25 +7,17 @@ from typing import Optional
7
 
8
  HF_API_TOKEN = os.environ.get("HUGGINGFACE_API_TOKEN") or os.environ.get("HF_API_TOKEN")
9
 
10
- # Unified HF-only list for the frontend (curated small→large)
11
  ALL_MODELS = [
12
- {"id": "google/flan-t5-small", "name": "FLAN-T5 Small", "size": "small"},
13
- {"id": "google/flan-t5-base", "name": "FLAN-T5 Base", "size": "small"},
14
- {"id": "google/flan-t5-large", "name": "FLAN-T5 Large", "size": "medium"},
15
- {"id": "bigscience/bloom-3b", "name": "BLOOM 3B", "size": "medium"},
16
- {"id": "EleutherAI/gpt-neo-2.7B", "name": "GPT-Neo 2.7B", "size": "medium"},
17
- {"id": "mistralai/Mistral-7B-Instruct-v0.2", "name": "Mistral 7B Instruct v0.2", "size": "medium"},
18
- {"id": "mistralai/Mistral-7B-Instruct-v0.1", "name": "Mistral 7B Instruct v0.1", "size": "medium"},
19
  {"id": "NousResearch/Nous-Hermes-2-7b", "name": "Nous Hermes 7B", "size": "medium"},
20
- {"id": "HuggingFaceH4/zephyr-7b", "name": "Zephyr 7B", "size": "medium"},
21
  {"id": "tiiuae/falcon-7b-instruct", "name": "Falcon 7B Instruct", "size": "medium"},
22
- {"id": "EleutherAI/gpt-j-6B", "name": "GPT-J 6B", "size": "medium"},
23
  {"id": "meta-llama/Llama-2-7b-chat-hf", "name": "Llama 2 7B Chat", "size": "large"},
24
  {"id": "meta-llama/Llama-2-13b-chat-hf", "name": "Llama 2 13B Chat", "size": "large"},
25
- {"id": "meta-llama/Llama-2-70b-chat-hf", "name": "Llama 2 70B Chat", "size": "xlarge"},
26
- {"id": "bigscience/bloom-176b", "name": "BLOOM 176B", "size": "xlarge"},
27
  {"id": "stabilityai/stablelm-tuned-alpha-3b", "name": "StableLM 3B", "size": "medium"},
28
- {"id": "meta-llama/Llama-3-8b-Instruct", "name": "Llama 3 8B Instruct", "size": "large"},
29
  ]
30
 
31
 
 
7
 
8
  HF_API_TOKEN = os.environ.get("HUGGINGFACE_API_TOKEN") or os.environ.get("HF_API_TOKEN")
9
 
10
+ # Unified HF-only list with models verified to work on HF Inference API
11
  ALL_MODELS = [
12
+ {"id": "mistralai/Mistral-7B-Instruct-v0.2", "name": "Mistral 7B v0.2", "size": "medium"},
13
+ {"id": "mistralai/Mistral-7B-Instruct-v0.1", "name": "Mistral 7B v0.1", "size": "medium"},
 
 
 
 
 
14
  {"id": "NousResearch/Nous-Hermes-2-7b", "name": "Nous Hermes 7B", "size": "medium"},
15
+ {"id": "HuggingFaceH4/zephyr-7b-beta", "name": "Zephyr 7B Beta", "size": "medium"},
16
  {"id": "tiiuae/falcon-7b-instruct", "name": "Falcon 7B Instruct", "size": "medium"},
 
17
  {"id": "meta-llama/Llama-2-7b-chat-hf", "name": "Llama 2 7B Chat", "size": "large"},
18
  {"id": "meta-llama/Llama-2-13b-chat-hf", "name": "Llama 2 13B Chat", "size": "large"},
 
 
19
  {"id": "stabilityai/stablelm-tuned-alpha-3b", "name": "StableLM 3B", "size": "medium"},
20
+ {"id": "WizardLM/WizardLM-7B-V1.0", "name": "WizardLM 7B", "size": "medium"},
21
  ]
22
 
23
 
backend/app/groq_client.py CHANGED
@@ -18,25 +18,17 @@ print(f"[GROQ_CLIENT_INIT] HF_API_TOKEN present: {_HF_API_TOKEN is not None and
18
  if not _HF_API_TOKEN:
19
  print("[GROQ_CLIENT_INIT] WARNING: No HF API token found! Set HF_API_TOKEN or HUGGINGFACE_API_TOKEN env var.")
20
 
21
- # Curated HF model ids (small large)
22
  HF_MODELS = [
23
- "google/flan-t5-small",
24
- "google/flan-t5-base",
25
- "google/flan-t5-large",
26
- "bigscience/bloom-3b",
27
- "EleutherAI/gpt-neo-2.7B",
28
  "mistralai/Mistral-7B-Instruct-v0.2",
29
  "mistralai/Mistral-7B-Instruct-v0.1",
30
  "NousResearch/Nous-Hermes-2-7b",
31
- "HuggingFaceH4/zephyr-7b",
32
  "tiiuae/falcon-7b-instruct",
33
- "EleutherAI/gpt-j-6B",
34
  "meta-llama/Llama-2-7b-chat-hf",
35
  "meta-llama/Llama-2-13b-chat-hf",
36
- "meta-llama/Llama-2-70b-chat-hf",
37
- "bigscience/bloom-176b",
38
  "stabilityai/stablelm-tuned-alpha-3b",
39
- "meta-llama/Llama-3-8b-Instruct",
40
  ]
41
 
42
 
 
18
  if not _HF_API_TOKEN:
19
  print("[GROQ_CLIENT_INIT] WARNING: No HF API token found! Set HF_API_TOKEN or HUGGINGFACE_API_TOKEN env var.")
20
 
21
+ # Curated HF model ids verified to work with HF Inference API
22
  HF_MODELS = [
 
 
 
 
 
23
  "mistralai/Mistral-7B-Instruct-v0.2",
24
  "mistralai/Mistral-7B-Instruct-v0.1",
25
  "NousResearch/Nous-Hermes-2-7b",
26
+ "HuggingFaceH4/zephyr-7b-beta",
27
  "tiiuae/falcon-7b-instruct",
 
28
  "meta-llama/Llama-2-7b-chat-hf",
29
  "meta-llama/Llama-2-13b-chat-hf",
 
 
30
  "stabilityai/stablelm-tuned-alpha-3b",
31
+ "WizardLM/WizardLM-7B-V1.0",
32
  ]
33
 
34
 
backend/app/hf_spaces.py CHANGED
@@ -7,34 +7,23 @@ import os
7
 
8
  HF_API_TOKEN = os.environ.get("HF_API_TOKEN") or os.environ.get("HUGGINGFACE_API_TOKEN")
9
 
10
- # Curated HF model list grouped by rough size/role. This list focuses on
11
- # open-source models available via the HF Inference API. Availability
12
- # depends on your HF account and token privileges.
13
  ALL_MODELS = [
14
- # Small / efficient
15
- {"id": "google/flan-t5-small", "name": "FLAN-T5 Small", "size": "small"},
16
- {"id": "google/flan-t5-base", "name": "FLAN-T5 Base", "size": "small"},
17
- {"id": "google/flan-t5-large", "name": "FLAN-T5 Large", "size": "medium"},
18
- {"id": "bigscience/bloom-3b", "name": "BLOOM 3B", "size": "medium"},
19
- {"id": "EleutherAI/gpt-neo-2.7B", "name": "GPT-Neo 2.7B", "size": "medium"},
20
-
21
- # Mid-size / strong instruction-tuned
22
- {"id": "mistralai/Mistral-7B-Instruct-v0.2", "name": "Mistral 7B Instruct v0.2", "size": "medium"},
23
- {"id": "mistralai/Mistral-7B-Instruct-v0.1", "name": "Mistral 7B Instruct v0.1", "size": "medium"},
24
  {"id": "NousResearch/Nous-Hermes-2-7b", "name": "Nous Hermes 7B", "size": "medium"},
25
- {"id": "HuggingFaceH4/zephyr-7b", "name": "Zephyr 7B", "size": "medium"},
26
  {"id": "tiiuae/falcon-7b-instruct", "name": "Falcon 7B Instruct", "size": "medium"},
27
- {"id": "EleutherAI/gpt-j-6B", "name": "GPT-J 6B", "size": "medium"},
28
-
29
- # Large / chat-capable
30
  {"id": "meta-llama/Llama-2-7b-chat-hf", "name": "Llama 2 7B Chat", "size": "large"},
31
  {"id": "meta-llama/Llama-2-13b-chat-hf", "name": "Llama 2 13B Chat", "size": "large"},
32
- {"id": "meta-llama/Llama-2-70b-chat-hf", "name": "Llama 2 70B Chat", "size": "xlarge"},
33
- {"id": "bigscience/bloom-176b", "name": "BLOOM 176B", "size": "xlarge"},
34
-
35
- # Other notable models
36
  {"id": "stabilityai/stablelm-tuned-alpha-3b", "name": "StableLM 3B", "size": "medium"},
37
- {"id": "meta-llama/Llama-3-8b-Instruct", "name": "Llama 3 8B Instruct", "size": "large"},
38
  ]
39
 
40
 
 
7
 
8
  HF_API_TOKEN = os.environ.get("HF_API_TOKEN") or os.environ.get("HUGGINGFACE_API_TOKEN")
9
 
10
+ # Curated HF model list with models verified to work on HF Inference API.
11
+ # These models are selected for compatibility, availability, and reliability.
 
12
  ALL_MODELS = [
13
+ # Fast, reliable instruction-tuned models (proven to work on HF API)
14
+ {"id": "mistralai/Mistral-7B-Instruct-v0.2", "name": "Mistral 7B v0.2", "size": "medium"},
15
+ {"id": "mistralai/Mistral-7B-Instruct-v0.1", "name": "Mistral 7B v0.1", "size": "medium"},
 
 
 
 
 
 
 
16
  {"id": "NousResearch/Nous-Hermes-2-7b", "name": "Nous Hermes 7B", "size": "medium"},
17
+ {"id": "HuggingFaceH4/zephyr-7b-beta", "name": "Zephyr 7B Beta", "size": "medium"},
18
  {"id": "tiiuae/falcon-7b-instruct", "name": "Falcon 7B Instruct", "size": "medium"},
19
+
20
+ # Llama 2 chat models (reliable)
 
21
  {"id": "meta-llama/Llama-2-7b-chat-hf", "name": "Llama 2 7B Chat", "size": "large"},
22
  {"id": "meta-llama/Llama-2-13b-chat-hf", "name": "Llama 2 13B Chat", "size": "large"},
23
+
24
+ # Stability and other quality models
 
 
25
  {"id": "stabilityai/stablelm-tuned-alpha-3b", "name": "StableLM 3B", "size": "medium"},
26
+ {"id": "WizardLM/WizardLM-7B-V1.0", "name": "WizardLM 7B", "size": "medium"},
27
  ]
28
 
29