Satyam-Singh commited on
Commit
95ae114
1 Parent(s): 605e7c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -2
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from huggingface_hub import InferenceClient
2
  import gradio as gr
3
  import os
4
  import random
@@ -175,4 +175,45 @@ gr.ChatInterface(
175
  title="LLaVa 56B Large Language Virtual Assiatant",
176
  examples=examples,
177
  concurrency_limit=20,
178
- ).launch(share=True,show_api=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''from huggingface_hub import InferenceClient
2
  import gradio as gr
3
  import os
4
  import random
 
175
  title="LLaVa 56B Large Language Virtual Assiatant",
176
  examples=examples,
177
  concurrency_limit=20,
178
+ ).launch(share=True,show_api=True)'''
179
+
180
+
181
+
182
+
183
+
184
+ import sagemaker
185
+ import boto3
186
+ from sagemaker.huggingface import HuggingFace
187
+
188
+ try:
189
+ role = sagemaker.get_execution_role()
190
+ except ValueError:
191
+ iam = boto3.client('iam')
192
+ role = iam.get_role(RoleName='sagemaker_execution_role')['Role']['Arn']
193
+
194
+ hyperparameters = {
195
+ 'model_name_or_path':'mistralai/Mixtral-8x7B-Instruct-v0.1',
196
+ 'output_dir':'/opt/ml/model'
197
+ # add your remaining hyperparameters
198
+ # more info here https://github.com/huggingface/transformers/tree/v4.37.0/examples/pytorch/language-modeling
199
+ }
200
+
201
+ # git configuration to download our fine-tuning script
202
+ git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.37.0'}
203
+
204
+ # creates Hugging Face estimator
205
+ huggingface_estimator = HuggingFace(
206
+ entry_point='run_clm.py',
207
+ source_dir='./examples/pytorch/language-modeling',
208
+ instance_type='ml.p3.2xlarge',
209
+ instance_count=1,
210
+ role=role,
211
+ git_config=git_config,
212
+ transformers_version='4.37.0',
213
+ pytorch_version='2.1.0',
214
+ py_version='py310',
215
+ hyperparameters = hyperparameters
216
+ )
217
+
218
+ # starting the train job
219
+ huggingface_estimator.fit()