问:
in tkinter.entry using in for loop but when value changed that effect all entery

Here is the code of my application

problem
I have used tkinter Entry() method in for loop in ShowOpeanFile() function and I have make One global list variable where I stored the return value of Entry() but when I enter value in that Entry field it effect on all Entry. But I don't want that.

```<code>#importing Required library
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
import pandas as pd
from functools import reduce

#Global Variables to Store FilePath That OPEAN
Opean_file_path = []
#Making gloabl datagram object store variable
datgramoffileVariable = []
datagram_list = []
finaldatagram_list = []

#get Filename and qauntity
def getvalue(i):
    if Opean_file_path[i][2].get().isnumeric():
        return Opean_file_path[i][1],Opean_file_path[i][2].get(),Opean_file_path[i][0]
    else:
        return -1

#variable making function for file that map each open file during converxlsx function
def variablemaking(size):
    temp = []
    for number in range(size):
        temp.append(str(number))
        temp = (list(set(temp)))
    datgramoffileVariable.clear()
    for i in range(len(temp)):
        datgramoffileVariable.append(temp[i])

#conevrting all file to dataGram using pandas library
def Converxlsx():
    #makingVariable functioncall
    variablemaking(len(Opean_file_path))
    #Now variable Making function Done
    #Go for the convert datagram to file
    for i in range(len(datgramoffileVariable)):
        datgramoffileVariable[i] = pd.DataFrame(pd.read_excel(Opean_file_path[i][0]))
    for i in range(len(datgramoffileVariable)):
        print(datgramoffileVariable[i])
#subpart of Compute function find in list return filepath
def find(target):
    for i in range(len(Opean_file_path)):
        if(Opean_file_path[i][1] == target):
            return Opean_file_path[i][0]
    return -1

def findindex(tar):
    for i in range(len(Opean_file_path)):
        print(Opean_file_path[i][0])
        if(Opean_file_path[i][0] == tar):
            return i

#ComputeFile function
def compute():

    for i in range(len(Opean_file_path)):
        v = getvalue(i)

        if v == -1:
            pass
        else:
            answerOffind = v[0]

            if( answerOffind == -1):
                if(label_for_error.cget('text') == "enter right file name"):
                    label_for_error.config(text="")
                else:
                    label_for_error.config(text="enter right file name", fg='red')
            else:
                label_for_error.config(text="")
                if(len(v[1]) == 0  or v[1].isalpha() or v[1] == ' '):
                    label_for_error.config(text="enter right Qauntity", fg='red')
                    pass
                else:
                    if v[1].isnumeric():
                        if(label_for_error.cget('text') == "enter right Qauntity"):
                            label_for_error.config(text='')
                        indexofmaniuplation = findindex(v[2])
                        print(indexofmaniuplation)
                        datgramoffileVariable[indexofmaniuplation].qauntity = datgramoffileVariable[indexofmaniuplation].qauntity * int(v[1])

# opeanfile function
def ShowOpeanFile():
    col = 0
    ro = 0
    for i in range(len(Opean_file_path)):
        ro = ro + 1
        for j in range(len(Opean_file_path[i])):
            if j > 1:
                Opean_file_path[i][j] = tk.Entry(window,width=20,textvariable=1)
                Opean_file_path[i][j].grid(row=ro,column=col)

            else:
                e = tk.Entry(window, width=20, fg='blue')
                e.grid(row=ro,column=col)
                e.insert(tk.END,Opean_file_path[i][j])
                col = col + 1
        col = col - 2
    for i in range(len(Opean_file_path)):
        for j in range(len(Opean_file_path[i])):
            print(Opean_file_path[i][j])

#browsefile function
def browseFiles():

    #opeanFile only allow Excel file
    '''
    askopenfile return file path of selected file
    it return type is String
    '''
    filename = filedialog.askopenfilename(initialdir = "/",
                                          title = "Select a File",
                                          filetypes = [("Excel file","*.xlsx"),("Excel file", "*.xls")]
                                        )
    #After getting filepath storing into Opean_file_path list
    if(filename in Opean_file_path):
        pass
    else:
        tmp = []
        tmp.append(filename)
        f=filename.split('/')
        tmp.append(f[-1])
        tmp.append('qauntitybox')
        Opean_file_path.append(tmp)
        print(tmp)
        Converxlsx()
        ShowOpeanFile()
        # print(Opean_file_path)
#making final CSV File function.
def csv_making():
    datagram_list.clear()
    finaldatagram_list.clear()
    #convert dataframe into list
    for i in range(len(datgramoffileVariable)):
        datagram_list.extend(datgramoffileVariable[i].values.tolist())
    #find repted element and compute all at one single
    repted_element = []
    datagram_index_to_be_removed=[]
    for i in range(len(datagram_list)):
        temp_id = datagram_list[i][0]
        temp_Qauntity = datagram_list[i][1]
        for j in range(i+1,len(datagram_list)):
            if datagram_list[j][0] == temp_id:
                temp_Qauntity = temp_Qauntity + datagram_list[j][1]
                datagram_index_to_be_removed.append(j)
                datagram_index_to_be_removed.append(i)
            if [temp_id,temp_Qauntity] not in repted_element and datagram_list[j][0] == temp_id:
                repted_element.append([temp_id,temp_Qauntity])
    datagram_index_to_be_removed = list(tuple(datagram_index_to_be_removed))
    #remove repeted element
    datagram_index_to_be_removed.sort()
    for i in range(len(datagram_list)):
        if i in datagram_index_to_be_removed:
            pass

        else:

            finaldatagram_list.append(datagram_list[i])

    #add repted_element
    for i in repted_element:
        finaldatagram_list.append(i)

    #print final data
    # print(finaldatagram_list)

    #convert final list to csv
    id = []
    qauntityto = []
    for i in range(len(finaldatagram_list)):
        id.append(finaldatagram_list[i][0])
        qauntityto.append(finaldatagram_list[i][1])
    dict = {'id':id,'qauntity':qauntityto}
    df = pd.DataFrame(data=dict)
    pathofnewfile = df.to_csv('/home/vegg/Desktop/out.csv',index=False)
    print(pathofnewfile)
    label_for_error.config(text='file save at /home/vegg/Desktop/out.csv',fg='blue')
#UI
window = tk.Tk()
scrollbar = tk.Scrollbar()
frame = tk.Frame(window)
window.geometry("750x400")
label_for_qautity = tk.Label(window ,text="Enter the Qauntity",
                            width=50,height=3)
label_for_qautity.grid(column=2,row=0)
# Qauntity = tk.Entry()
# Qauntity.grid(column=2,row=1)
label_for_fileNamepath = tk.Label(window ,text="File Name path",
                            width=20,height=3)
label_for_fileNamepath.grid(column=0,row=0)
label_for_fileName = tk.Label(window ,text="File Name",
                            width=20,height=3)
label_for_fileName.grid(column=1,row=0)

label_for_error = tk.Label(window ,text="",
                            width=20,height=3)
label_for_error.grid(column=4,row=3)

button_explore = tk.Button(window,
                        text = "Browse Files here",
                        command=lambda :[browseFiles()] )
button_Compute = tk.Button(window,
                        text = "Compute File Data",
                        command=lambda :[compute()] )
button_CSV = tk.Button(window,
                        text = "Create CSV Here",
                        command=lambda :[csv_making()] )

button_explore.grid(column=4,row=0)
button_Compute.grid(column=4,row=1)
button_CSV.grid(column=4, row=2)

window.mainloop()
</code>```

Image

I want to add different value for entry not same value effect to all entry.

Body:
Here is the code of my application

problem
I have used tkinter Entry() method in for loop in ShowOpeanFile() function and I have make One global list variable where I stored the return value of Entry() but when I enter value in that Entry field it effect on all Entry. But I don't want that.

#importing Required library
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
import pandas as pd
from functools import reduce

#Global Variables to Store FilePath That OPEAN
Opean_file_path = []
#Making gloabl datagram object store variable
datgramoffileVariable = []
datagram_list = []
finaldatagram_list = []

#get Filename and qauntity
def getvalue(i):
    if Opean_file_path[i][2].get().isnumeric():
        return Opean_file_path[i][1],Opean_file_path[i][2].get(),Opean_file_path[i][0]
    else:
        return -1

#variable making function for file that map each open file during converxlsx function
def variablemaking(size):
    temp = []
    for number in range(size):
        temp.append(str(number))
        temp = (list(set(temp)))
    datgramoffileVariable.clear()
    for i in range(len(temp)):
        datgramoffileVariable.append(temp[i])

#conevrting all file to dataGram using pandas library
def Converxlsx():
    #makingVariable functioncall
    variablemaking(len(Opean_file_path))
    #Now variable Making function Done
    #Go for the convert datagram to file
    for i in range(len(datgramoffileVariable)):
        datgramoffileVariable[i] = pd.DataFrame(pd.read_excel(Opean_file_path[i][0]))
    for i in range(len(datgramoffileVariable)):
        print(datgramoffileVariable[i])
#subpart of Compute function find in list return filepath
def find(target):
    for i in range(len(Opean_file_path)):
        if(Opean_file_path[i][1] == target):
            return Opean_file_path[i][0]
    return -1

def findindex(tar):
    for i in range(len(Opean_file_path)):
        print(Opean_file_path[i][0])
        if(Opean_file_path[i][0] == tar):
            return i

#ComputeFile function
def compute():

    for i in range(len(Opean_file_path)):
        v = getvalue(i)

        if v == -1:
            pass
        else:
            answerOffind = v[0]

            if( answerOffind == -1):
                if(label_for_error.cget('text') == "enter right file name"):
                    label_for_error.config(text="")
                else:
                    label_for_error.config(text="enter right file name", fg='red')
            else:
                label_for_error.config(text="")
                if(len(v[1]) == 0  or v[1].isalpha() or v[1] == ' '):
                    label_for_error.config(text="enter right Qauntity", fg='red')
                    pass
                else:
                    if v[1].isnumeric():
                        if(label_for_error.cget('text') == "enter right Qauntity"):
                            label_for_error.config(text='')
                        indexofmaniuplation = findindex(v[2])
                        print(indexofmaniuplation)
                        datgramoffileVariable[indexofmaniuplation].qauntity = datgramoffileVariable[indexofmaniuplation].qauntity * int(v[1])

# opeanfile function
def ShowOpeanFile():
    col = 0
    ro = 0
    for i in range(len(Opean_file_path)):
        ro = ro + 1
        for j in range(len(Opean_file_path[i])):
            if j > 1:
                Opean_file_path[i][j] = tk.Entry(window,width=20,textvariable=1)
                Opean_file_path[i][j].grid(row=ro,column=col)

            else:
                e = tk.Entry(window, width=20, fg='blue')
                e.grid(row=ro,column=col)
                e.insert(tk.END,Opean_file_path[i][j])
                col = col + 1
        col = col - 2
    for i in range(len(Opean_file_path)):
        for j in range(len(Opean_file_path[i])):
            print(Opean_file_path[i][j])

#browsefile function
def browseFiles():

    #opeanFile only allow Excel file
    '''
    askopenfile return file path of selected file
    it return type is String
    '''
    filename = filedialog.askopenfilename(initialdir = "/",
                                          title = "Select a File",
                                          filetypes = [("Excel file","*.xlsx"),("Excel file", "*.xls")]
                                        )
    #After getting filepath storing into Opean_file_path list
    if(filename in Opean_file_path):
        pass
    else:
        tmp = []
        tmp.append(filename)
        f=filename.split('/')
        tmp.append(f[-1])
        tmp.append('qauntitybox')
        Opean_file_path.append(tmp)
        print(tmp)
        Converxlsx()
        ShowOpeanFile()
        # print(Opean_file_path)
