nbaldwin Neel-Shah-29 commited on
Commit
cd18bf6
1 Parent(s): e4fce0b

Updated run.py to support Huggingface backend (#2)

Browse files

- Updated run.py to support Huggingface backend (18caeb49dcf56f7e563d06c59977723e874efe1a)
- Update run.py (4a87151c31b65b55747982187de61ab8a77a4e8f)
- updated the demo.yaml to support huggingface format (f1b1188c83feeb1d8ac0e457fbc0dbf274f05a3a)
- Parameters not required in huggingflow are removed from yaml file. (504aad133464d08ebf30c31880197d49d9310619)
- Update run.py (ebe17918453b67ca2e547f1f58281ea57023bf30)


Co-authored-by: Neel Shah <Neel-Shah-29@users.noreply.huggingface.co>

Files changed (3) hide show
  1. ChatAtomicFlow.yaml +1 -2
  2. demo.yaml +2 -0
  3. run.py +9 -0
ChatAtomicFlow.yaml CHANGED
@@ -23,8 +23,7 @@ backend:
23
 
24
 
25
  top_p: 0.2
26
- frequency_penalty: 0
27
- presence_penalty: 0
28
  stream: True
29
 
30
 
 
23
 
24
 
25
  top_p: 0.2
26
+
 
27
  stream: True
28
 
29
 
demo.yaml CHANGED
@@ -15,6 +15,7 @@ backend:
15
  model_name:
16
  openai: "gpt-3.5-turbo"
17
  azure: "azure/gpt-4"
 
18
 
19
  # ~~~ generation_parameters ~~
20
  n: 1
@@ -24,6 +25,7 @@ backend:
24
  top_p: 0.2
25
  frequency_penalty: 0
26
  presence_penalty: 0
 
27
 
28
  n_api_retries: 6
29
  wait_time_between_retries: 20
 
15
  model_name:
16
  openai: "gpt-3.5-turbo"
17
  azure: "azure/gpt-4"
18
+ huggingface: "huggingface/meta-llama/Meta-Llama-3-70B-Instruct"
19
 
20
  # ~~~ generation_parameters ~~
21
  n: 1
 
25
  top_p: 0.2
26
  frequency_penalty: 0
27
  presence_penalty: 0
28
+ stream: False
29
 
30
  n_api_retries: 6
31
  wait_time_between_retries: 20
run.py CHANGED
@@ -20,6 +20,11 @@ CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching
20
  # clear_cache() # Uncomment this line to clear the cache
21
 
22
  logging.set_verbosity_debug()
 
 
 
 
 
23
 
24
  dependencies = [
25
  {"url": "aiflows/ChatFlowModule", "revision": os.getcwd()},
@@ -44,6 +49,10 @@ if __name__ == "__main__":
44
  # OpenAI backend
45
  api_information = [ApiInfo(backend_used="openai",
46
  api_key = os.getenv("OPENAI_API_KEY"))]
 
 
 
 
47
  # # Azure backend
48
  # api_information = ApiInfo(backend_used = "azure",
49
  # api_base = os.getenv("AZURE_API_BASE"),
 
20
  # clear_cache() # Uncomment this line to clear the cache
21
 
22
  logging.set_verbosity_debug()
23
+ # Comment out if using huggingface backend
24
+ # The set_verbose() method is used for debugging and logging the outputs and drop_params() method automatically drops the parameters which are not set my litellm (since the response format of OpenAI and huggingface is different we require this to translate Huggingface to OpenAI response format).
25
+ # import litellm
26
+ # litellm.set_verbose=True
27
+ # litellm.drop_params=True
28
 
29
  dependencies = [
30
  {"url": "aiflows/ChatFlowModule", "revision": os.getcwd()},
 
49
  # OpenAI backend
50
  api_information = [ApiInfo(backend_used="openai",
51
  api_key = os.getenv("OPENAI_API_KEY"))]
52
+ #Huggingface backend
53
+ # Here the API_BASE is the api link to your hosted server. By this way, you can run any flows on your own server.
54
+ # api_information = [ApiInfo(backend_used="huggingface",
55
+ # api_key = os.getenv("HUGGINGFACE_API_KEY"), api_base="http://0.0.0.0:5000/v1/completions")]
56
  # # Azure backend
57
  # api_information = ApiInfo(backend_used = "azure",
58
  # api_base = os.getenv("AZURE_API_BASE"),