Kevin Fink
commited on
Commit
·
e32d4aa
1
Parent(s):
ce52bdd
dev
Browse files- app.py +4 -8
- gradio-3.wpu +252 -252
- selenium_click.py +2 -2
app.py
CHANGED
@@ -28,9 +28,8 @@ model_save_path = '/data/lora_finetuned_model' # Specify your desired save path
|
|
28 |
model.save_pretrained(model_save_path)
|
29 |
'''
|
30 |
|
31 |
-
def fine_tune_model(dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):
|
32 |
-
try:
|
33 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-efficient-tiny-nh8")
|
34 |
torch.cuda.empty_cache()
|
35 |
torch.nn.CrossEntropyLoss()
|
36 |
#rouge_metric = evaluate.load("rouge", cache_dir='/data/cache')
|
@@ -301,10 +300,7 @@ def run_train(dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):
|
|
301 |
torch.nn.init.xavier_uniform_(param.data) # Xavier initialization
|
302 |
elif 'encoder.block.0.layer.0.DenseReluDense.wo.weight' in name: # Another example layer
|
303 |
torch.nn.init.kaiming_normal_(param.data) # Kaiming initialization
|
304 |
-
|
305 |
-
config = AutoConfig.from_pretrained("google/t5-efficient-tiny-nh8")
|
306 |
-
model = AutoModelForSeq2SeqLM.from_config(config)
|
307 |
-
initialize_weights(model)
|
308 |
lora_config = LoraConfig(
|
309 |
r=4, # Rank of the low-rank adaptation
|
310 |
lora_alpha=8, # Scaling factor
|
@@ -335,7 +331,7 @@ except Exception as e:
|
|
335 |
# Create Gradio interface
|
336 |
try:
|
337 |
iface = gr.Interface(
|
338 |
-
fn=
|
339 |
inputs=[
|
340 |
gr.Textbox(label="Dataset Name (e.g., 'imdb')"),
|
341 |
gr.Textbox(label="HF hub to push to after training"),
|
|
|
28 |
model.save_pretrained(model_save_path)
|
29 |
'''
|
30 |
|
31 |
+
def fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):
|
32 |
+
try:
|
|
|
33 |
torch.cuda.empty_cache()
|
34 |
torch.nn.CrossEntropyLoss()
|
35 |
#rouge_metric = evaluate.load("rouge", cache_dir='/data/cache')
|
|
|
300 |
torch.nn.init.xavier_uniform_(param.data) # Xavier initialization
|
301 |
elif 'encoder.block.0.layer.0.DenseReluDense.wo.weight' in name: # Another example layer
|
302 |
torch.nn.init.kaiming_normal_(param.data) # Kaiming initialization
|
303 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("tarekziade/wikipedia-summaries-t5-efficient-tiny")
|
|
|
|
|
|
|
304 |
lora_config = LoraConfig(
|
305 |
r=4, # Rank of the low-rank adaptation
|
306 |
lora_alpha=8, # Scaling factor
|
|
|
331 |
# Create Gradio interface
|
332 |
try:
|
333 |
iface = gr.Interface(
|
334 |
+
fn=run_train,
|
335 |
inputs=[
|
336 |
gr.Textbox(label="Dataset Name (e.g., 'imdb')"),
|
337 |
gr.Textbox(label="HF hub to push to after training"),
|
gradio-3.wpu
CHANGED
@@ -326,7 +326,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
|
|
326 |
'fRegexFlags': 42,
|
327 |
'fReplaceText': 'add_knowledge_base_to_vector_store',
|
328 |
'fReverse': False,
|
329 |
-
'fSearchText': '
|
330 |
'fStartPos': 0,
|
331 |
'fStyle': 'wildcard',
|
332 |
'fWholeWords': False,
|
@@ -425,311 +425,290 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
|
|
425 |
'wide',
|
426 |
1,
|
427 |
{})],
|
428 |
-
'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('
|
429 |
-
{'attrib-starts': [('
|
430 |
-
|
431 |
-
'code-line': '
|
432 |
-
'first-line':
|
433 |
'folded-linenos': [],
|
434 |
-
'sel-line':
|
435 |
-
'sel-line-start':
|
436 |
-
'selection_end':
|
437 |
-
'selection_start':
|
438 |
'zoom': 0},
|
439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
[loc('selenium_click.py'),
|
441 |
-
{'attrib-starts': [
|
442 |
-
|
|
|
443 |
'first-line': 0,
|
444 |
'folded-linenos': [],
|
445 |
-
'sel-line':
|
446 |
-
'sel-line-start':
|
447 |
-
'selection_end':
|
448 |
-
'selection_start':
|
449 |
'zoom': 0},
|
450 |
-
|
451 |
[loc('app.py'),
|
452 |
-
{'attrib-starts': [('
|
453 |
-
|
454 |
-
'code-line': '
|
455 |
-
'first-line':
|
456 |
-
'folded-linenos': [],
|
457 |
-
'sel-line': 294,
|
458 |
-
'sel-line-start': 13525,
|
459 |
-
'selection_end': 13594,
|
460 |
-
'selection_start': 13566,
|
461 |
-
'zoom': 0},
|
462 |
-
1733890482.8022997],
|
463 |
-
[loc('selenium_click.py'),
|
464 |
-
{'attrib-starts': [],
|
465 |
-
'code-line': 'def test(text): \n',
|
466 |
-
'first-line': 0,
|
467 |
'folded-linenos': [],
|
468 |
-
'sel-line':
|
469 |
-
'sel-line-start':
|
470 |
-
'selection_end':
|
471 |
-
'selection_start':
|
472 |
'zoom': 0},
|
473 |
-
|
474 |
[loc('app.py'),
|
475 |
{'attrib-starts': [('run_train|0|',
|
476 |
-
|
477 |
-
'code-line': '
|
478 |
-
'first-line':
|
479 |
'folded-linenos': [],
|
480 |
-
'sel-line':
|
481 |
-
'sel-line-start':
|
482 |
-
'selection_end':
|
483 |
-
'selection_start':
|
484 |
'zoom': 0},
|
485 |
-
|
486 |
[loc('selenium_click.py'),
|
487 |
-
{'attrib-starts': [
|
488 |
-
|
|
|
489 |
'first-line': 0,
|
490 |
'folded-linenos': [],
|
491 |
-
'sel-line':
|
492 |
-
'sel-line-start':
|
493 |
-
'selection_end':
|
494 |
-
'selection_start':
|
495 |
'zoom': 0},
|
496 |
-
|
497 |
-
[loc('
|
498 |
-
{'attrib-starts': [('
|
499 |
-
|
500 |
-
|
501 |
-
|
|
|
|
|
502 |
'folded-linenos': [],
|
503 |
-
'sel-line':
|
504 |
-
'sel-line-start':
|
505 |
-
'selection_end':
|
506 |
-
'selection_start':
|
507 |
'zoom': 0},
|
508 |
-
|
509 |
-
[loc('
|
510 |
-
{'attrib-starts': [('
|
511 |
-
|
512 |
-
'code-line': "
|
513 |
-
'first-line':
|
514 |
'folded-linenos': [],
|
515 |
-
'sel-line':
|
516 |
-
'sel-line-start':
|
517 |
-
'selection_end':
|
518 |
-
'selection_start':
|
519 |
'zoom': 0},
|
520 |
-
|
521 |
-
[loc('
|
522 |
-
{'attrib-starts': [('
|
523 |
-
|
524 |
-
'code-line': '
|
525 |
-
'first-line':
|
526 |
'folded-linenos': [],
|
527 |
-
'sel-line':
|
528 |
-
'sel-line-start':
|
529 |
-
'selection_end':
|
530 |
-
'selection_start':
|
531 |
'zoom': 0},
|
532 |
-
|
533 |
[loc('selenium_click.py'),
|
534 |
-
{'attrib-starts': [
|
535 |
-
|
|
|
536 |
'first-line': 0,
|
537 |
'folded-linenos': [],
|
538 |
-
'sel-line':
|
539 |
-
'sel-line-start':
|
540 |
-
'selection_end':
|
541 |
-
'selection_start':
|
542 |
'zoom': 0},
|
543 |
-
|
544 |
-
[loc('
|
545 |
-
{'attrib-starts': [('
|
546 |
-
|
547 |
-
'code-line': '
|
548 |
-
'first-line':
|
549 |
'folded-linenos': [],
|
550 |
-
'sel-line':
|
551 |
-
'sel-line-start':
|
552 |
-
'selection_end':
|
553 |
-
'selection_start':
|
554 |
'zoom': 0},
|
555 |
-
|
556 |
[loc('app.py'),
|
557 |
{'attrib-starts': [('run_train|0|',
|
558 |
-
|
559 |
-
'code-line': '
|
560 |
-
'first-line':
|
561 |
'folded-linenos': [],
|
562 |
-
'sel-line':
|
563 |
-
'sel-line-start':
|
564 |
-
'selection_end':
|
565 |
-
'selection_start':
|
566 |
'zoom': 0},
|
567 |
-
|
568 |
-
[loc('
|
569 |
{'attrib-starts': [],
|
570 |
-
'code-line':
|
571 |
-
'first-line':
|
572 |
'folded-linenos': [],
|
573 |
-
'sel-line':
|
574 |
-
'sel-line-start':
|
575 |
-
'selection_end':
|
576 |
-
'selection_start':
|
577 |
'zoom': 0},
|
578 |
-
|
579 |
-
[loc('
|
580 |
-
{'attrib-starts': [('
|
581 |
-
|
582 |
-
'code-line': ' )
|
583 |
-
'first-line':
|
584 |
'folded-linenos': [],
|
585 |
-
'sel-line':
|
586 |
-
'sel-line-start':
|
587 |
-
'selection_end':
|
588 |
-
'selection_start':
|
589 |
'zoom': 0},
|
590 |
-
|
591 |
-
[loc('
|
592 |
-
{'attrib-starts': [('
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
'code-line': ' return forward_call(*args, **kwargs)\n',
|
597 |
-
'first-line': 1723,
|
598 |
'folded-linenos': [],
|
599 |
-
'sel-line':
|
600 |
-
'sel-line-start':
|
601 |
-
'selection_end':
|
602 |
-
'selection_start':
|
603 |
'zoom': 0},
|
604 |
-
|
605 |
-
[loc('
|
606 |
-
{'attrib-starts': [('
|
607 |
-
|
608 |
-
'code-line': "
|
609 |
-
'first-line':
|
610 |
'folded-linenos': [],
|
611 |
-
'sel-line':
|
612 |
-
'sel-line-start':
|
613 |
-
'selection_end':
|
614 |
-
'selection_start':
|
615 |
'zoom': 0},
|
616 |
-
|
617 |
-
[loc('
|
618 |
-
{'attrib-starts': [('
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
'code-line': ' raise ValueError(\n',
|
623 |
-
'first-line': 1364,
|
624 |
'folded-linenos': [],
|
625 |
-
'sel-line':
|
626 |
-
'sel-line-start':
|
627 |
-
'selection_end':
|
628 |
-
'selection_start':
|
629 |
'zoom': 0},
|
630 |
-
|
631 |
-
[loc('
|
632 |
-
{'attrib-starts': [
|
633 |
-
|
634 |
-
'
|
|
|
635 |
'folded-linenos': [],
|
636 |
-
'sel-line':
|
637 |
-
'sel-line-start':
|
638 |
-
'selection_end':
|
639 |
-
'selection_start':
|
640 |
'zoom': 0},
|
641 |
-
|
642 |
-
[loc('
|
643 |
-
{'attrib-starts': [
|
644 |
-
|
645 |
-
'
|
|
|
646 |
'folded-linenos': [],
|
647 |
-
'sel-line':
|
648 |
-
'sel-line-start':
|
649 |
-
'selection_end':
|
650 |
-
'selection_start':
|
651 |
'zoom': 0},
|
652 |
-
|
653 |
-
[loc('
|
654 |
-
{'attrib-starts': [('
|
655 |
-
|
656 |
-
'code-line':
|
657 |
-
'first-line':
|
658 |
'folded-linenos': [],
|
659 |
-
'sel-line':
|
660 |
-
'sel-line-start':
|
661 |
-
'selection_end':
|
662 |
-
'selection_start':
|
663 |
'zoom': 0},
|
664 |
-
|
665 |
20),
|
666 |
'current-loc': loc('selenium_click.py'),
|
667 |
'editor-state-list': [(loc('app.py'),
|
668 |
{'attrib-starts': [('run_train|0|',
|
669 |
-
|
670 |
-
'code-line': '
|
671 |
'first-line': 289,
|
672 |
'folded-linenos': [],
|
673 |
-
'sel-line':
|
674 |
-
'sel-line-start':
|
675 |
-
'selection_end':
|
676 |
-
'selection_start':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
'zoom': 0}),
|
678 |
(loc('selenium_click.py'),
|
679 |
{'attrib-starts': [('test|0|',
|
680 |
2)],
|
681 |
-
'code-line':
|
682 |
-
'first-line': 0,
|
683 |
-
'folded-linenos': [],
|
684 |
-
'sel-line': 9,
|
685 |
-
'sel-line-start': 268,
|
686 |
-
'selection_end': 311,
|
687 |
-
'selection_start': 311,
|
688 |
-
'zoom': 0}),
|
689 |
-
(loc('../tidal_slides_com/src/ts_ai.py'),
|
690 |
-
{'attrib-starts': [],
|
691 |
-
'code-line': '#kevin fink\n',
|
692 |
'first-line': 0,
|
693 |
'folded-linenos': [],
|
694 |
-
'sel-line':
|
695 |
-
'sel-line-start':
|
696 |
-
'selection_end':
|
697 |
-
'selection_start':
|
698 |
-
'zoom': 0}),
|
699 |
-
(loc('../tidal_slides_com/src/ts_main.py'),
|
700 |
-
{'attrib-starts': [('init_summarizer|0|',
|
701 |
-
81)],
|
702 |
-
'code-line': " model_kwargs={'cache_dir': summary_model_fp}\n",
|
703 |
-
'first-line': 81,
|
704 |
-
'folded-linenos': [],
|
705 |
-
'sel-line': 87,
|
706 |
-
'sel-line-start': 2233,
|
707 |
-
'selection_end': 2285,
|
708 |
-
'selection_start': 2241,
|
709 |
-
'zoom': 0}),
|
710 |
-
(loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/generation/utils.py'),
|
711 |
-
{'attrib-starts': [('GenerationMixin|0|',
|
712 |
-
331),
|
713 |
-
('GenerationMixin|0|._validate_model_kwargs|0|',
|
714 |
-
1332)],
|
715 |
-
'code-line': ' raise ValueError(\n',
|
716 |
-
'first-line': 1364,
|
717 |
-
'folded-linenos': [],
|
718 |
-
'sel-line': 1387,
|
719 |
-
'sel-line-start': 74204,
|
720 |
-
'selection_end': 74204,
|
721 |
-
'selection_start': 74204,
|
722 |
'zoom': 0})],
|
723 |
'has-focus': True,
|
724 |
'locked': False},
|
725 |
[loc('app.py'),
|
726 |
-
loc('
|
727 |
-
loc('
|
728 |
-
loc('../tidal_slides_com/src/ts_main.py'),
|
729 |
-
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/generation/utils.py')]),
|
730 |
'open_files': ['app.py',
|
731 |
-
'../tidal_slides_com/src/ts_ai.py',
|
732 |
-
'../tidal_slides_com/src/ts_main.py',
|
733 |
'selenium_click.py']},
|
734 |
'saved_notebook_display': None,
|
735 |
'split_percents': {0: 0.4410585404971933,
|
@@ -739,7 +718,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
|
|
739 |
'tab_location': 'top',
|
740 |
'traversal_pos': ((1,
|
741 |
1),
|
742 |
-
|
743 |
'user_data': {}},
|
744 |
'saved_notebook_display': None,
|
745 |
'split_percents': {0: 0.49743589743589745},
|
@@ -747,17 +726,15 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
|
|
747 |
'tab_location': 'left',
|
748 |
'traversal_pos': ((1,
|
749 |
0),
|
750 |
-
|
751 |
'user_data': {}},
|
752 |
'window-alloc': (0,
|
753 |
0,
|
754 |
1920,
|
755 |
-
|
756 |
guimgr.recent-documents = [loc('selenium_click.py'),
|
757 |
-
loc('
|
758 |
-
loc('
|
759 |
-
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/generation/utils.py'),
|
760 |
-
loc('app.py')]
|
761 |
guimgr.visual-state = {loc('../../envs/gradio-3/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py'): {'attrib-starts': [('ErrorHandler|0|',
|
762 |
140),
|
763 |
('ErrorHandler|0|.check_response|0|',
|
@@ -796,13 +773,35 @@ guimgr.visual-state = {loc('../../envs/gradio-3/lib/python3.12/site-packages/sel
|
|
796 |
'zoom': 0},
|
797 |
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py'): {'attrib-starts': [('infer_framework_load_model|0|',
|
798 |
205)],
|
799 |
-
'code-line': '
|
800 |
-
'first-line':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
'folded-linenos': [],
|
802 |
-
'sel-line':
|
803 |
-
'sel-line-start':
|
804 |
-
'selection_end':
|
805 |
-
'selection_start':
|
806 |
'zoom': 0},
|
807 |
loc('gradio-3.wpr'): {'attrib-starts': [],
|
808 |
'code-line': '#!wing\n',
|
@@ -824,6 +823,7 @@ guimgr.visual-state = {loc('../../envs/gradio-3/lib/python3.12/site-packages/sel
|
|
824 |
'zoom': 0}}
|
825 |
proj.pyexec = {None: ('custom',
|
826 |
'/home/kevin/envs/gradio-3/bin/python3')}
|
|
|
827 |
testing.stored-results = (1,
|
828 |
[],
|
829 |
{})
|
|
|
326 |
'fRegexFlags': 42,
|
327 |
'fReplaceText': 'add_knowledge_base_to_vector_store',
|
328 |
'fReverse': False,
|
329 |
+
'fSearchText': 'readme',
|
330 |
'fStartPos': 0,
|
331 |
'fStyle': 'wildcard',
|
332 |
'fWholeWords': False,
|
|
|
425 |
'wide',
|
426 |
1,
|
427 |
{})],
|
428 |
+
'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('selenium_click.py'),
|
429 |
+
{'attrib-starts': [('test|0|',
|
430 |
+
2)],
|
431 |
+
'code-line': " model_name = 'Baicai003/tiny-t5'\n",
|
432 |
+
'first-line': 0,
|
433 |
'folded-linenos': [],
|
434 |
+
'sel-line': 3,
|
435 |
+
'sel-line-start': 55,
|
436 |
+
'selection_end': 90,
|
437 |
+
'selection_start': 90,
|
438 |
'zoom': 0},
|
439 |
+
1733969719.994683],
|
440 |
+
[loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/tokenization_utils_base.py'),
|
441 |
+
{'attrib-starts': [('PreTrainedTokenizerBase|0|',
|
442 |
+
1379),
|
443 |
+
('PreTrainedTokenizerBase|0|.from_pretrained|0|',
|
444 |
+
1794)],
|
445 |
+
'code-line': ' raise EnvironmentError(\n',
|
446 |
+
'first-line': 1991,
|
447 |
+
'folded-linenos': [],
|
448 |
+
'sel-line': 2015,
|
449 |
+
'sel-line-start': 101653,
|
450 |
+
'selection_end': 101653,
|
451 |
+
'selection_start': 101653,
|
452 |
+
'zoom': 0},
|
453 |
+
1733969734.6770854],
|
454 |
[loc('selenium_click.py'),
|
455 |
+
{'attrib-starts': [('test|0|',
|
456 |
+
2)],
|
457 |
+
'code-line': " model_name = 'Baicai003/tiny-t5'\n",
|
458 |
'first-line': 0,
|
459 |
'folded-linenos': [],
|
460 |
+
'sel-line': 3,
|
461 |
+
'sel-line-start': 55,
|
462 |
+
'selection_end': 91,
|
463 |
+
'selection_start': 91,
|
464 |
'zoom': 0},
|
465 |
+
1733969741.5539677],
|
466 |
[loc('app.py'),
|
467 |
+
{'attrib-starts': [('fine_tune_model|0|',
|
468 |
+
30)],
|
469 |
+
'code-line': ' model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-efficient-tiny-nh8")\n',
|
470 |
+
'first-line': 241,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
'folded-linenos': [],
|
472 |
+
'sel-line': 32,
|
473 |
+
'sel-line-start': 1129,
|
474 |
+
'selection_end': 1213,
|
475 |
+
'selection_start': 1213,
|
476 |
'zoom': 0},
|
477 |
+
1733969749.87093],
|
478 |
[loc('app.py'),
|
479 |
{'attrib-starts': [('run_train|0|',
|
480 |
+
296)],
|
481 |
+
'code-line': ' config = AutoConfig.from_pretrained("google/t5-efficient-tiny-nh8")\n',
|
482 |
+
'first-line': 298,
|
483 |
'folded-linenos': [],
|
484 |
+
'sel-line': 304,
|
485 |
+
'sel-line-start': 13927,
|
486 |
+
'selection_end': 13996,
|
487 |
+
'selection_start': 13968,
|
488 |
'zoom': 0},
|
489 |
+
1733969751.1447525],
|
490 |
[loc('selenium_click.py'),
|
491 |
+
{'attrib-starts': [('test|0|',
|
492 |
+
2)],
|
493 |
+
'code-line': " model_name = 'huseinzol05/abstractive-summarization-v2-tiny-t5-quantized'\n",
|
494 |
'first-line': 0,
|
495 |
'folded-linenos': [],
|
496 |
+
'sel-line': 3,
|
497 |
+
'sel-line-start': 55,
|
498 |
+
'selection_end': 131,
|
499 |
+
'selection_start': 131,
|
500 |
'zoom': 0},
|
501 |
+
1733970908.1719747],
|
502 |
+
[loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/tokenization_utils_base.py'),
|
503 |
+
{'attrib-starts': [('PreTrainedTokenizerBase|0|',
|
504 |
+
1379),
|
505 |
+
('PreTrainedTokenizerBase|0|.from_pretrained|0|',
|
506 |
+
1794)],
|
507 |
+
'code-line': ' raise EnvironmentError(\n',
|
508 |
+
'first-line': 2001,
|
509 |
'folded-linenos': [],
|
510 |
+
'sel-line': 2015,
|
511 |
+
'sel-line-start': 101653,
|
512 |
+
'selection_end': 101653,
|
513 |
+
'selection_start': 101653,
|
514 |
'zoom': 0},
|
515 |
+
1733970913.9058852],
|
516 |
+
[loc('selenium_click.py'),
|
517 |
+
{'attrib-starts': [('test|0|',
|
518 |
+
2)],
|
519 |
+
'code-line': " tokenizer='google/t5-efficient-tiny',\n",
|
520 |
+
'first-line': 0,
|
521 |
'folded-linenos': [],
|
522 |
+
'sel-line': 7,
|
523 |
+
'sel-line-start': 211,
|
524 |
+
'selection_end': 254,
|
525 |
+
'selection_start': 254,
|
526 |
'zoom': 0},
|
527 |
+
1733970939.6640677],
|
528 |
+
[loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py'),
|
529 |
+
{'attrib-starts': [('infer_framework_load_model|0|',
|
530 |
+
205)],
|
531 |
+
'code-line': ' raise ValueError(\n',
|
532 |
+
'first-line': 279,
|
533 |
'folded-linenos': [],
|
534 |
+
'sel-line': 301,
|
535 |
+
'sel-line-start': 12058,
|
536 |
+
'selection_end': 12058,
|
537 |
+
'selection_start': 12058,
|
538 |
'zoom': 0},
|
539 |
+
1733970951.1496227],
|
540 |
[loc('selenium_click.py'),
|
541 |
+
{'attrib-starts': [('test|0|',
|
542 |
+
2)],
|
543 |
+
'code-line': " model_name = 'tarekziade/wikipedia-summaries-t5-efficient-tiny'\n",
|
544 |
'first-line': 0,
|
545 |
'folded-linenos': [],
|
546 |
+
'sel-line': 3,
|
547 |
+
'sel-line-start': 55,
|
548 |
+
'selection_end': 121,
|
549 |
+
'selection_start': 73,
|
550 |
'zoom': 0},
|
551 |
+
1733971918.209765],
|
552 |
+
[loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py'),
|
553 |
+
{'attrib-starts': [('infer_framework_load_model|0|',
|
554 |
+
205)],
|
555 |
+
'code-line': ' raise ValueError(\n',
|
556 |
+
'first-line': 279,
|
557 |
'folded-linenos': [],
|
558 |
+
'sel-line': 301,
|
559 |
+
'sel-line-start': 12058,
|
560 |
+
'selection_end': 12058,
|
561 |
+
'selection_start': 12058,
|
562 |
'zoom': 0},
|
563 |
+
1733971919.070313],
|
564 |
[loc('app.py'),
|
565 |
{'attrib-starts': [('run_train|0|',
|
566 |
+
296)],
|
567 |
+
'code-line': ' config = AutoConfig.from_pretrained("google/t5-efficient-tiny-nh8")\n',
|
568 |
+
'first-line': 298,
|
569 |
'folded-linenos': [],
|
570 |
+
'sel-line': 304,
|
571 |
+
'sel-line-start': 13927,
|
572 |
+
'selection_end': 13996,
|
573 |
+
'selection_start': 13968,
|
574 |
'zoom': 0},
|
575 |
+
1733971926.4038842],
|
576 |
+
[loc('app.py'),
|
577 |
{'attrib-starts': [],
|
578 |
+
'code-line': 'def fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):\n',
|
579 |
+
'first-line': 21,
|
580 |
'folded-linenos': [],
|
581 |
+
'sel-line': 30,
|
582 |
+
'sel-line-start': 1034,
|
583 |
+
'selection_end': 1061,
|
584 |
+
'selection_start': 1061,
|
585 |
'zoom': 0},
|
586 |
+
1733971946.8028426],
|
587 |
+
[loc('app.py'),
|
588 |
+
{'attrib-starts': [('run_train|0|',
|
589 |
+
295)],
|
590 |
+
'code-line': ' model = AutoModelForSeq2SeqLM.from_pretrained("tarekziade/wikipedia-summaries-t5-efficient-tiny")\n',
|
591 |
+
'first-line': 295,
|
592 |
'folded-linenos': [],
|
593 |
+
'sel-line': 303,
|
594 |
+
'sel-line-start': 13856,
|
595 |
+
'selection_end': 13897,
|
596 |
+
'selection_start': 13897,
|
597 |
'zoom': 0},
|
598 |
+
1733971973.3178246],
|
599 |
+
[loc('app.py'),
|
600 |
+
{'attrib-starts': [('fine_tune_model|0|',
|
601 |
+
30)],
|
602 |
+
'code-line': " tokenizer = AutoTokenizer.from_pretrained('google/t5-efficient-tiny', use_fast=True, trust_remote_code=True)\n",
|
603 |
+
'first-line': 89,
|
|
|
|
|
604 |
'folded-linenos': [],
|
605 |
+
'sel-line': 96,
|
606 |
+
'sel-line-start': 3967,
|
607 |
+
'selection_end': 4042,
|
608 |
+
'selection_start': 4042,
|
609 |
'zoom': 0},
|
610 |
+
1733971982.8726587],
|
611 |
+
[loc('app.py'),
|
612 |
+
{'attrib-starts': [('fine_tune_model|0|',
|
613 |
+
30)],
|
614 |
+
'code-line': " tokenizer = AutoTokenizer.from_pretrained('google/t5-efficient-tiny', use_fast=True, trust_remote_code=True)\n",
|
615 |
+
'first-line': 130,
|
616 |
'folded-linenos': [],
|
617 |
+
'sel-line': 96,
|
618 |
+
'sel-line-start': 3967,
|
619 |
+
'selection_end': 4042,
|
620 |
+
'selection_start': 4042,
|
621 |
'zoom': 0},
|
622 |
+
1733971990.8933518],
|
623 |
+
[loc('app.py'),
|
624 |
+
{'attrib-starts': [('fine_tune_model|0|',
|
625 |
+
30)],
|
626 |
+
'code-line': " tokenizer = AutoTokenizer.from_pretrained('google/t5-efficient-tiny-nh8', use_fast=True, trust_remote_code=True)\n",
|
627 |
+
'first-line': 256,
|
|
|
|
|
628 |
'folded-linenos': [],
|
629 |
+
'sel-line': 97,
|
630 |
+
'sel-line-start': 4038,
|
631 |
+
'selection_end': 4042,
|
632 |
+
'selection_start': 4042,
|
633 |
'zoom': 0},
|
634 |
+
1733972563.3713217],
|
635 |
+
[loc('app.py'),
|
636 |
+
{'attrib-starts': [('run_train|0|',
|
637 |
+
296)],
|
638 |
+
'code-line': ' #model = get_peft_model(model, lora_config)\n',
|
639 |
+
'first-line': 292,
|
640 |
'folded-linenos': [],
|
641 |
+
'sel-line': 313,
|
642 |
+
'sel-line-start': 14297,
|
643 |
+
'selection_end': 14344,
|
644 |
+
'selection_start': 14344,
|
645 |
'zoom': 0},
|
646 |
+
1733972569.8712249],
|
647 |
+
[loc('app.py'),
|
648 |
+
{'attrib-starts': [('fine_tune_model|0|',
|
649 |
+
30)],
|
650 |
+
'code-line': ' try: \n',
|
651 |
+
'first-line': 28,
|
652 |
'folded-linenos': [],
|
653 |
+
'sel-line': 31,
|
654 |
+
'sel-line-start': 1120,
|
655 |
+
'selection_end': 1128,
|
656 |
+
'selection_start': 1128,
|
657 |
'zoom': 0},
|
658 |
+
1733972581.3592975],
|
659 |
+
[loc('app.py'),
|
660 |
+
{'attrib-starts': [('run_train|0|',
|
661 |
+
295)],
|
662 |
+
'code-line': ' model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-efficient-tiny-nh8")\n',
|
663 |
+
'first-line': 289,
|
664 |
'folded-linenos': [],
|
665 |
+
'sel-line': 304,
|
666 |
+
'sel-line-start': 13921,
|
667 |
+
'selection_end': 14002,
|
668 |
+
'selection_start': 14002,
|
669 |
'zoom': 0},
|
670 |
+
1733972584.572358]],
|
671 |
20),
|
672 |
'current-loc': loc('selenium_click.py'),
|
673 |
'editor-state-list': [(loc('app.py'),
|
674 |
{'attrib-starts': [('run_train|0|',
|
675 |
+
295)],
|
676 |
+
'code-line': ' model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-efficient-tiny-nh8")\n',
|
677 |
'first-line': 289,
|
678 |
'folded-linenos': [],
|
679 |
+
'sel-line': 304,
|
680 |
+
'sel-line-start': 13921,
|
681 |
+
'selection_end': 14002,
|
682 |
+
'selection_start': 14002,
|
683 |
+
'zoom': 0}),
|
684 |
+
(loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py'),
|
685 |
+
{'attrib-starts': [('infer_framework_load_model|0|',
|
686 |
+
205)],
|
687 |
+
'code-line': ' raise ValueError(\n',
|
688 |
+
'first-line': 279,
|
689 |
+
'folded-linenos': [],
|
690 |
+
'sel-line': 301,
|
691 |
+
'sel-line-start': 12058,
|
692 |
+
'selection_end': 12058,
|
693 |
+
'selection_start': 12058,
|
694 |
'zoom': 0}),
|
695 |
(loc('selenium_click.py'),
|
696 |
{'attrib-starts': [('test|0|',
|
697 |
2)],
|
698 |
+
'code-line': ' model=model_name,\n',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
699 |
'first-line': 0,
|
700 |
'folded-linenos': [],
|
701 |
+
'sel-line': 6,
|
702 |
+
'sel-line-start': 175,
|
703 |
+
'selection_end': 200,
|
704 |
+
'selection_start': 200,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
'zoom': 0})],
|
706 |
'has-focus': True,
|
707 |
'locked': False},
|
708 |
[loc('app.py'),
|
709 |
+
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py'),
|
710 |
+
loc('selenium_click.py')]),
|
|
|
|
|
711 |
'open_files': ['app.py',
|
|
|
|
|
712 |
'selenium_click.py']},
|
713 |
'saved_notebook_display': None,
|
714 |
'split_percents': {0: 0.4410585404971933,
|
|
|
718 |
'tab_location': 'top',
|
719 |
'traversal_pos': ((1,
|
720 |
1),
|
721 |
+
1733970939.6550887),
|
722 |
'user_data': {}},
|
723 |
'saved_notebook_display': None,
|
724 |
'split_percents': {0: 0.49743589743589745},
|
|
|
726 |
'tab_location': 'left',
|
727 |
'traversal_pos': ((1,
|
728 |
0),
|
729 |
+
1733971910.3712847),
|
730 |
'user_data': {}},
|
731 |
'window-alloc': (0,
|
732 |
0,
|
733 |
1920,
|
734 |
+
838)}]}
|
735 |
guimgr.recent-documents = [loc('selenium_click.py'),
|
736 |
+
loc('app.py'),
|
737 |
+
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py')]
|
|
|
|
|
738 |
guimgr.visual-state = {loc('../../envs/gradio-3/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py'): {'attrib-starts': [('ErrorHandler|0|',
|
739 |
140),
|
740 |
('ErrorHandler|0|.check_response|0|',
|
|
|
773 |
'zoom': 0},
|
774 |
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/pipelines/base.py'): {'attrib-starts': [('infer_framework_load_model|0|',
|
775 |
205)],
|
776 |
+
'code-line': ' raise ValueError(\n',
|
777 |
+
'first-line': 277,
|
778 |
+
'folded-linenos': [],
|
779 |
+
'sel-line': 301,
|
780 |
+
'sel-line-start': 12058,
|
781 |
+
'selection_end': 12058,
|
782 |
+
'selection_start': 12058,
|
783 |
+
'zoom': 0},
|
784 |
+
loc('../../envs/gradio-3/lib/python3.12/site-packages/transformers/tokenization_utils_base.py'): {'attrib-starts': [('PreTrainedTokenizerBase|0|',
|
785 |
+
1379),
|
786 |
+
('PreTrainedTokenizerBase|0|.from_pretrained|0|',
|
787 |
+
1794)],
|
788 |
+
'code-line': ' raise EnvironmentError(\n',
|
789 |
+
'first-line': 2001,
|
790 |
+
'folded-linenos': [],
|
791 |
+
'sel-line': 2015,
|
792 |
+
'sel-line-start': 101653,
|
793 |
+
'selection_end': 101653,
|
794 |
+
'selection_start': 101653,
|
795 |
+
'zoom': 0},
|
796 |
+
loc('../tidal_slides_com/src/ts_main.py'): {'attrib-starts': [('init_summarizer|0|',
|
797 |
+
81)],
|
798 |
+
'code-line': " model_kwargs={'cache_dir': summary_model_fp}\n",
|
799 |
+
'first-line': 81,
|
800 |
'folded-linenos': [],
|
801 |
+
'sel-line': 87,
|
802 |
+
'sel-line-start': 2233,
|
803 |
+
'selection_end': 2285,
|
804 |
+
'selection_start': 2241,
|
805 |
'zoom': 0},
|
806 |
loc('gradio-3.wpr'): {'attrib-starts': [],
|
807 |
'code-line': '#!wing\n',
|
|
|
823 |
'zoom': 0}}
|
824 |
proj.pyexec = {None: ('custom',
|
825 |
'/home/kevin/envs/gradio-3/bin/python3')}
|
826 |
+
search.search-history = ['readme']
|
827 |
testing.stored-results = (1,
|
828 |
[],
|
829 |
{})
|
selenium_click.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
from transformers import pipeline
|
2 |
|
3 |
def test(text):
|
4 |
-
model_name = '
|
5 |
summarizer = pipeline(
|
6 |
"summarization",
|
7 |
model=model_name,
|
8 |
-
tokenizer=
|
9 |
clean_up_tokenization_spaces=True,
|
10 |
model_kwargs={'cache_dir': './cache'}
|
11 |
)
|
|
|
1 |
from transformers import pipeline
|
2 |
|
3 |
def test(text):
|
4 |
+
model_name = 'tarekziade/wikipedia-summaries-t5-efficient-tiny'
|
5 |
summarizer = pipeline(
|
6 |
"summarization",
|
7 |
model=model_name,
|
8 |
+
tokenizer='google/t5-efficient-tiny',
|
9 |
clean_up_tokenization_spaces=True,
|
10 |
model_kwargs={'cache_dir': './cache'}
|
11 |
)
|