#making final CSV File function.
def csv_making():
    datagram_list.clear()
    finaldatagram_list.clear()
    #convert dataframe into list
    for i in range(len(datgramoffileVariable)):
        datagram_list.extend(datgramoffileVariable[i].values.tolist())
    #find repted element and compute all at one single
    repted_element = []
    datagram_index_to_be_removed=[]
    for i in range(len(datagram_list)):
        temp_id = datagram_list[i][0]
        temp_Qauntity = datagram_list[i][1]
        for j in range(i+1,len(datagram_list)):
            if datagram_list[j][0] == temp_id:
                temp_Qauntity = temp_Qauntity + datagram_list[j][1]
                datagram_index_to_be_removed.append(j)
                datagram_index_to_be_removed.append(i)
            if [temp_id,temp_Qauntity] not in repted_element and datagram_list[j][0] == temp_id:
                repted_element.append([temp_id,temp_Qauntity])
    datagram_index_to_be_removed = list(tuple(datagram_index_to_be_removed))
    #remove repeted element
    datagram_index_to_be_removed.sort()
    for i in range(len(datagram_list)):
        if i in datagram_index_to_be_removed:
            pass

        else:

            finaldatagram_list.append(datagram_list[i])

    #add repted_element
    for i in repted_element:
        finaldatagram_list.append(i)

    #print final data
    # print(finaldatagram_list)

    #convert final list to csv
    id = []
    qauntityto = []
    for i in range(len(finaldatagram_list)):
        id.append(finaldatagram_list[i][0])
        qauntityto.append(finaldatagram_list[i][1])
    dict = {'id':id,'qauntity':qauntityto}
    df = pd.DataFrame(data=dict)
    pathofnewfile = df.to_csv('/home/vegg/Desktop/out.csv',index=False)
    print(pathofnewfile)
    label_for_error.config(text='file save at /home/vegg/Desktop/out.csv',fg='blue')
#UI
window = tk.Tk()
scrollbar = tk.Scrollbar()
frame = tk.Frame(window)
window.geometry("750x400")
label_for_qautity = tk.Label(window ,text="Enter the Qauntity",
                            width=50,height=3)
label_for_qautity.grid(column=2,row=0)
# Qauntity = tk.Entry()
# Qauntity.grid(column=2,row=1)
label_for_fileNamepath = tk.Label(window ,text="File Name path",
                            width=20,height=3)
label_for_fileNamepath.grid(column=0,row=0)
label_for_fileName = tk.Label(window ,text="File Name",
                            width=20,height=3)
label_for_fileName.grid(column=1,row=0)

label_for_error = tk.Label(window ,text="",
                            width=20,height=3)
label_for_error.grid(column=4,row=3)

button_explore = tk.Button(window,
                        text = "Browse Files here",
                        command=lambda :[browseFiles()] )
button_Compute = tk.Button(window,
                        text = "Compute File Data",
                        command=lambda :[compute()] )
button_CSV = tk.Button(window,
                        text = "Create CSV Here",
                        command=lambda :[csv_making()] )

button_explore.grid(column=4,row=0)
button_Compute.grid(column=4,row=1)
button_CSV.grid(column=4, row=2)

window.mainloop()

Image

I want to add different value for entry not same value effect to all entry.


来源: stackexchange

问:
Flutter: Failed to update local database after sign out
When I click the checkbox it will turned to true but it didn't keep that data once I log in back. This is my code:

```<code>List<FolderTask> folderTask = [];
folderTask = [FolderTask(name: 'Buy groceries stuff', isChecked: false)];
</code>```

This is my FolderTask model:

```<code>

class FolderTask {
  String? name;
  bool isChecked = false;
  FolderTask({required this.name, required this.isChecked});
  factory FolderTask.fromJson(json) {
    return FolderTask(
        name: json['name'], isChecked: json['isChecked'] ?? false);
  }
  Map<String, dynamic> toJson() => {
        "name": name,
        "task": [isChecked]
      };
}

</code>```

This is method to update the list:

```<code>
  // update the database
  void updateDatabase() {
    List folder = [];

    for (var element in folderTask) {
      folder.add(element.toJson());
    }
    if (kDebugMode) {
      print(folder);
    }
    var data = jsonEncode(folder);
    myBox.put(key, data);

    notifyListeners();
  }

</code>```

This is checkbox method where when the default value is false and when the user click it turned to true:

```<code>
  // my function for checkbox
  void checkBoxChanged(bool? value, int index) {
    setState(() {
      db.folderTask[index].isChecked = !db.folderTask[index].isChecked;
    });
    db.updateDatabase();
  }

</code>```

This is code for UI:

```<code>
ListView.builder(
                            padding: const EdgeInsets.only(
                                top: 20, bottom: 20, right: 10),
                            itemCount: foundFolder.length,
                            itemBuilder: (context, index) {
                              return GestureDetector(
                                onTap: () {
                                },
                                child: ToDoTile(
                                    folderName: foundFolder[index].name!,
                                    deleteFunction: (context) =>
                                        _deleteFolder(index),
                                    isChecked: db.folderTask[index].isChecked,
                                    onChanged: (value) =>
                                        checkBoxChanged(value, index)),
                              );
                            })

</code>```

What I want to achieve is to keep the latest data up to date. Because right now, when I click the checkbox(value==true) it didn't keep the data once I log in back (value==false).

ContentLicense: CC BY-SA 4.0

Body:
When I click the checkbox it will turned to true but it didn't keep that data once I log in back. This is my code:

List<FolderTask> folderTask = [];
folderTask = [FolderTask(name: 'Buy groceries stuff', isChecked: false)];

This is my FolderTask model:

class FolderTask {
  String? name;
  bool isChecked = false;
  FolderTask({required this.name, required this.isChecked});
  factory FolderTask.fromJson(json) {
    return FolderTask(
        name: json['name'], isChecked: json['isChecked'] ?? false);
  }
  Map<String, dynamic> toJson() => {
        "name": name,
        "task": [isChecked]
      };
}

This is method to update the list:

  // update the database
  void updateDatabase() {
    List folder = [];

    for (var element in folderTask) {
      folder.add(element.toJson());
    }
    if (kDebugMode) {
      print(folder);
    }
    var data = jsonEncode(folder);
    myBox.put(key, data);

    notifyListeners();
  }

This is checkbox method where when the default value is false and when the user click it turned to true:

  // my function for checkbox
  void checkBoxChanged(bool? value, int index) {
    setState(() {
      db.folderTask[index].isChecked = !db.folderTask[index].isChecked;
    });
    db.updateDatabase();
  }

This is code for UI:

ListView.builder(
                            padding: const EdgeInsets.only(
                                top: 20, bottom: 20, right: 10),
                            itemCount: foundFolder.length,
                            itemBuilder: (context, index) {
                              return GestureDetector(
                                onTap: () {
                                },
                                child: ToDoTile(
                                    folderName: foundFolder[index].name!,
                                    deleteFunction: (context) =>
                                        _deleteFolder(index),
                                    isChecked: db.folderTask[index].isChecked,
                                    onChanged: (value) =>
                                        checkBoxChanged(value, index)),
                              );
                            })

What I want to achieve is to keep the latest data up to date. Because right now, when I click the checkbox(value==true) it didn't keep the data once I log in back (value==false).


问:
nginx forward a request with user name and password
I am trying to forward a post request that i get :

https://user:pass@somedomain.zz/abc/cccc

when i am trying to forward in nginx the request, and put a new url with the user name password the same way i got it nginx not allow me to put it in the conf.d folder and thinks its a port this is the error

```<code>nginx: [emerg] invalid port in upstream "zz:ff@newdomain.com" in /etc/nginx/conf.d/logs.conf:4 nginx: configuration file /etc/nginx/nginx.conf test failed
</code>```

Body:
I am trying to forward a post request that i get :

https://user:pass@somedomain.zz/abc/cccc

when i am trying to forward in nginx the request, and put a new url with the user name password the same way i got it nginx not allow me to put it in the conf.d folder and thinks its a port this is the error

nginx: [emerg] invalid port in upstream "zz:ff@newdomain.com" in /etc/nginx/conf.d/logs.conf:4 nginx: configuration file /etc/nginx/nginx.conf test failed


问:
Is it possible to know the Rect of visible area in a View when scaled in Android?
If I have a view that I use 'ScaleGestureDetectorto detect the scale, and apply scale factor to the view. When the View is zoomed in, only portion of the view is visible. That's what I'm curious about. Is it possible to get that area in aRect`?

I don't have a code sample. It's gonna be something like below. Black rect is the screen and red rect is the content. When content is scaled, it is only partially visible. Is it possible to get the green area?


问:
Spinner is not rotating after upgrading to Angular 11
I have upgraded my Angular version to 11. And now in my application there is a spinner (Circle-shaped). Earlier it was rotating and now it has stopped rotating. Its just static circle. Below are my files.

app.scss

