CoolFace
Modelpublic

Collab-uniba/fprime-binary-setfit

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes4downloads
Model Card

SetFit

This is a SetFit model that can be used for Text Classification. A LogisticRegression instance is used for classification.

The model has been trained using an efficient few-shot learning technique that involves:

  1. 1.Fine-tuning a Sentence Transformer with contrastive learning.
  2. 2.Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

  • Model Type: SetFit <!-- - Sentence Transformer: Unknown -->
  • Classification head: a LogisticRegression instance
  • Maximum Sequence Length: 384 tokens
  • Number of Classes: 2 classes <!-- - Training Dataset: Unknown --> <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Model Labels

LabelExamples
bug<ul><li>"A global-buffer-overflow error in BufferQueueTest.cpp line 126\n\r\n:---:---\r\n_F´ Version_1.5\r\n_Affected Component_Os/Pthreads\r\n---\r\n## Problem Description\r\n\r\nA global-buffer-overflow error in BufferQueueTest.cpp line 126\r\n\r\n``\r\nzyh@virtual:~/fprime$ ./build-fprime-automatic-native-ut/bin/Linux/Os_pthreads\r\nCreating queue.\r\nTest empty queue...\r\nPassed.\r\nTest full queue...\r\nPushing 0.\r\nPushing 1.\r\nPushing 2.\r\nPushing 3.\r\nPushing 4.\r\nPassed.\r\nTest weird size...\r\nPassed.\r\nTest pop...\r\nPopping 5.\r\nPopping 4.\r\nPopping 3.\r\nPopping 2.\r\nPopping 1.\r\nPassed.\r\nTest priorities...\r\nPushing 'hello' at priority 9.\r\nPushing 'how are you' at priority 4.\r\nPushing 'pretty good' at priority 100.\r\nPushing 'cosmic bro' at priority 4.\r\nPushing 'kthxbye' at priority 9.\r\nPopped 'pretty good' at priority 100. Expected 'pretty good' at priority 100.\r\nPopped 'hello' at priority 9. Expected 'hello' at priority 9.\r\n=================================================================\r\n==17078==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000550bc6 at pc 0x0000004b3f6b bp 0x7ffd804c4c90 sp 0x7ffd804c4440\r\nREAD of size 8 at 0x000000550bc6 thread T0\r\n #0 0x4b3f6a in __interceptor_memcmp.part.283 (/home/zyh/fprime/build-fprime-automatic-native-ut/bin/Linux/Os_pthreads+0x4b3f6a)\r\n #1 0x51d718 in main /home/zyh/fprime/Os/Pthreads/test/ut/BufferQueueTest.cpp:126:5\r\n #2 0x7f976cdadbf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310\r\n #3 0x41ab89 in _start (/home/zyh/fprime/build-fprime-automatic-native-ut/bin/Linux/Os_pthreads+0x41ab89)\r\n\r\n0x000000550bc6 is located 58 bytes to the left of global variable '<string literal>' defined in '/home/zyh/fprime/Os/Pthreads/test/ut/BufferQueueTest.cpp:98:43' (0x550c00) of size 12\r\n '<string literal>' is ascii string 'how are you'\r\n0x000000550bc6 is located 0 bytes to the right of global variable '<string literal>' defined in '/home/zyh/fprime/Os/Pthreads/test/ut/BufferQueueTest.cpp:98:34' (0x550bc0) of size 6\r\n '<string literal>' is ascii string 'hello'\r\nSUMMARY: AddressSanitizer: global-buffer-overflow (/home/zyh/fprime/build-fprime-automatic-native-ut/bin/Linux/Os_pthreads+0x4b3f6a) in __interceptor_memcmp.part.283\r\nShadow bytes around the buggy address:\r\n 0x0000800a2120: f9 f9 f9 f9 00 00 00 00 00 00 00 01 f9 f9 f9 f9\r\n 0x0000800a2130: 00 00 05 f9 f9 f9 f9 f9 00 01 f9 f9 f9 f9 f9 f9\r\n 0x0000800a2140: 00 00 04 f9 f9 f9 f9 f9 00 05 f9 f9 f9 f9 f9 f9\r\n 0x0000800a2150: 00 00 04 f9 f9 f9 f9 f9 00 05 f9 f9 f9 f9 f9 f9\r\n 0x0000800a2160: 00 05 f9 f9 f9 f9 f9 f9 00 00 04 f9 f9 f9 f9 f9\r\n=>0x0000800a2170: 00 00 04 f9 f9 f9 f9 f9[06]f9 f9 f9 f9 f9 f9 f9\r\n 0x0000800a2180: 00 04 f9 f9 f9 f9 f9 f9 00 04 f9 f9 f9 f9 f9 f9\r\n 0x0000800a2190: 00 03 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9\r\n 0x0000800a21a0: 00 00 00 06 f9 f9 f9 f9 00 00 04 f9 f9 f9 f9 f9\r\n 0x0000800a21b0: 00 00 00 00 00 00 00 03 f9 f9 f9 f9 00 04 f9 f9\r\n 0x0000800a21c0: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n Addressable: 00\r\n Partially addressable: 01 02 03 04 05 06 07 \r\n Heap left redzone: fa\r\n Freed heap region: fd\r\n Stack left redzone: f1\r\n Stack mid redzone: f2\r\n Stack right redzone: f3\r\n Stack after return: f5\r\n Stack use after scope: f8\r\n Global redzone: f9\r\n Global init order: f6\r\n Poisoned by user: f7\r\n Container overflow: fc\r\n Array cookie: ac\r\n Intra object redzone: bb\r\n ASan internal: fe\r\n Left alloca redzone: ca\r\n Right alloca redzone: cb\r\n==17078==ABORTING\r\n``\r\n\r\n## How to Reproduce\r\n\r\n1. Compile unit test with ASAN\r\n2. Run build-fprime-automatic-native-ut/bin/Linux/Os_pthreads\r\n3. Program abort\r\n\r\n## Expected Behavior\r\n\r\nRun normally with ASAN.\r\n"</li><li>'toString doesn\'t display the last item in a struct\n\r\n:---:---\r\nF` version v3.1.1\r\n****\r\n---\r\n## Problem Description\r\n\r\nFiles generated by fpp tools doesn\'t produce the format string correctly and so the last member of a string doesn\'t show up as expected. For example \r\n\r\nThe take the following struct defined in fpp:\r\n``fpp\r\n enum CMD_STATUS : U16 {\r\n NA = 0,\r\n ACK = 0x5,\r\n NOT_ACK = 0x6,\r\n BUSY = 0x7,\r\n NCE = 0x8,\r\n STACK_FULL = 0x9,\r\n TEMP_NOT_ACC = 0x10\r\n };\r\n\r\n constant ESUP_HEADER_ID = 0x50555345\r\n\r\n# NOTE that in byte form it will be represented with LE\r\n struct EsupPacketHeader {\r\n HeaderId: U32\r\n ModuleId: U16\r\n DataLength: U16\r\n CmdStatus: CMD_STATUS\r\n } default {HeaderId = ESUP_HEADER_ID, CmdStatus=CMD_STATUS.NA}\r\n\r\n\r\n struct EsupStatusGet {\r\n Header: EsupPacketHeader\r\n CmdId: EsupCmdId\r\n TypeId: U16\r\n SystemState: U8 @< 1,2,3,4 (1 byte unsigned char value)\r\n StatusFlags: U8 @< 1 byte unsigned char value\r\n Reserved: U16 @< 2 byte unsigned short value\r\n CpuTemperature: F32 @< -40 to 125 °C (4 byte float value)\r\n FirmwareVersion: U32 @< firmware version (4 byte unsigned int value)\r\n } default {CmdId = EsupCmdId.ConfGet, TypeId = EsupCmdType.StatusRep}\r\n\r\n`\r\n\r\nI then go to print out the contents like so:\r\n\r\n`cpp\r\nstatic bool receiveEsupStatusResponse(int serialPort, EsupCmdId cmdId, boost::span<BYTE, GET_PADDED_SIZE(EsupStatusGet::SERIALIZED_SIZE)> txBuff) {\r\n // Wait for a reply\r\n EsupStatusGet cmdResult;\r\n\r\n size_t bytesRead = read(serialPort, txBuff.data(), txBuff.size());\r\n if (bytesRead > 0) {\r\n FW_CHECK(bytesRead <= txBuff.size(), "Error deserializing response", return false; );\r\n LE_ExternalDeSerializeBuffer responseBuff(txBuff.data(), bytesRead);\r\n cmdResult.deserialize(responseBuff);\r\n Fw::String ackString;\r\n cmdResult.toString(ackString);\r\n std::cout << std::string(ackString.toChar()) << std::endl;\r\n } else {\r\n std::cout << "No reply received." << std::endl;\r\n }\r\n\r\n return true;\r\n }\r\n`\r\n\r\nI get the following:\r\n\r\n`bash\r\n(Header = (HeaderId = 1347769157, ModuleId = 8203, DataLength = 0, CmdStatus = ), CmdId = ConfGet, TypeId = 0, SystemState = 162, StatusFlags = 187, Reserved = 53517, CpuTemperature = 0, FirmwareVersion = )\r\n`\r\n\r\nWhere I would normally expect to see something like this (the actual values don\'t matter for these purposes just that there is something to print):\r\n\r\n`bash\r\n(Header = (HeaderId = 1347769157, ModuleId = 8203, DataLength = 0, CmdStatus = ACK ), CmdId = ConfGet, TypeId = 0, SystemState = 162, StatusFlags = 187, Reserved = 53517, CpuTemperature = 0, FirmwareVersion = 102444)\r\n`\r\n\r\nI\'ve found this is consistent across pretty much all the fpp serializable objects and it really comes down to the last member of the struct doesn\'t have a format string generated along with it\r\n\r\nSo for example we see with the header type the following gets generated:\r\n\r\n`c++\r\nvoid EsupPacketHeader::toString(Fw::StringBase& text) const {\r\n\r\n static const char * formatString =\r\n "("\r\n "HeaderId = %u, "\r\n "ModuleId = %u, "\r\n "DataLength = %u, "\r\n "CmdStatus = "\r\n ")";\r\n\r\n // declare strings to hold any serializable toString() arguments\r\n\r\n\r\n Fw::String CmdStatusStr;\r\n this->m_CmdStatus.toString(CmdStatusStr);\r\n\r\n char outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE];\r\n (void)snprintf(outputString,FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE,formatString\r\n ,this->m_HeaderId\r\n ,this->m_ModuleId\r\n ,this->m_DataLength\r\n ,CmdStatusStr.toChar()\r\n );\r\n outputString[FW_SERIALIZABLE_TO_STRING_BUFFER_SIZE-1] = 0; // NULL terminate\r\n\r\n text = outputString;\r\n}\r\n`\r\n\r\nWith the CmdStatus missing the "`%s`".\r\n\r\nI\'m not really sure what the source of the error is since the xml seems to be fine:\r\n\r\n`xml\r\n<serializable namespace="FlightComputer" name="EsupPacketHeader">\r\n <import_enum_type>FlightComputer/TransmitterInterface/CMD_STATUSEnumAi.xml</import_enum_type>\r\n <members>\r\n <member name="HeaderId" type="U32" format="%u">\r\n <default>1347769157</default>\r\n </member>\r\n <member name="ModuleId" type="U16" format="%u">\r\n <default>0</default>\r\n </member>\r\n <member name="DataLength" type="U16" format="%u">\r\n <default>0</default>\r\n </member>\r\n <member name="CmdStatus" type="FlightComputer::CMD_STATUS" format="%s">\r\n <default>FlightComputer::CMD_STATUS::NA</default>\r\n </member>\r\n </members>\r\n</serializable>\r\n``\r\nI took a look in arraycpp.py and arraycpp.tmpl but couldn\'t make sense of the issue there.\r\n\r\nIf I can get some help on this that\'d be much appreciated.'</li><li>'Single quote in project parent folder causes installation errors\n\r\n:---:---\r\n_F´ Version_v3.4.3\r\n_Affected Component_Installation/Project Setup\r\n---\r\n## Problem Description\r\n\r\nIf you name the parent directory of your project such that it has a single quote in it, you\'ll run into an error when you try to run \'fprime-util generate\' during basic project setup. \r\n\r\n## Context / Environment\r\n\r\n``\r\nOperating System: Linux\r\nCPU Architecture: x86_64\r\nPlatform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\r\nPython version: 3.10.12\r\nCMake version: 3.22.1\r\nPip version: 24.0\r\nPip packages:\r\n fprime-tools==3.4.4\r\n fprime-gds==3.4.3\r\n fprime-fpp-*==2.1.0a3\r\n``\r\n\r\n## How to Reproduce\r\n\r\n1. Create a parent directory containing a single quote (For instance, "F\'")\r\n2. Follow the basic project setup guide located here: https://fprime-community.github.io/fprime-tutorial-hello-world/docs/NewProject.html \r\n3. Once you hit \'fprime-util generate\', you should soon see an error about an unterminated quote from one of the fprime dependencies. \r\n\r\n## Expected Behavior\r\n\r\nIdeally, you\'d have a project set up properly in your virtual environment.\r\n'</li></ul>
non-bug<ul><li>"Install Upgraded PIP in new Project\n\r\n:---:---\r\n_F´ Version_\r\n_Affected Component_\r\n---\r\n## Feature Description\r\n\r\nOlder versions of PIP may pull in non-native tools package. We should upgrade PIP during the new project setup. Note: users who don't want this can still decline venv setup entirely."</li><li>'fprime-gds: default file downlink directory can overwrite files\n\r\n:---:---\r\n_F´ Version_v3.4.3\r\n_Affected Component_n/a\r\n---\r\n## Feature Description\r\n\r\nHave GDS created a time-tag directory for file downlinks.\r\n\r\nMake the default be logs/<time tag>/fprime-downlink to match telemetry and events.\r\n\r\nAlso, make a separate argument for uplink and downlink. It makes sense to automatically separate downlinked files, but uplink may wish to be in a common store.\r\n\r\n## Rationale\r\n\r\nThe default /tmp/username (or even overridden with --file-storage-directory) directory for file downlinks can cause new instances to overwrite older files, or cause parallel instances to clobber each other.\r\n'</li><li>'Update FileDownlink to report file progress\n\r\n:---:---\r\n_F´ Version_v3.4.3\r\n_Affected Component_Svc/FileDownlink\r\n---\r\n## Feature Description\r\n\r\nSvc/FileDownlink currently only reports completion status back to the sender only when the file is complete. This will make re-transmitting data products inefficient since the Data Catalog has no idea how far partial transmits made it before the link dropped or the system was powered down. \r\n\r\nThis feature would report partial progress back to DP Catalog can restart transmits.\r\n\r\n## Rationale\r\n\r\nMake data product downlink management more efficient.\r\n'</li></ul>

