mirror of
				https://github.com/KoboldAI/KoboldAI-Client.git
				synced 2025-06-05 21:59:24 +02:00 
			
		
		
		
	Ngrok Support
Not recommended for home users due to DDoS risks, but might make Colab tunnels more reliable.
This commit is contained in:
		| @@ -316,6 +316,7 @@ def device_config(model): | |||||||
| # Parsing Parameters | # Parsing Parameters | ||||||
| parser = argparse.ArgumentParser(description="KoboldAI Server") | parser = argparse.ArgumentParser(description="KoboldAI Server") | ||||||
| parser.add_argument("--remote", action='store_true', help="Optimizes KoboldAI for Remote Play") | parser.add_argument("--remote", action='store_true', help="Optimizes KoboldAI for Remote Play") | ||||||
|  | parser.add_argument("--ngrok", action='store_true', help="Optimizes KoboldAI for Remote Play using Ngrok") | ||||||
| parser.add_argument("--model", help="Specify the Model Type to skip the Menu") | parser.add_argument("--model", help="Specify the Model Type to skip the Menu") | ||||||
| parser.add_argument("--path", help="Specify the Path for local models (For model NeoCustom or GPT2Custom)") | parser.add_argument("--path", help="Specify the Path for local models (For model NeoCustom or GPT2Custom)") | ||||||
| parser.add_argument("--cpu", action='store_true', help="By default unattended launches are on the GPU use this option to force CPU usage.") | parser.add_argument("--cpu", action='store_true', help="By default unattended launches are on the GPU use this option to force CPU usage.") | ||||||
| @@ -332,6 +333,9 @@ vars.model = args.model; | |||||||
| if args.remote: | if args.remote: | ||||||
|     vars.remote = True; |     vars.remote = True; | ||||||
|  |  | ||||||
|  | if args.ngrok: | ||||||
|  |     vars.remote = True; | ||||||
|  |  | ||||||
| vars.smandelete = vars.remote == args.override_delete | vars.smandelete = vars.remote == args.override_delete | ||||||
| vars.smanrename = vars.remote == args.override_rename | vars.smanrename = vars.remote == args.override_rename | ||||||
|  |  | ||||||
| @@ -2929,6 +2933,10 @@ if __name__ == "__main__": | |||||||
|      |      | ||||||
|     #socketio.run(app, host='0.0.0.0', port=5000) |     #socketio.run(app, host='0.0.0.0', port=5000) | ||||||
|     if(vars.remote): |     if(vars.remote): | ||||||
|  |         if(args.ngrok): | ||||||
|  |             from flask_ngrok import _run_ngrok | ||||||
|  |             cloudflare = _run_ngrok() | ||||||
|  |         else: | ||||||
|            from flask_cloudflared import _run_cloudflared |            from flask_cloudflared import _run_cloudflared | ||||||
|            cloudflare = _run_cloudflared(5000) |            cloudflare = _run_cloudflared(5000) | ||||||
|         with open('cloudflare.log', 'w') as cloudflarelog: |         with open('cloudflare.log', 'w') as cloudflarelog: | ||||||
|   | |||||||
| @@ -15,3 +15,4 @@ dependencies: | |||||||
|   - pip: |   - pip: | ||||||
|     - git+https://github.com/finetuneanon/transformers@gpt-neo-localattention3-rp-b |     - git+https://github.com/finetuneanon/transformers@gpt-neo-localattention3-rp-b | ||||||
|     - flask-cloudflared |     - flask-cloudflared | ||||||
|  |     - flask-ngrok | ||||||
| @@ -15,3 +15,4 @@ dependencies: | |||||||
|   - git |   - git | ||||||
|   - pip: |   - pip: | ||||||
|     - flask-cloudflared |     - flask-cloudflared | ||||||
|  |     - flask-ngrok | ||||||
| @@ -14,3 +14,4 @@ dependencies: | |||||||
|     - torchvision==0.11.1 |     - torchvision==0.11.1 | ||||||
|     - flask-cloudflared |     - flask-cloudflared | ||||||
|     - git+https://github.com/finetuneanon/transformers@gpt-neo-localattention3-rp-b |     - git+https://github.com/finetuneanon/transformers@gpt-neo-localattention3-rp-b | ||||||
|  |     - flask-ngrok | ||||||
| @@ -14,3 +14,4 @@ dependencies: | |||||||
|     - torchvision==0.11.1 |     - torchvision==0.11.1 | ||||||
|     - flask-cloudflared |     - flask-cloudflared | ||||||
|     - git+https://github.com/vfbd/transformers#tfs |     - git+https://github.com/vfbd/transformers#tfs | ||||||
|  |     - flask-ngrok | ||||||
		Reference in New Issue
	
	Block a user