```<code>$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';

@import "~@ct-tuxedo/tuxedo-bootstrap/css/tuxedo-bootstrap4-theme.css";
@import "~@ct-tuxedo/tuxedo-bootstrap/css/tuxedo-components.css";
@import "~@ct-tuxedo/tuxedo-bootstrap/css/tuxedo-icons.css";
@import "~ngx-bootstrap/datepicker/bs-datepicker.css";
@import "~ng2-tree/styles.css";

@import '~@fortawesome/fontawesome-free/scss/fontawesome.scss';
@import '~@fortawesome/fontawesome-free/scss/solid.scss';
@import '~@fortawesome/fontawesome-free/scss/regular.scss';
@import '~@fortawesome/fontawesome-free/scss/brands.scss';

@import '~@swimlane/ngx-datatable/index.css';
@import '~@swimlane/ngx-datatable/themes/material.css';
@import '~@swimlane/ngx-datatable/assets/icons.css';

html, body {
    height: 100%;
}
menu, ol, ul {
    padding: 0;
}
dl, menu, ol, ul {
    margin: 0;

}
.menu-selector {
    color: #fff;
    font-size: 24px;
}
.ml-10 {
    margin-left: 100px;
}
.mt-6 {
    margin-top: 60px;
}
.pl-7 {
    padding-left: 70px;
}
.side-bar {
    position: fixed;
    height: 100%;
    width: 50px;
    left: 0;
    background-color: #332b25;
    color: #fff;
    z-index: 5004;
    top: 0px;
}
/*Header css overridings*/
.tuxedo_navbar {
    background-color: #0467b3;
    color: #fff;
}
.tuxedo_navbar .profile .dropdown-menu {
    left: 0 !important;
}
.secondary_navigation {
    padding:0px !important;
}
.secondary_navigation .parent_list li a {
    padding: .5rem 1.25rem .5rem 0 !important;
    cursor: pointer;
}
.site-header {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    overflow: hidden;
}
.portal-header {
    background-color: #0467b3;
    color: #FFFFFF!important;
    padding:10px;
}

.logo-txt {
    width: 135px!important;
    height: 32px;
    border-width: 0;
}
.divider:after {
    color:#fff;
}
.tuxedo_navbar .navbar-brand img {
    width: 32px;
    height: 32px;
    border-width: 0;
}

.main-container {
    display: grid;
    grid-template-columns: 50px 1fr;
}
.main-nav {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 50px;
    -moz-box-flex: 0;
    -ms-flex: 0 0 50px;
    flex: 0 0 50px;
    -ms-grid-column: 1;
    text-align: center;
    position: relative;
    z-index: 30;
    background: #332b25;
    padding: 1rem 0 0 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.side-bar a span {
    background-color: inherit!important;
    color: #fff!important;
    white-space: nowrap;
    padding:10px 20px 0 10px;
    position: absolute;
    top: 0;
    height: 50px;
    display: none;
    left: 46px;
    text-align: left;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    font-size: 1.8em;
    font-weight: 300;
}
.hidden {
    display: none!important;
}
.showFlyOut {
    display: block!important;
}
.mainNavActive {
    border-left: 4px solid #0092ff;
    background-color: #6c6966!important;
}
.side-bar > ul {
    position: fixed;
    top: 150px;
}
.side-bar > ul > li {
    position: relative;

}
.side-bar > ul > li i {
    color: #fff;
    font-size: 24px;
}
.side-bar > ul > li a {
    font-weight: 120;
    font-size: 0.55rem;
    letter-spacing: 0.04rem;
    color: white;
    padding: 0.75rem 0.5rem;
    position: relative;
    display: block;
    background-color: #4e4744;
    margin:1px;
}
.side-bar > ul > li a.active {
    background-color: #6c6966!important;
    border-left: 4px solid #0092ff;
}
.side-container {
    background: white;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -moz-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    -ms-grid-column: 2;
    overflow: hidden;
}
nav ul, nav ol {
    list-style: none;
    list-style-image: none;
}
#reports {
    width: 100%;
    height: 800px;
    background: rgba(0, 0, 0, 0.1);
    overflow: auto;
  }

  .pdf-page-canvas {
    display: block;
    margin: 5px auto;
    border: 1px solid rgba(0, 0, 0, 0.2);
  }
  .pdf-red {
      color: red;
  }
  .excel-green {
      color: green;
  }
  .ppt-orange {
      color: orange;
  }

 /*
Force table width to 100% http://jsfiddle.net/sschauhan/7h5eaeb6/
*/
table.table-fixedheader {
    width: 100%;
}
/*
Set table elements to block mode.  (Normally they are inline).
This allows a responsive table, such as one where columns can be stacked
if the display is narrow.
*/
 table.table-fixedheader, table.table-fixedheader>thead, table.table-fixedheader>tbody, table.table-fixedheader>thead>tr, table.table-fixedheader>tbody>tr, table.table-fixedheader>thead>tr>th, table.table-fixedheader>tbody>td {
    display: block;
}
table.table-fixedheader>thead>tr:after, table.table-fixedheader>tbody>tr:after {
    content:' ';
    display: block;
    visibility: hidden;
    clear: both;
}
/*
When scrolling the table, actually it is only the tbody portion of the
table that scrolls (not the entire table: we want the thead to remain
fixed).  We must specify an explicit height for the tbody.  We include
100px as a default, but it can be overridden elsewhere.

Also, we force the scrollbar to always be displayed so that the usable
width for the table contents doesn't change (such as becoming narrower
when a scrollbar is visible and wider when it is not).
*/
 table.table-fixedheader>tbody {
    overflow-y: scroll;
    height: 100px;

}
/*
We really don't want to scroll the thead contents, but we want to force
a scrollbar to be displayed anyway so that the usable width of the thead
will exactly match the tbody.
*/
 table.table-fixedheader>thead {
    overflow-y: scroll;
}
/*
For browsers that support it (webkit), we set the background color of
the unneeded scrollbar in the thead to make it invisible.  (Setting
visiblity: hidden defeats the purpose, as this alters the usable width
of the thead.)
*/
 table.table-fixedheader>thead::-webkit-scrollbar {
    background-color: inherit;
}

table.table-fixedheader>thead>tr>th:after, table.table-fixedheader>tbody>tr>td:after {
    content:' ';
    display: table-cell;
    visibility: hidden;
    clear: both;
}

/*
We want to set <th> and <td> elements to float left.
We also must explicitly set the width for each column (both for the <th>
and the <td>).  We set to 20% here a default placeholder, but it can be
overridden elsewhere.
*/

 table.table-fixedheader>thead tr th, table.table-fixedheader>tbody tr td {
    float: left;
    word-wrap:break-word;
}
.table-height {
    height: 65vh !important;
}
tr.collapse.in {display: table-row !important}

#approvalCentralTable {
    .icon {
        transform: none!important;
    }
}
.helpText li{
    list-style-type: decimal;
}
.help-list li{
    list-style-type: disc;
    margin-left: 10px;
}
.activeLinks {
    font-weight: bold;
}

.card .card-header button {
    padding: 0.375rem 1.25rem;
}
.noPadding {
    padding: 0px;
}
.search_box {
    background-color: #307fbd;
    padding: 15px 30px;
    position: relative;
}
.search_header {
    background-color: #0467b3;
    color: #fff;
    margin-left: -20px;
}

.hoverPointer{
  cursor:pointer;
}
.hoverChangeColor:hover{
  background-color: #e0dacc;
}

#typeSelector option::first-letter {
    text-transform: uppercase; /* change first letter to uppercase */
}
.icon.Document-o.charcoal{
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg  viewBox%3D%222 2 20 20%22  xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M12.778 4c.206 0 .404.077.55.213l5.444 5.09a.704.704 0 0 1 .228.515v8C19 19.023 17.955 20 16.667 20H7.333C6.045 20 5 19.023 5 17.818V6.182C5 4.977 6.045 4 7.333 4zM7.333 5.455c-.43 0-.777.325-.777.727v11.636c0 .402.348.727.777.727h9.334c.43 0 .777-.325.777-.727V10.12l-4.988-4.664zm6.223 3.636h4.666c.43 0 .778.326.778.727 0 .402-.348.727-.778.727h-5.444c-.43 0-.778-.325-.778-.727v-5.09c0-.402.348-.728.778-.728s.778.326.778.727z%22 fill%3D%22%23333333%22%2F%3E%3C%2Fsvg%3E')
}

#RegistrationForm .clear_icon {
  display: none !important;
}

.disabledLink {
    color: #6c6966!important;
}
.capital-text{
  text-transform: uppercase;
}

#RegistrationForm tux-autocomplete input{
  text-transform: uppercase;
}

.registrationToolbarButton{
  background-color: #0467b3;
  color:white;
  width: 160px;
  padding:10px;
  border-radius: 4px;
  -webkit-transition-duration: 0.4s;
  border:none;
}

.button:hover{
  cursor:pointer;
  color:white;
  background-color: #1B709E;
}

.session-timeout {
    position: sticky;
    position: fixed;
    width: 100%;
    background-color: #0467b3;
    z-index: 10000;
}
.capitalize {
    text-transform: capitalize;
}
.message .alert .message_text{
  padding: .5rem !important;
}
.message .alert .message_text h4{
  display: none !important;
}

#approvalCentral .alert .message_text{
    padding: .5rem !important;
  }
#approvalCentral .alert .message_text h4{
    display: none !important;
  }
.ri-export-btn {
    color: #fff !important;
}

.error-tab a{
  background-color: #f2dede !important;
  //color: #a94442!important;
}
.draggable {
    cursor: pointer;
}
.treeview-container {
    overflow-y: visible !important;
}
.hideBuildNo {
    color: #0467b3!important;
}
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
}
.blinking {
    animation:blinkingText 5s infinite;
}
@keyframes blinkingText{
    0%{     color: #000;    }
    49%{    color:  #EE7822; }
    50%{    color: transparent}
    99%{    color: #FF0000;  }
    100%{   color: #000;    }
}
.icon.lock-o.charcoal{
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg  viewBox%3D%222 2 20 20%22  xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M13 16.732V18a1 1 0 0 1-2 0v-1.268a2 2 0 1 1 2 0zM18 9h-1V7c0-2.76-2.24-5-5-5S7 4.24 7 7v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V11c0-1.1-.9-2-2-2zM8.9 7c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9zM18 21H6V11h12z%22 fill%3D%22%23333333%22 fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E')
}

.dot {
  height: 25px;
  width: 25px;
  background-color: #bf2155;
  border-radius: 50%;
  display: inline-block;
  text-align: center;
  font-weight: bold;
}
.AffirmationAcc{
  padding-left: 38px;
}
.error_txt {
    color: red;
}
/* Global change for tux alert messages/ removing the head */
.alert .message_text h4{
    display: none !important;
  }

#divpopover4 popover-container {
    max-width: none !important;
}

.removeRowPadding {
    padding-right: 15px;
    padding-left: 15px;
    overflow-x: auto;
}
input:disabled, select:disabled, textarea:disabled {
    background: #f0f0f0 !important;
    color: #595959 !important;
}

.not-allowedCursor{
  cursor: not-allowed;
}

div.filter_options{
  display: none !important; /*this might remove tux-auto-complete's messages*/
}

.disable-background-opacity{
  position: fixed;
  top: 0;
  left: 0;
  background: whitesmoke;
  opacity: 0.4;
  z-index: 998;
  height: 100%;
  width: 100%;
}

.vh_container {
  position: absolute;
  top: 50%;
  margin-top: -200px;
  /* half of #content height*/
  left: 0;
  width: 100%;
}

a.disabled {
  color: gray;
  cursor: not-allowed;
}
</code>```

home.scss

```<code>.home{
  color: black;
  font-size: 1rem;
}

.home p{
  color: #000;
}

.home-padding{
  padding: 10px 60px 10px 60px;
}

.home-heading{
  font-size: 2.25rem;
  font-weight: 200;
  border-bottom: 2px solid rgb(214,214,214);
  padding-bottom: 15px;
  color: black;
}

.ma-t20{
  margin-top: 20px;
}

.ma-t10{
  margin-top: 10px;
}

.ma-l10{
  margin-left: 10px;
}
.ma-r5{
  margin-right: 5px;
}

.ma-t100{
  margin-top: 100px;
}

.ma-10{
  margin-top: 10px;
  margin-left: 10px;
  margin-right: 10px;
  margin-bottom: 10px;
}

.ma-t30{
  margin-top: 30px;
}

.ma-t60{
  margin-top: 60px;
}

.ma-tm30{
  margin-top: -30px;
}

.ma-b20{
  margin-bottom: 20px;
}

.ma-b10{
  margin-bottom: 10px;
}

.ma-b40{
  margin-bottom: 40px;
}

.paraStrong{
  font-weight: bold;
}

.align.center{
  text-align: center;
}

.align.right{
  text-align: right;
}

.home-link{
  color: #0d91e4;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 200;
}

.home-link-disabled{
  color: #848484;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 200;
}

p.copy{
  color: #848484;
}

.notification-link{
  text-decoration: none;
  font-size: 2.25rem;
  font-weight: 200;
  padding-bottom: 15px;
  color: black;
}

.bottom-border{
  border-bottom: 2px solid rgb(214,214,214);
}

.tooltip{
  max-width: 400px;
}
.home-popover-link{
  color: #0d91e4;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 200;
}

a:hover   {
  text-decoration:  none;
  color: #0d91e4;
}

#notification ul li, #notification ol li{
  line-height: 1.75rem;
  padding-bottom: 1px;
}
#notification ul, #notification ol{
  margin: 10px 10px 10px 35px;
}

ul.a {
  list-style-type: square;
}

.detailsPopup .tooltip, .tooltip-inner {
  max-width: 100%;
}

.signin-padding{
  padding-top: 120px;
}

.input-width{
  width: 50%;
}

.card {
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
  transition: 0.3s;
}

.card:hover {
  box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.ma-b10{
  margin-bottom: 10px;
}
</code>```

Any sort of help is appreciated,
Updated code snippets with only home.scss and app.scss