Uses

Direct Use for Inference

First install the SetFit library:

bash
pip install setfit

Then you can load this model and run inference.

python
from setfit import SetFitModel

# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("setfit_model_id")
# Run inference
preds = model("Switch Framer and Deframer to use Mallocator Pattern
| | |
|:---|:---|
|**_F´ Version_**| |
|**_Affected Component_**|   |
---
## Problem Description

Mallocator pattern is preferred over member-allocated buffers.")

<!--

Downstream Use

List how someone could finetune this model on their own dataset. -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Set Metrics

Training setMinMedianMax
Word count4124.13832486
LabelTraining Sample Count
bug296
non-bug304

Training Hyperparameters

  • batch_size: (16, 2)
  • num_epochs: (1, 1)
  • max_steps: -1
  • sampling_strategy: oversampling
  • num_iterations: 20
  • bodylearningrate: (2e-05, 1e-05)
  • headlearningrate: 0.01
  • loss: CosineSimilarityLoss
  • distancemetric: cosinedistance
  • margin: 0.25
  • endtoend: False
  • use_amp: False
  • warmup_proportion: 0.1
  • l2_weight: 0.01
  • seed: 42
  • evalmaxsteps: -1
  • loadbestmodelatend: False

Training Results

EpochStepTraining LossValidation Loss
0.000710.447-
0.0333500.2333-
0.06671000.083-
0.11500.039-
0.13332000.0354-
0.16672500.0177-
0.23000.0053-
0.23333500.0004-
0.26674000.0027-
0.34500.0015-
0.33335000.002-
0.36675500.0003-
0.46000.0001-
0.43336500.0001-
0.46677000.0001-
0.57500.0001-
0.53338000.0001-
0.56678500.0001-
0.69000.0001-
0.63339500.0001-
0.666710000.0001-
0.710500.0-
0.733311000.0-
0.766711500.0001-
0.812000.0-
0.833312500.0001-
0.866713000.0-
0.913500.0-
0.933314000.0001-
0.966714500.0-
1.015000.0-

Framework Versions

  • Python: 3.11.6
  • SetFit: 1.1.0
  • Sentence Transformers: 3.0.1
  • Transformers: 4.44.2
  • PyTorch: 2.4.1+cu121
  • Datasets: 2.21.0
  • Tokenizers: 0.19.1

Citation

BibTeX

bibtex
@article{https://doi.org/10.48550/arxiv.2209.11055,
    doi = {10.48550/ARXIV.2209.11055},
    url = {https://arxiv.org/abs/2209.11055},
    author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
    keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
    title = {Efficient Few-Shot Learning Without Prompts},
    publisher = {arXiv},
    year = {2022},
    copyright = {Creative Commons Attribution 4.0 International}
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->