Body:
I have upgraded my Angular version to 11. And now in my application there is a spinner (Circle-shaped). Earlier it was rotating and now it has stopped rotating. Its just static circle. Below are my files.

app.scss

$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';

@import "~@ct-tuxedo/tuxedo-bootstrap/css/tuxedo-bootstrap4-theme.css";
@import "~@ct-tuxedo/tuxedo-bootstrap/css/tuxedo-components.css";
@import "~@ct-tuxedo/tuxedo-bootstrap/css/tuxedo-icons.css";
@import "~ngx-bootstrap/datepicker/bs-datepicker.css";
@import "~ng2-tree/styles.css";

@import '~@fortawesome/fontawesome-free/scss/fontawesome.scss';
@import '~@fortawesome/fontawesome-free/scss/solid.scss';
@import '~@fortawesome/fontawesome-free/scss/regular.scss';
@import '~@fortawesome/fontawesome-free/scss/brands.scss';

@import '~@swimlane/ngx-datatable/index.css';
@import '~@swimlane/ngx-datatable/themes/material.css';
@import '~@swimlane/ngx-datatable/assets/icons.css';

html, body {
    height: 100%;
}
menu, ol, ul {
    padding: 0;
}
dl, menu, ol, ul {
    margin: 0;

}
.menu-selector {
    color: #fff;
    font-size: 24px;
}
.ml-10 {
    margin-left: 100px;
}
.mt-6 {
    margin-top: 60px;
}
.pl-7 {
    padding-left: 70px;
}
.side-bar {
    position: fixed;
    height: 100%;
    width: 50px;
    left: 0;
    background-color: #332b25;
    color: #fff;
    z-index: 5004;
    top: 0px;
}
/*Header css overridings*/
.tuxedo_navbar {
    background-color: #0467b3;
    color: #fff;
}
.tuxedo_navbar .profile .dropdown-menu {
    left: 0 !important;
}
.secondary_navigation {
    padding:0px !important;
}
.secondary_navigation .parent_list li a {
    padding: .5rem 1.25rem .5rem 0 !important;
    cursor: pointer;
}
.site-header {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    overflow: hidden;
}
.portal-header {
    background-color: #0467b3;
    color: #FFFFFF!important;
    padding:10px;
}

.logo-txt {
    width: 135px!important;
    height: 32px;
    border-width: 0;
}
.divider:after {
    color:#fff;
}
.tuxedo_navbar .navbar-brand img {
    width: 32px;
    height: 32px;
    border-width: 0;
}

.main-container {
    display: grid;
    grid-template-columns: 50px 1fr;
}
.main-nav {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 50px;
    -moz-box-flex: 0;
    -ms-flex: 0 0 50px;
    flex: 0 0 50px;
    -ms-grid-column: 1;
    text-align: center;
    position: relative;
    z-index: 30;
    background: #332b25;
    padding: 1rem 0 0 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.side-bar a span {
    background-color: inherit!important;
    color: #fff!important;
    white-space: nowrap;
    padding:10px 20px 0 10px;
    position: absolute;
    top: 0;
    height: 50px;
    display: none;
    left: 46px;
    text-align: left;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    font-size: 1.8em;
    font-weight: 300;
}
.hidden {
    display: none!important;
}
.showFlyOut {
    display: block!important;
}
.mainNavActive {
    border-left: 4px solid #0092ff;
    background-color: #6c6966!important;
}
.side-bar > ul {
    position: fixed;
    top: 150px;
}
.side-bar > ul > li {
    position: relative;

}
.side-bar > ul > li i {
    color: #fff;
    font-size: 24px;
}
.side-bar > ul > li a {
    font-weight: 120;
    font-size: 0.55rem;
    letter-spacing: 0.04rem;
    color: white;
    padding: 0.75rem 0.5rem;
    position: relative;
    display: block;
    background-color: #4e4744;
    margin:1px;
}
.side-bar > ul > li a.active {
    background-color: #6c6966!important;
    border-left: 4px solid #0092ff;
}
.side-container {
    background: white;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -moz-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    -ms-grid-column: 2;
    overflow: hidden;
}
nav ul, nav ol {
    list-style: none;
    list-style-image: none;
}
#reports {
    width: 100%;
    height: 800px;
    background: rgba(0, 0, 0, 0.1);
    overflow: auto;
  }

  .pdf-page-canvas {
    display: block;
    margin: 5px auto;
    border: 1px solid rgba(0, 0, 0, 0.2);
  }
  .pdf-red {
      color: red;
  }
  .excel-green {
      color: green;
  }
  .ppt-orange {
      color: orange;
  }

 /*
Force table width to 100% http://jsfiddle.net/sschauhan/7h5eaeb6/
*/
table.table-fixedheader {
    width: 100%;
}
/*
Set table elements to block mode.  (Normally they are inline).
This allows a responsive table, such as one where columns can be stacked
if the display is narrow.
*/
 table.table-fixedheader, table.table-fixedheader>thead, table.table-fixedheader>tbody, table.table-fixedheader>thead>tr, table.table-fixedheader>tbody>tr, table.table-fixedheader>thead>tr>th, table.table-fixedheader>tbody>td {
    display: block;
}
table.table-fixedheader>thead>tr:after, table.table-fixedheader>tbody>tr:after {
    content:' ';
    display: block;
    visibility: hidden;
    clear: both;
}
/*
When scrolling the table, actually it is only the tbody portion of the
table that scrolls (not the entire table: we want the thead to remain
fixed).  We must specify an explicit height for the tbody.  We include
100px as a default, but it can be overridden elsewhere.

Also, we force the scrollbar to always be displayed so that the usable
width for the table contents doesn't change (such as becoming narrower
when a scrollbar is visible and wider when it is not).
*/
 table.table-fixedheader>tbody {
    overflow-y: scroll;
    height: 100px;

}
/*
We really don't want to scroll the thead contents, but we want to force
a scrollbar to be displayed anyway so that the usable width of the thead
will exactly match the tbody.
*/
 table.table-fixedheader>thead {
    overflow-y: scroll;
}
/*
For browsers that support it (webkit), we set the background color of
the unneeded scrollbar in the thead to make it invisible.  (Setting
visiblity: hidden defeats the purpose, as this alters the usable width
of the thead.)
*/
 table.table-fixedheader>thead::-webkit-scrollbar {
    background-color: inherit;
}

table.table-fixedheader>thead>tr>th:after, table.table-fixedheader>tbody>tr>td:after {
    content:' ';
    display: table-cell;
    visibility: hidden;
    clear: both;
}

/*
We want to set  and  elements to float left.
We also must explicitly set the width for each column (both for the
and the ).  We set to 20% here a default placeholder, but it can be
overridden elsewhere.
*/

 table.table-fixedheader>thead tr th, table.table-fixedheader>tbody tr td {
    float: left;
    word-wrap:break-word;
}
.table-height {
    height: 65vh !important;
}
tr.collapse.in {display: table-row !important}

#approvalCentralTable {
    .icon {
        transform: none!important;
    }
}
.helpText li{
    list-style-type: decimal;
}
.help-list li{
    list-style-type: disc;
    margin-left: 10px;
}
.activeLinks {
    font-weight: bold;
}

.card .card-header button {
    padding: 0.375rem 1.25rem;
}
.noPadding {
    padding: 0px;
}
.search_box {
    background-color: #307fbd;
    padding: 15px 30px;
    position: relative;
}
.search_header {
    background-color: #0467b3;
    color: #fff;
    margin-left: -20px;
}

.hoverPointer{
  cursor:pointer;
}
.hoverChangeColor:hover{
  background-color: #e0dacc;
}

#typeSelector option::first-letter {
    text-transform: uppercase; /* change first letter to uppercase */
}
.icon.Document-o.charcoal{
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg  viewBox%3D%222 2 20 20%22  xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M12.778 4c.206 0 .404.077.55.213l5.444 5.09a.704.704 0 0 1 .228.515v8C19 19.023 17.955 20 16.667 20H7.333C6.045 20 5 19.023 5 17.818V6.182C5 4.977 6.045 4 7.333 4zM7.333 5.455c-.43 0-.777.325-.777.727v11.636c0 .402.348.727.777.727h9.334c.43 0 .777-.325.777-.727V10.12l-4.988-4.664zm6.223 3.636h4.666c.43 0 .778.326.778.727 0 .402-.348.727-.778.727h-5.444c-.43 0-.778-.325-.778-.727v-5.09c0-.402.348-.728.778-.728s.778.326.778.727z%22 fill%3D%22%23333333%22%2F%3E%3C%2Fsvg%3E')
}

#RegistrationForm .clear_icon {
  display: none !important;
}

.disabledLink {
    color: #6c6966!important;
}
.capital-text{
  text-transform: uppercase;
}

#RegistrationForm tux-autocomplete input{
  text-transform: uppercase;
}

.registrationToolbarButton{
  background-color: #0467b3;
  color:white;
  width: 160px;
  padding:10px;
  border-radius: 4px;
  -webkit-transition-duration: 0.4s;
  border:none;
}

.button:hover{
  cursor:pointer;
  color:white;
  background-color: #1B709E;
}

.session-timeout {
    position: sticky;
    position: fixed;
    width: 100%;
    background-color: #0467b3;
    z-index: 10000;
}
.capitalize {
    text-transform: capitalize;
}
.message .alert .message_text{
  padding: .5rem !important;
}
.message .alert .message_text h4{
  display: none !important;
}

#approvalCentral .alert .message_text{
    padding: .5rem !important;
  }
#approvalCentral .alert .message_text h4{
    display: none !important;
  }
.ri-export-btn {
    color: #fff !important;
}

.error-tab a{
  background-color: #f2dede !important;
  //color: #a94442!important;
}
.draggable {
    cursor: pointer;
}
.treeview-container {
    overflow-y: visible !important;
}
.hideBuildNo {
    color: #0467b3!important;
}
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
}
.blinking {
    animation:blinkingText 5s infinite;
}
@keyframes blinkingText{
    0%{     color: #000;    }
    49%{    color:  #EE7822; }
    50%{    color: transparent}
    99%{    color: #FF0000;  }
    100%{   color: #000;    }
}
.icon.lock-o.charcoal{
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg  viewBox%3D%222 2 20 20%22  xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath d%3D%22M13 16.732V18a1 1 0 0 1-2 0v-1.268a2 2 0 1 1 2 0zM18 9h-1V7c0-2.76-2.24-5-5-5S7 4.24 7 7v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V11c0-1.1-.9-2-2-2zM8.9 7c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9zM18 21H6V11h12z%22 fill%3D%22%23333333%22 fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E')
}

.dot {
  height: 25px;
  width: 25px;
  background-color: #bf2155;
  border-radius: 50%;
  display: inline-block;
  text-align: center;
  font-weight: bold;
}
.AffirmationAcc{
  padding-left: 38px;
}
.error_txt {
    color: red;
}
/* Global change for tux alert messages/ removing the head */
.alert .message_text h4{
    display: none !important;
  }

#divpopover4 popover-container {
    max-width: none !important;
}

.removeRowPadding {
    padding-right: 15px;
    padding-left: 15px;
    overflow-x: auto;
}
input:disabled, select:disabled, textarea:disabled {
    background: #f0f0f0 !important;
    color: #595959 !important;
}

.not-allowedCursor{
  cursor: not-allowed;
}

div.filter_options{
  display: none !important; /*this might remove tux-auto-complete's messages*/
}

.disable-background-opacity{
  position: fixed;
  top: 0;
  left: 0;
  background: whitesmoke;
  opacity: 0.4;
  z-index: 998;
  height: 100%;
  width: 100%;
}

.vh_container {
  position: absolute;
  top: 50%;
  margin-top: -200px;
  /* half of #content height*/
  left: 0;
  width: 100%;
}

a.disabled {
  color: gray;
  cursor: not-allowed;
}

home.scss

.home{
  color: black;
  font-size: 1rem;
}

.home p{
  color: #000;
}

.home-padding{
  padding: 10px 60px 10px 60px;
}

.home-heading{
  font-size: 2.25rem;
  font-weight: 200;
  border-bottom: 2px solid rgb(214,214,214);
  padding-bottom: 15px;
  color: black;
}

.ma-t20{
  margin-top: 20px;
}

.ma-t10{
  margin-top: 10px;
}

.ma-l10{
  margin-left: 10px;
}
.ma-r5{
  margin-right: 5px;
}

.ma-t100{
  margin-top: 100px;
}

.ma-10{
  margin-top: 10px;
  margin-left: 10px;
  margin-right: 10px;
  margin-bottom: 10px;
}

.ma-t30{
  margin-top: 30px;
}

.ma-t60{
  margin-top: 60px;
}

.ma-tm30{
  margin-top: -30px;
}

.ma-b20{
  margin-bottom: 20px;
}

.ma-b10{
  margin-bottom: 10px;
}

.ma-b40{
  margin-bottom: 40px;
}

.paraStrong{
  font-weight: bold;
}

.align.center{
  text-align: center;
}

.align.right{
  text-align: right;
}

.home-link{
  color: #0d91e4;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 200;
}

.home-link-disabled{
  color: #848484;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 200;
}

p.copy{
  color: #848484;
}

.notification-link{
  text-decoration: none;
  font-size: 2.25rem;
  font-weight: 200;
  padding-bottom: 15px;
  color: black;
}

.bottom-border{
  border-bottom: 2px solid rgb(214,214,214);
}

.tooltip{
  max-width: 400px;
}
.home-popover-link{
  color: #0d91e4;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 200;
}

a:hover   {
  text-decoration:  none;
  color: #0d91e4;
}

#notification ul li, #notification ol li{
  line-height: 1.75rem;
  padding-bottom: 1px;
}
#notification ul, #notification ol{
  margin: 10px 10px 10px 35px;
}

ul.a {
  list-style-type: square;
}

.detailsPopup .tooltip, .tooltip-inner {
  max-width: 100%;
}

.signin-padding{
  padding-top: 120px;
}

.input-width{
  width: 50%;
}

.card {
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
  transition: 0.3s;
}

.card:hover {
  box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.ma-b10{
  margin-bottom: 10px;
}

Any sort of help is appreciated,
Updated code snippets with only home.scss and app.scss


问:
yte indices must be integers or slices, not str
I'm experiencing some issues with web3 in Python.
The line : if tx['from'] not in ws['A']:
in this code:

```<code>for tx in transactions:
    if tx['from'] not in ws['A']:
        contract = w3.eth.contract(address=tx['to'], abi=CONTRACT_ABI)
        contract.functions.yourFunction().transact()

        ws.append([tx['from']])
</code>```

returns this error : byte indices must be integers or slices, not str

Now I know that the "from" variable is the issue, it needs an index number, 0, 1, 2 etc.
But my issues is how could I make sure that tx accesses the index number for the 'from' variable?

Sorry if the question is too vague, I'm a beginner in Python and I don't know exactly what to ask, thanks for reading.

Tried getting the value 'from' in tx in order to save it in an excel file.

Body:
I'm experiencing some issues with web3 in Python.
The line : if tx['from'] not in ws['A']:
in this code:

for tx in transactions:
    if tx['from'] not in ws['A']:
        contract = w3.eth.contract(address=tx['to'], abi=CONTRACT_ABI)
        contract.functions.yourFunction().transact()

        ws.append([tx['from']])

returns this error : byte indices must be integers or slices, not str

Now I know that the "from" variable is the issue, it needs an index number, 0, 1, 2 etc.
But my issues is how could I make sure that tx accesses the index number for the 'from' variable?

Sorry if the question is too vague, I'm a beginner in Python and I don't know exactly what to ask, thanks for reading.

Tried getting the value 'from' in tx in order to save it in an excel file.


问:
GO: How to share code between multiple apps in the same repository
I'm new to Golang. I have multiple apps residing in the same folder in a mono repository.

```<code>apps
   app1
      go.mod
      go.sum
      main.go
   app2
      go.mod
      go.sum
      main.go
   app3
      go.mod
      go.sum
      main.go
</code>```

There is also a go.work file in root directory that wraps these apps in a use block. The apps are AWS Lambda functions that are deployed independently.

How can I create a shared library that can be used by each app? I have some code that should be made reusable or else I'll end up copy-pasting everything. I've tried adding a shared.go file under apps with no luck.

Body:
I'm new to Golang. I have multiple apps residing in the same folder in a mono repository.

apps
   app1
      go.mod
      go.sum
      main.go
   app2
      go.mod
      go.sum
      main.go
   app3
      go.mod
      go.sum
      main.go

There is also a go.work file in root directory that wraps these apps in a use block. The apps are AWS Lambda functions that are deployed independently.

How can I create a shared library that can be used by each app? I have some code that should be made reusable or else I'll end up copy-pasting everything. I've tried adding a shared.go file under apps with no luck.


问:
Scipy root-finding with each dimension independent
Scipy.optimize.root enables you to minimize a vector function while Scipy.optimize.root_scalar enables you to minimize a scalar function. What I need to solve is somewhat in between. I have a bunch of complex functions f_i depending on index i and x_i, I want to solve f_1(x_1)=0,f_2(x_2)=0,...,f_n(x_n)=0. But instead of solving them using for loop, I want to solve in a vectorized style. The reason for that is because using for loop to query the value of f_1,...,f_n is expensive. But querying them in batch (f_1,...f_n) is relatively cheaper.

Let f=(f_1,...,f_n) and x=(x_1,...x_n). We want to solve f(x)=(f_1(x_1),f_2(x_2),...f_n(x_n))=0. By directly calling scipy.optimize.root is not ideal since the solver has no idea that each dimension is independent.

A toy example:

```<code>from scipy import optimize
import numpy as np
coef = np.arange(10)
def f(x):
    return x ** 2 + 2 * coef * x + coef ** 2
optimize.root(f, np.zeros(10))
</code>```

How can we let the solver know each dimension is independent to speed it up?

The above is just a toy example to illustrate my problem. In the real case, the function f is like a black box and there is no analytical derivative for each component f_1, f_2, ...f_n. So I couldn't just input a diagonal Jacobian to the solver. I tried to look at if we can let the solver know that Jacobian matrix should be diagonal but I have no luck towards this path. Any suggestions?

Body:
Scipy.optimize.root enables you to minimize a vector function while Scipy.optimize.root_scalar enables you to minimize a scalar function. What I need to solve is somewhat in between. I have a bunch of complex functions f_i depending on index i and x_i, I want to solve f_1(x_1)=0,f_2(x_2)=0,...,f_n(x_n)=0. But instead of solving them using for loop, I want to solve in a vectorized style. The reason for that is because using for loop to query the value of f_1,...,f_n is expensive. But querying them in batch (f_1,...f_n) is relatively cheaper.

Let f=(f_1,...,f_n) and x=(x_1,...x_n). We want to solve f(x)=(f_1(x_1),f_2(x_2),...f_n(x_n))=0. By directly calling scipy.optimize.root is not ideal since the solver has no idea that each dimension is independent.

A toy example:

from scipy import optimize
import numpy as np
coef = np.arange(10)
def f(x):
    return x ** 2 + 2 * coef * x + coef ** 2
optimize.root(f, np.zeros(10))

How can we let the solver know each dimension is independent to speed it up?

The above is just a toy example to illustrate my problem. In the real case, the function f is like a black box and there is no analytical derivative for each component f_1, f_2, ...f_n. So I couldn't just input a diagonal Jacobian to the solver. I tried to look at if we can let the solver know that Jacobian matrix should be diagonal but I have no luck towards this path. Any suggestions?


问:
-bash: xcaddy: command not found
I tried installing xcaddy with go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest. like stated at https://github.com/caddyserver/xcaddy

But it does not even work, I am getting the error below:

```<code>[root@vultrguest ~]# go install -x github.com/caddyserver/xcaddy/cmd/xcaddy@latest

# get https://proxy.golang.org/github.com/@v/list
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/xcaddy/@v/list
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/@v/list
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/@v/list
# get https://proxy.golang.org/github.com/caddyserver/@v/list
# get https://proxy.golang.org/github.com/@v/list: 404 Not Found (0.019s)
# get https://proxy.golang.org/github.com/caddyserver/@v/list: 404 Not Found (0.261s)
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/@v/list: 200 OK (0.297s)
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/@v/list: 404 Not Found (0.297s)
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/xcaddy/@v/list: 404 Not Found (0.324s)
WORK=/tmp/go-build2494567312
</code>```

I also tried other solutions found like https://github.com/caddyserver/xcaddy/issues/123 but still it does not solve my problem, xcaddy just wont install

I am pretty new to installing compiled binaries, and have totally no idea how to do it, can someone give a solution to the above issue? or give me an alternative solution for installing xcaddy?

Title: -bash: xcaddy: command not found

Body:
I tried installing xcaddy with go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest. like stated at https://github.com/caddyserver/xcaddy

But it does not even work, I am getting the error below:

[root@vultrguest ~]# go install -x github.com/caddyserver/xcaddy/cmd/xcaddy@latest

# get https://proxy.golang.org/github.com/@v/list
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/xcaddy/@v/list
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/@v/list
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/@v/list
# get https://proxy.golang.org/github.com/caddyserver/@v/list
# get https://proxy.golang.org/github.com/@v/list: 404 Not Found (0.019s)
# get https://proxy.golang.org/github.com/caddyserver/@v/list: 404 Not Found (0.261s)
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/@v/list: 200 OK (0.297s)
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/@v/list: 404 Not Found (0.297s)
# get https://proxy.golang.org/github.com/caddyserver/xcaddy/cmd/xcaddy/@v/list: 404 Not Found (0.324s)
WORK=/tmp/go-build2494567312

I also tried other solutions found like https://github.com/caddyserver/xcaddy/issues/123 but still it does not solve my problem, xcaddy just wont install

I am pretty new to installing compiled binaries, and have totally no idea how to do it, can someone give a solution to the above issue? or give me an alternative solution for installing xcaddy?


问:
Firebase Firestore db.collection is not a function what is the correct syntax and to get my code running right?
Firebase Initializing

User Context

create checkout logic

initializing Stripe

Is User Premium Member

User premium status

page where I'm trying to use onClick for Stripe checkout

Hi, I am trying to integrate Stripe to my NextJS application in React. I am getting the error "db.collection is not a function".

This is occurring on my createCheckoutSession.jsx file.

I have defined db in my Firebase folder at the root and exported it.

If anybody has any idea, it would be very appreciated it.

I have read the documentation and tried changing syntax to the best of my ability.


问:
Select All check Box not working ideally when we switch tabs where all the data is being rendered from nested json array in react
The below is the reponse data from api which I get

```<code>[
  {
    zip_file: [
      {zip: "a.zip"},
      {zip: "b.zip"},
      {zip: "c.zip"}
    ],
    text_files: [
      {text: "a.txt"},
      {text: "b.txt"},
      {text: "c.txt"}
    ],
    pdf_files: [
      {pdf: "a.pdf"},
      {pdf: "b.pdf"},
      {pdf: "c.pdf"},
    ]
  }
];
</code>```

I am trying to create dynamic tabs from json data where each key name will be name of tab(i,e zip_file,text_file,pdf_file) and key's array object will be body of tab as list of check boxes (i,e for zip file it will have ☑ a.zip , ☑ b.zip, ☑ c.zip)and have select all checkbox( ☑ Select All) for every tab where it should select only list of that particular tab(i,e in zip tab select All should select all the three entries).

Issue that I am facing now is when I click on select all option, all the list items are being fetched and value is stored in an array but only the last element of the list is being checked(i,e it has ☑ mark) and not the rest others(i.e ☐)

second issue is when I click on select All option in one tab and switch to next tab ,that tab's select All check Box is also selected (which I don't want ,it should be independent for each tabs)

Below is the Code snippet

```<code>import { useEffect, useState } from "react";
import Tab from "./Tab";import "bootstrap/dist/css/bootstrap.css";
import Download from "./Download";

const SimpleTab = () => {
  const [data, setData] = useState([]);
  const [file, setFile] = useState([]);
  const [checked, setChecked] = useState([]);

  useEffect(() => {
    const fetchData = async () => {
      const response = await fetch(`http://localhost:9080/...........`);
      const responseData = await response.json();
      setData(responseData);
    };
  });

  // This is to add or remove checked value into an array
  const addOrRemove = (name) => {
    const index = file.indexOf(name);
    if (index === -1) {
      file.push(name);
    } else {
      file.splice(index, 1);
    }

    setFile(file);
  };

  //To retain the state of checked on change
  const handleChange = (e, name) => {
    setChecked({
      ...checked,
      [name]: e.target.checked,
    });
    console.log("checked " + checked);
  };

  return (
    <>
      <Header />
      <Download arraylink={file} />
      <Tab>
        {data.map((tab, id) =>
          Object.entries(tab).map(([key, value]) => (
            <Tab.TabPane key={`Tab-${key}`} tab={key} className="tabs">
              <input
                type="checkbox"
                onChange={(e) => {
                  value.map((tab1, idx) =>
                    Object.entries(tab1).map(([key1, value1]) =>
                      addOrRemove(value1)
                    )
                  );

                  value.map((tab1, idx) =>
                    Object.entries(tab1).map(([key1, value1]) =>
                      handleChange(e, value1)
                    )
                  );
                }}

                //checked={checked[value1] || ""}
              ></input>

              {value.map((tab1, idx) =>
                Object.entries(tab1).map(([key1, value1]) => (
                  <table className="table table-bordered">
                    <tbody>
                      <tr key={value1}>
                        <th scope="row">
                          <input
                            type="checkbox"
                            onChange={(e) => {
                              addOrRemove(value1);
                              handleChange(e, value1);
                            }}
                            checked={checked[value1] || ""}
                          ></input>
                        </th>
                        <td>{value1}</td>
                      </tr>
                    </tbody>
                  </table>
                ))
              )}
            </Tab.TabPane>
          ))
        )}
      </Tab>

    </>
  );
};

export default SimpleTab;

</code>```

I'm new to react, if someone can please help me figure out what's wrong in my code or even suggest any other approach it would be great.
Thank you in Advance.

Body:
The below is the reponse data from api which I get

[
  {
    zip_file: [
      {zip: "a.zip"},
      {zip: "b.zip"},
      {zip: "c.zip"}
    ],
    text_files: [
      {text: "a.txt"},
      {text: "b.txt"},
      {text: "c.txt"}
    ],
    pdf_files: [
      {pdf: "a.pdf"},
      {pdf: "b.pdf"},
      {pdf: "c.pdf"},
    ]
  }
];

I am trying to create dynamic tabs from json data where each key name will be name of tab(i,e zip_file,text_file,pdf_file) and key's array object will be body of tab as list of check boxes (i,e for zip file it will have ☑ a.zip , ☑ b.zip, ☑ c.zip)and have select all checkbox( ☑ Select All) for every tab where it should select only list of that particular tab(i,e in zip tab select All should select all the three entries).

Issue that I am facing now is when I click on select all option, all the list items are being fetched and value is stored in an array but only the last element of the list is being checked(i,e it has ☑ mark) and not the rest others(i.e ☐)

second issue is when I click on select All option in one tab and switch to next tab ,that tab's select All check Box is also selected (which I don't want ,it should be independent for each tabs)

Below is the Code snippet

import { useEffect, useState } from "react";
import Tab from "./Tab";import "bootstrap/dist/css/bootstrap.css";
import Download from "./Download";

const SimpleTab = () => {
  const [data, setData] = useState([]);
  const [file, setFile] = useState([]);
  const [checked, setChecked] = useState([]);

  useEffect(() => {
    const fetchData = async () => {
      const response = await fetch(`http://localhost:9080/...........`);
      const responseData = await response.json();
      setData(responseData);
    };
  });

  // This is to add or remove checked value into an array
  const addOrRemove = (name) => {
    const index = file.indexOf(name);
    if (index === -1) {
      file.push(name);
    } else {
      file.splice(index, 1);
    }

    setFile(file);
  };

  //To retain the state of checked on change
  const handleChange = (e, name) => {
    setChecked({
      ...checked,
      [name]: e.target.checked,
    });
    console.log("checked " + checked);
  };

  return (
    <>

      <Download arraylink={file} />
      <Tab>
        {data.map((tab, id) =>
          Object.entries(tab).map(([key, value]) => (
            <Tab.TabPane key={`Tab-${key}`} tab={key} className="tabs">
              <input
                type="checkbox"
                onChange={(e) => {
                  value.map((tab1, idx) =>
                    Object.entries(tab1).map(([key1, value1]) =>
                      addOrRemove(value1)
                    )
                  );

                  value.map((tab1, idx) =>
                    Object.entries(tab1).map(([key1, value1]) =>
                      handleChange(e, value1)
                    )
                  );
                }}

                //checked={checked[value1] || ""}
              ></input>

              {value.map((tab1, idx) =>
                Object.entries(tab1).map(([key1, value1]) => (

                          <input
                            type="checkbox"
                            onChange={(e) => {
                              addOrRemove(value1);
                              handleChange(e, value1);
                            }}
                            checked={checked[value1] || ""}
                          ></input>

                        {value1}

                ))
              )}
            </Tab.TabPane>
          ))
        )}
      </Tab>

    </>
  );
};

export default SimpleTab;

I'm new to react, if someone can please help me figure out what's wrong in my code or even suggest any other approach it would be great.
Thank you in Advance.


问:
I want to start service using motion sensor
I want the service to start running in background when there is any motion deducted by the android and stop the service when there is no movement. I am not sure how to do that. Any help would be really appreciated</p>


问:
(ReactJS Slider) Move handle directly where the user taps then able to drag slider from there
I'm currently using a slider from ANT Design (https://ant.design/components/slider). The problem I'm having is the only way to move the handle is by holding onto the thumb then dragging it. But if the user taps then hold to drag in a different section of the slider, it won't move directly to that position. To drag the slider, I would have to hold it by the thumb handle then drag it. I want to be able to just “start dragging” on any position on the slider, not just the currently selected spot.

This codepen is what I'm hoping to achieve with the Antd Slider (https://codepen.io/kn2k/pen/qBKLLWW)

Thanks!

I have tried some different props from Antd Slider website but nothing seems to be working.


问:
Does Material UI expose state class names?
I know that Material UI 5 exposes class names for each of their components.

For example:

import { autocompleteClasses } from '@mui/material/Autocomplete';
console.log(autocompleteClasses.input)
> MuiAutocomplete-input
```

Does Material UI 5 also expose constants for classes such as Mui-focused, Mui-disabled, etc?

Body:
I know that Material UI 5 exposes class names for each of their components.

For example:

import { autocompleteClasses } from '@mui/material/Autocomplete';
console.log(autocompleteClasses.input)
> MuiAutocomplete-input

Does Material UI 5 also expose constants for classes such as Mui-focused, Mui-disabled, etc?


问:
how to run a program in spark using spark-submit in cluster mode?
I am using spark-class org.apache.spark.deploy.master.Master to run master in cmd & also to get ip and port no. To start worker spark-class org.apache.spark.deploy.worker.Worker spark:////10.1.0.4:7077 . And at last submitting the code in jar to run :
spark-submit --class pack1.Maintest --master spark://10.1.0.4:7077 --deploy-mode cluster sampl1/target/sampl1-0.0.1-SNAPSHOT.jar

```<code>C:\Users\testuser>spark-submit --class pack1.Maintest --master spark://10.1.0.4:7077 --deploy-mode cluster sampl1/target/sampl1-0.0.1-SNAPSHOT.jar
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
22/12/06 11:23:46 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:46 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:46 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:46 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:46 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:47 INFO Utils: Successfully started service 'driverClient' on port 62255.
22/12/06 11:23:47 INFO TransportClientFactory: Successfully created connection to /10.1.0.4:7077 after 66 ms (0 ms spent in bootstraps)
22/12/06 11:23:48 INFO ClientEndpoint: Driver successfully submitted as driver-20221206112347-0000
22/12/06 11:23:48 INFO ClientEndpoint: ... waiting before polling master for driver state
22/12/06 11:23:53 INFO ClientEndpoint: ... polling master for driver state
22/12/06 11:23:53 INFO ClientEndpoint: State of driver-20221206112347-0000 is RUNNING
22/12/06 11:23:53 INFO ClientEndpoint: Driver running on 10.1.0.4:62236 (worker-20221206112316-10.1.0.4-62236)
22/12/06 11:23:53 INFO ShutdownHookManager: Shutdown hook called
22/12/06 11:23:53 INFO ShutdownHookManager: Deleting directory C:\Users\testuser\AppData\Local\Temp\spark-7670452e-76c6-4521-abf3-f8b0781d1f86
</code>```

master's window:

```<code>C:\Users\testuser>spark-class org.apache.spark.deploy.master.Master
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
22/12/06 11:23:04 INFO Master: Started daemon with process name: 1804@OneSenseVM
22/12/06 11:23:05 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:05 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:05 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:05 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:05 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:06 INFO Utils: Successfully started service 'sparkMaster' on port 7077.
22/12/06 11:23:06 INFO Master: Starting Spark master at spark://10.1.0.4:7077
22/12/06 11:23:07 INFO Master: Running Spark version 3.0.3
22/12/06 11:23:07 INFO Utils: Successfully started service 'MasterUI' on port 8080.
22/12/06 11:23:07 INFO MasterWebUI: Bound MasterWebUI to 0.0.0.0, and started at http://OneSenseVM.lyzeektkov4u1gxcr5vunwkbjh.px.internal.cloudapp.net:8080
22/12/06 11:23:07 INFO Master: I have been elected leader! New state: ALIVE
22/12/06 11:23:18 INFO Master: Registering worker 10.1.0.4:62236 with 2 cores, 3.0 GiB RAM
22/12/06 11:23:47 INFO Master: Driver submitted org.apache.spark.deploy.worker.DriverWrapper
22/12/06 11:23:48 INFO Master: Launching driver driver-20221206112347-0000 on worker worker-20221206112316-10.1.0.4-62236
22/12/06 11:23:53 WARN TransportChannelHandler: Exception in connection from /10.1.0.4:62256
java.io.IOException: An existing connection was forcibly closed by the remote host
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:378)
        at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:750)
22/12/06 11:23:53 INFO Master: 10.1.0.4:62256 got disassociated, removing it.
22/12/06 11:23:53 INFO Master: 10.1.0.4:62255 got disassociated, removing it.
22/12/06 11:23:55 INFO Master: Registering app SparkSQL
22/12/06 11:23:55 INFO Master: Registered app SparkSQL with ID app-20221206112355-0000
22/12/06 11:23:55 INFO Master: Launching executor app-20221206112355-0000/0 on worker worker-20221206112316-10.1.0.4-62236
</code>```

worker's window:

```<code>C:\Users\testuser>spark-class org.apache.spark.deploy.worker.Worker spark://10.1.0.4:7077
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
22/12/06 11:23:14 INFO Worker: Started daemon with process name: 8492@OneSenseVM
22/12/06 11:23:15 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:15 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:15 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:15 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:15 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:16 INFO Utils: Successfully started service 'sparkWorker' on port 62236.
22/12/06 11:23:16 INFO Worker: Starting Spark worker 10.1.0.4:62236 with 2 cores, 3.0 GiB RAM
22/12/06 11:23:16 INFO Worker: Running Spark version 3.0.3
22/12/06 11:23:16 INFO Worker: Spark home: C:\SPARK\spark-3.0.3-bin-hadoop2.7
22/12/06 11:23:16 INFO ResourceUtils: ==============================================================
22/12/06 11:23:16 INFO ResourceUtils: Resources for spark.worker:

22/12/06 11:23:16 INFO ResourceUtils: ==============================================================
22/12/06 11:23:17 INFO Utils: Successfully started service 'WorkerUI' on port 8081.
22/12/06 11:23:17 INFO WorkerWebUI: Bound WorkerWebUI to 0.0.0.0, and started at http://OneSenseVM.lyzeektkov4u1gxcr5vunwkbjh.px.internal.cloudapp.net:8081
22/12/06 11:23:17 INFO Worker: Connecting to master 10.1.0.4:7077...
22/12/06 11:23:17 INFO TransportClientFactory: Successfully created connection to /10.1.0.4:7077 after 210 ms (0 ms spent in bootstraps)
22/12/06 11:23:18 INFO Worker: Successfully registered with master spark://10.1.0.4:7077
22/12/06 11:23:48 INFO Worker: Asked to launch driver driver-20221206112347-0000
22/12/06 11:23:48 INFO DriverRunner: Copying user jar file:/C:/Users/testuser/sampl1/target/sampl1-0.0.1-SNAPSHOT.jar to C:\SPARK\spark-3.0.3-bin-hadoop2.7\work\driver-20221206112347-0000\sampl1-0.0.1-SNAPSHOT.jar
22/12/06 11:23:48 INFO Utils: Copying C:\Users\testuser\sampl1\target\sampl1-0.0.1-SNAPSHOT.jar to C:\SPARK\spark-3.0.3-bin-hadoop2.7\work\driver-20221206112347-0000\sampl1-0.0.1-SNAPSHOT.jar
22/12/06 11:23:48 INFO DriverRunner: Launch Command: "C:\Program Files\Java\jdk1.8.0_341\bin\java" "-cp" "C:\SPARK\spark-3.0.3-bin-hadoop2.7\bin\..\conf\;C:\SPARK\spark-3.0.3-bin-hadoop2.7\jars\*" "-Xmx1024M" "-Dspark.master=spark://10.1.0.4:7077" "-Dspark.app.name=pack1.Maintest" "-Dspark.driver.supervise=false" "-Dspark.submit.deployMode=cluster" "-Dspark.submit.pyFiles=" "-Dspark.jars=file:/C:/Users/testuser/sampl1/target/sampl1-0.0.1-SNAPSHOT.jar" "-Dspark.rpc.askTimeout=10s" "org.apache.spark.deploy.worker.DriverWrapper" "spark://Worker@10.1.0.4:62236" "C:\SPARK\spark-3.0.3-bin-hadoop2.7\work\driver-20221206112347-0000\sampl1-0.0.1-SNAPSHOT.jar" "pack1.Maintest"
22/12/06 11:23:55 INFO Worker: Asked to launch executor app-20221206112355-0000/0 for SparkSQL
22/12/06 11:23:55 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:55 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:55 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:55 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:55 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:55 INFO ExecutorRunner: Launch command: "C:\Program Files\Java\jdk1.8.0_341\bin\java" "-cp" "C:\SPARK\spark-3.0.3-bin-hadoop2.7\bin\..\conf\;C:\SPARK\spark-3.0.3-bin-hadoop2.7\jars\*" "-Xmx1024M" "-Dspark.driver.port=62279" "-Dspark.rpc.askTimeout=10s" "org.apache.spark.executor.CoarseGrainedExecutorBackend" "--driver-url" "spark://CoarseGrainedScheduler@OneSenseVM.lyzeektkov4u1gxcr5vunwkbjh.px.internal.cloudapp.net:62279" "--executor-id" "0" "--hostname" "10.1.0.4" "--cores" "1" "--app-id" "app-20221206112355-0000" "--worker-url" "spark://Worker@10.1.0.4:62236"
</code>```

i don't know the reason why shutdown hook is called and how to solve it?

i want to run the code in my jar using cluster mode in spark.....the code is working if directly written in cmd

Body:
I am using spark-class org.apache.spark.deploy.master.Master to run master in cmd & also to get ip and port no. To start worker spark-class org.apache.spark.deploy.worker.Worker spark:////10.1.0.4:7077 . And at last submitting the code in jar to run :
spark-submit --class pack1.Maintest --master spark://10.1.0.4:7077 --deploy-mode cluster sampl1/target/sampl1-0.0.1-SNAPSHOT.jar

C:\Users\testuser>spark-submit --class pack1.Maintest --master spark://10.1.0.4:7077 --deploy-mode cluster sampl1/target/sampl1-0.0.1-SNAPSHOT.jar
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
22/12/06 11:23:46 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:46 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:46 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:46 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:46 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:47 INFO Utils: Successfully started service 'driverClient' on port 62255.
22/12/06 11:23:47 INFO TransportClientFactory: Successfully created connection to /10.1.0.4:7077 after 66 ms (0 ms spent in bootstraps)
22/12/06 11:23:48 INFO ClientEndpoint: Driver successfully submitted as driver-20221206112347-0000
22/12/06 11:23:48 INFO ClientEndpoint: ... waiting before polling master for driver state
22/12/06 11:23:53 INFO ClientEndpoint: ... polling master for driver state
22/12/06 11:23:53 INFO ClientEndpoint: State of driver-20221206112347-0000 is RUNNING
22/12/06 11:23:53 INFO ClientEndpoint: Driver running on 10.1.0.4:62236 (worker-20221206112316-10.1.0.4-62236)
22/12/06 11:23:53 INFO ShutdownHookManager: Shutdown hook called
22/12/06 11:23:53 INFO ShutdownHookManager: Deleting directory C:\Users\testuser\AppData\Local\Temp\spark-7670452e-76c6-4521-abf3-f8b0781d1f86

master's window:

C:\Users\testuser>spark-class org.apache.spark.deploy.master.Master
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
22/12/06 11:23:04 INFO Master: Started daemon with process name: 1804@OneSenseVM
22/12/06 11:23:05 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:05 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:05 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:05 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:05 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:06 INFO Utils: Successfully started service 'sparkMaster' on port 7077.
22/12/06 11:23:06 INFO Master: Starting Spark master at spark://10.1.0.4:7077
22/12/06 11:23:07 INFO Master: Running Spark version 3.0.3
22/12/06 11:23:07 INFO Utils: Successfully started service 'MasterUI' on port 8080.
22/12/06 11:23:07 INFO MasterWebUI: Bound MasterWebUI to 0.0.0.0, and started at http://OneSenseVM.lyzeektkov4u1gxcr5vunwkbjh.px.internal.cloudapp.net:8080
22/12/06 11:23:07 INFO Master: I have been elected leader! New state: ALIVE
22/12/06 11:23:18 INFO Master: Registering worker 10.1.0.4:62236 with 2 cores, 3.0 GiB RAM
22/12/06 11:23:47 INFO Master: Driver submitted org.apache.spark.deploy.worker.DriverWrapper
22/12/06 11:23:48 INFO Master: Launching driver driver-20221206112347-0000 on worker worker-20221206112316-10.1.0.4-62236
22/12/06 11:23:53 WARN TransportChannelHandler: Exception in connection from /10.1.0.4:62256
java.io.IOException: An existing connection was forcibly closed by the remote host
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:378)
        at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:750)
22/12/06 11:23:53 INFO Master: 10.1.0.4:62256 got disassociated, removing it.
22/12/06 11:23:53 INFO Master: 10.1.0.4:62255 got disassociated, removing it.
22/12/06 11:23:55 INFO Master: Registering app SparkSQL
22/12/06 11:23:55 INFO Master: Registered app SparkSQL with ID app-20221206112355-0000
22/12/06 11:23:55 INFO Master: Launching executor app-20221206112355-0000/0 on worker worker-20221206112316-10.1.0.4-62236

worker's window:

C:\Users\testuser>spark-class org.apache.spark.deploy.worker.Worker spark://10.1.0.4:7077
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
22/12/06 11:23:14 INFO Worker: Started daemon with process name: 8492@OneSenseVM
22/12/06 11:23:15 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:15 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:15 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:15 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:15 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:16 INFO Utils: Successfully started service 'sparkWorker' on port 62236.
22/12/06 11:23:16 INFO Worker: Starting Spark worker 10.1.0.4:62236 with 2 cores, 3.0 GiB RAM
22/12/06 11:23:16 INFO Worker: Running Spark version 3.0.3
22/12/06 11:23:16 INFO Worker: Spark home: C:\SPARK\spark-3.0.3-bin-hadoop2.7
22/12/06 11:23:16 INFO ResourceUtils: ==============================================================
22/12/06 11:23:16 INFO ResourceUtils: Resources for spark.worker:

22/12/06 11:23:16 INFO ResourceUtils: ==============================================================
22/12/06 11:23:17 INFO Utils: Successfully started service 'WorkerUI' on port 8081.
22/12/06 11:23:17 INFO WorkerWebUI: Bound WorkerWebUI to 0.0.0.0, and started at http://OneSenseVM.lyzeektkov4u1gxcr5vunwkbjh.px.internal.cloudapp.net:8081
22/12/06 11:23:17 INFO Worker: Connecting to master 10.1.0.4:7077...
22/12/06 11:23:17 INFO TransportClientFactory: Successfully created connection to /10.1.0.4:7077 after 210 ms (0 ms spent in bootstraps)
22/12/06 11:23:18 INFO Worker: Successfully registered with master spark://10.1.0.4:7077
22/12/06 11:23:48 INFO Worker: Asked to launch driver driver-20221206112347-0000
22/12/06 11:23:48 INFO DriverRunner: Copying user jar file:/C:/Users/testuser/sampl1/target/sampl1-0.0.1-SNAPSHOT.jar to C:\SPARK\spark-3.0.3-bin-hadoop2.7\work\driver-20221206112347-0000\sampl1-0.0.1-SNAPSHOT.jar
22/12/06 11:23:48 INFO Utils: Copying C:\Users\testuser\sampl1\target\sampl1-0.0.1-SNAPSHOT.jar to C:\SPARK\spark-3.0.3-bin-hadoop2.7\work\driver-20221206112347-0000\sampl1-0.0.1-SNAPSHOT.jar
22/12/06 11:23:48 INFO DriverRunner: Launch Command: "C:\Program Files\Java\jdk1.8.0_341\bin\java" "-cp" "C:\SPARK\spark-3.0.3-bin-hadoop2.7\bin\..\conf\;C:\SPARK\spark-3.0.3-bin-hadoop2.7\jars\*" "-Xmx1024M" "-Dspark.master=spark://10.1.0.4:7077" "-Dspark.app.name=pack1.Maintest" "-Dspark.driver.supervise=false" "-Dspark.submit.deployMode=cluster" "-Dspark.submit.pyFiles=" "-Dspark.jars=file:/C:/Users/testuser/sampl1/target/sampl1-0.0.1-SNAPSHOT.jar" "-Dspark.rpc.askTimeout=10s" "org.apache.spark.deploy.worker.DriverWrapper" "spark://Worker@10.1.0.4:62236" "C:\SPARK\spark-3.0.3-bin-hadoop2.7\work\driver-20221206112347-0000\sampl1-0.0.1-SNAPSHOT.jar" "pack1.Maintest"
22/12/06 11:23:55 INFO Worker: Asked to launch executor app-20221206112355-0000/0 for SparkSQL
22/12/06 11:23:55 INFO SecurityManager: Changing view acls to: testuser
22/12/06 11:23:55 INFO SecurityManager: Changing modify acls to: testuser
22/12/06 11:23:55 INFO SecurityManager: Changing view acls groups to:
22/12/06 11:23:55 INFO SecurityManager: Changing modify acls groups to:
22/12/06 11:23:55 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users  with view permissions: Set(testuser); groups with view permissions: Set(); users  with modify permissions: Set(testuser); groups with modify permissions: Set()
22/12/06 11:23:55 INFO ExecutorRunner: Launch command: "C:\Program Files\Java\jdk1.8.0_341\bin\java" "-cp" "C:\SPARK\spark-3.0.3-bin-hadoop2.7\bin\..\conf\;C:\SPARK\spark-3.0.3-bin-hadoop2.7\jars\*" "-Xmx1024M" "-Dspark.driver.port=62279" "-Dspark.rpc.askTimeout=10s" "org.apache.spark.executor.CoarseGrainedExecutorBackend" "--driver-url" "spark://CoarseGrainedScheduler@OneSenseVM.lyzeektkov4u1gxcr5vunwkbjh.px.internal.cloudapp.net:62279" "--executor-id" "0" "--hostname" "10.1.0.4" "--cores" "1" "--app-id" "app-20221206112355-0000" "--worker-url" "spark://Worker@10.1.0.4:62236"

i don't know the reason why shutdown hook is called and how to solve it?

i want to run the code in my jar using cluster mode in spark.....the code is working if directly written in cmd


问:
Facing ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted']
I'm a beginner of NLP using pytorch and transformers.

Now I'm studying with huggingface transformer course(link : https://huggingface.co/course/chapter3/4?fw=pt)

When I used jupyter notebook with GPU V100, It worked well.
However, when I tried to test with my M1 macbook with 'mps', training was done with little bit slowly. The problem is, in metric.compute() as I guess.

The notebook displayed the error output like the below.

```<code>ValueError                                Traceback (most recent call last)
Cell In [6], line 15
     12     metric.add_batch(predictions=predictions, references=batch["labels"])
---> 15 metric.compute()

File ~/miniforge3/lib/python3.9/site-packages/datasets/metric.py:453, in Metric.compute(self, predictions, references, **kwargs)
    451 inputs = {input_name: self.data[input_name] for input_name in self.features}
    452 with temp_seed(self.seed):
--> 453     output = self._compute(**inputs, **compute_kwargs)
    455 if self.buf_writer is not None:
    456     self.buf_writer = None

File ~/.cache/huggingface/modules/datasets_modules/metrics/glue/91f3cfc5498873918ecf119dbf806fb10815786c84f41b85a5d3c47c1519b343/glue.py:147, in Glue._compute(self, predictions, references)
    145     return pearson_and_spearman(predictions, references)
    146 elif self.config_name in ["mrpc", "qqp"]:
--> 147     return acc_and_f1(predictions, references)
    148 elif self.config_name in ["sst2", "mnli", "mnli_mismatched", "mnli_matched", "qnli", "rte", "wnli", "hans"]:
    149     return {"accuracy": simple_accuracy(predictions, references)}

File ~/.cache/huggingface/modules/datasets_modules/metrics/glue/91f3cfc5498873918ecf119dbf806fb10815786c84f41b85a5d3c47c1519b343/glue.py:88, in acc_and_f1(preds, labels)
     86 def acc_and_f1(preds, labels):
     87     acc = simple_accuracy(preds, labels)
---> 88     f1 = float(f1_score(y_true=labels, y_pred=preds))
...
   (...)
   1375         UserWarning,
   1376     )

ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'].
</code>```

I'm not sure why the error was occured, because It worked well in the jupyter notebook with GPU V100.

Thanks for reading.

Here's my whole source code.

```<code>from datasets import load_dataset, load_metric
from transformers import AutoTokenizer, DataCollatorWithPadding, AutoModelForSequenceClassification, AdamW, get_scheduler

import torch
from torch.utils.data import DataLoader

from tqdm.auto import tqdm

raw_datasets = load_dataset("glue", "mrpc")
checkpoint = "bert-base-uncased"

tokenizer = AutoTokenizer.from_pretrained(checkpoint)

def tokenize_function(example):
    return tokenizer(example["sentence1"], example["sentence2"], truncation=True)

tokenized_datasets = raw_datasets.map(tokenize_function, batched=True)

data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

tokenized_datasets = tokenized_datasets.remove_columns(["sentence1", "sentence2", "idx"])
tokenized_datasets = tokenized_datasets.rename_column("label","labels")
tokenized_datasets.set_format("torch")

print(tokenized_datasets["train"].column_names)
train_dataloader = DataLoader(tokenized_datasets["train"],
                              shuffle=True,
                              batch_size=8,
                              collate_fn=data_collator)
eval_dataloader = DataLoader(tokenized_datasets["validation"],
                             shuffle=True,
                             batch_size=8,
                             collate_fn=data_collator)

model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
optimizer = AdamW(model.parameters(), lr=5e-5)

num_epochs = 3
num_training_steps = num_epochs * len(train_dataloader)
lr_scheduler = get_scheduler("linear", optimizer=optimizer, num_warmup_steps=0,
                             num_training_steps=num_training_steps)

#device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
device = torch.device("mps") if torch.backends.mps.is_available() else torch.device("cpu")
model.to(device)

progress_bar = tqdm(range(num_training_steps))

model.train()
for epoch in range(num_epochs):
    for batch in train_dataloader:
        batch = {k: v.to(device) for k, v in batch.items()}
        outputs = model(**batch)
        loss = outputs.loss
        loss.backward()

        optimizer.step()
        lr_scheduler.step()
        optimizer.zero_grad()
        progress_bar.update(1)

metric = load_metric("glue", "mrpc")
model.eval()
for batch in eval_dataloader:
    batch = {k: v.to(device) for k, v in batch.items()}
    with torch.no_grad():
        outputs = model(**batch)

    logits = outputs.logits
    predictions = torch.argmax(logits, dim=-1)
    metric.add_batch(predictions=predictions, references=batch["labels"])

metric.compute()
</code>```

I tried to insert the code separately, then find the problem point.
I'll also try to do in Google Colab environment.

Body:
I'm a beginner of NLP using pytorch and transformers.

Now I'm studying with huggingface transformer course(link : https://huggingface.co/course/chapter3/4?fw=pt)

When I used jupyter notebook with GPU V100, It worked well.
However, when I tried to test with my M1 macbook with 'mps', training was done with little bit slowly. The problem is, in metric.compute() as I guess.

The notebook displayed the error output like the below.

ValueError                                Traceback (most recent call last)
Cell In [6], line 15
     12     metric.add_batch(predictions=predictions, references=batch["labels"])
---> 15 metric.compute()

File ~/miniforge3/lib/python3.9/site-packages/datasets/metric.py:453, in Metric.compute(self, predictions, references, **kwargs)
    451 inputs = {input_name: self.data[input_name] for input_name in self.features}
    452 with temp_seed(self.seed):
--> 453     output = self._compute(**inputs, **compute_kwargs)
    455 if self.buf_writer is not None:
    456     self.buf_writer = None

File ~/.cache/huggingface/modules/datasets_modules/metrics/glue/91f3cfc5498873918ecf119dbf806fb10815786c84f41b85a5d3c47c1519b343/glue.py:147, in Glue._compute(self, predictions, references)
    145     return pearson_and_spearman(predictions, references)
    146 elif self.config_name in ["mrpc", "qqp"]:
--> 147     return acc_and_f1(predictions, references)
    148 elif self.config_name in ["sst2", "mnli", "mnli_mismatched", "mnli_matched", "qnli", "rte", "wnli", "hans"]:
    149     return {"accuracy": simple_accuracy(predictions, references)}

File ~/.cache/huggingface/modules/datasets_modules/metrics/glue/91f3cfc5498873918ecf119dbf806fb10815786c84f41b85a5d3c47c1519b343/glue.py:88, in acc_and_f1(preds, labels)
     86 def acc_and_f1(preds, labels):
     87     acc = simple_accuracy(preds, labels)
---> 88     f1 = float(f1_score(y_true=labels, y_pred=preds))
...
   (...)
   1375         UserWarning,
   1376     )

ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'].

I'm not sure why the error was occured, because It worked well in the jupyter notebook with GPU V100.

Thanks for reading.

Here's my whole source code.

from datasets import load_dataset, load_metric
from transformers import AutoTokenizer, DataCollatorWithPadding, AutoModelForSequenceClassification, AdamW, get_scheduler

import torch
from torch.utils.data import DataLoader

from tqdm.auto import tqdm

raw_datasets = load_dataset("glue", "mrpc")
checkpoint = "bert-base-uncased"

tokenizer = AutoTokenizer.from_pretrained(checkpoint)

def tokenize_function(example):
    return tokenizer(example["sentence1"], example["sentence2"], truncation=True)

tokenized_datasets = raw_datasets.map(tokenize_function, batched=True)

data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

tokenized_datasets = tokenized_datasets.remove_columns(["sentence1", "sentence2", "idx"])
tokenized_datasets = tokenized_datasets.rename_column("label","labels")
tokenized_datasets.set_format("torch")

print(tokenized_datasets["train"].column_names)
train_dataloader = DataLoader(tokenized_datasets["train"],
                              shuffle=True,
                              batch_size=8,
                              collate_fn=data_collator)
eval_dataloader = DataLoader(tokenized_datasets["validation"],
                             shuffle=True,
                             batch_size=8,
                             collate_fn=data_collator)

model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
optimizer = AdamW(model.parameters(), lr=5e-5)

num_epochs = 3
num_training_steps = num_epochs * len(train_dataloader)
lr_scheduler = get_scheduler("linear", optimizer=optimizer, num_warmup_steps=0,
                             num_training_steps=num_training_steps)

#device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
device = torch.device("mps") if torch.backends.mps.is_available() else torch.device("cpu")
model.to(device)

progress_bar = tqdm(range(num_training_steps))

model.train()
for epoch in range(num_epochs):
    for batch in train_dataloader:
        batch = {k: v.to(device) for k, v in batch.items()}
        outputs = model(**batch)
        loss = outputs.loss
        loss.backward()

        optimizer.step()
        lr_scheduler.step()
        optimizer.zero_grad()
        progress_bar.update(1)

metric = load_metric("glue", "mrpc")
model.eval()
for batch in eval_dataloader:
    batch = {k: v.to(device) for k, v in batch.items()}
    with torch.no_grad():
        outputs = model(**batch)

    logits = outputs.logits
    predictions = torch.argmax(logits, dim=-1)
    metric.add_batch(predictions=predictions, references=batch["labels"])

metric.compute()

I tried to insert the code separately, then find the problem point.
I'll also try to do in Google Colab environment.