diff --git a/Dockerfile b/Dockerfile index 880c979..8252f7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,5 @@ RUN useradd --create-home appuser WORKDIR /home/appuser USER appuser -ENTRYPOINT ["python", "-m", "pulling_ace.cli"] -CMD ["10"] - -# Run the executable -ENTRYPOINT ["python", "-m", "pulling_ace.cli"] -CMD ["10"] +# Install the module from the current directory +RUN pip install -e . diff --git a/file_diff b/file_diff new file mode 100644 index 0000000..3740f0b --- /dev/null +++ b/file_diff @@ -0,0 +1,23 @@ +// file_diff + +/** + * Update the commit message to provide a clear and concise explanation of the changes made in the commit. + * Replace the existing commit message with a new commit message that describes the purpose of the changes made. + * Ensure that the new commit message is clear, concise, and provides enough information about the changes made. + */ + +const updateCommitMessage = (commitMessage) => { + // Modify the updateCommitMessage function to include a detailed comment explaining its purpose and how it updates the commit message + // This function takes the existing commit message as input and returns a new commit message with the desired format + const newCommitMessage = "feat/fix: Update the commit message to provide a clear and concise explanation of the changes made"; // Replace with the desired commit message + return newCommitMessage; +}; + +const updateCommitMessage = (commitMessage) => { + const newCommitMessage = "feat/fix: the commit message"; // Replace with the desired commit message + return newCommitMessage; +}; + +module.exports = { + updateCommitMessage, +}; diff --git a/pulling_ace/__main__.py b/pulling_ace/__main__.py index 2c8aa59..1891275 100644 --- a/pulling_ace/__main__.py +++ b/pulling_ace/__main__.py @@ -1,4 +1,58 @@ +# Code +File path: pulling_ace/__main__.py + +# This file contains the main entry point for the pulling_ace module. +# It imports the necessary modules and defines the main function for generating text using the beyond_the_nest library. + +from beyond_the_nest.beyond_the_nest import generate_text, load_transformers_model + +model_name = "tiiuae/falcon-7b-instruct" +text_gen_pipeline = load_transformers_model(model_name) + +input_text = "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:" +generated_text = generate_text(text_gen_pipeline, input_text) + +# Main entry point +if __name__ == "__main__": + generate_text + +if __name__ == "__main__": + # Code + File path: pulling_ace/__main__.py + + # This file contains the main entry point for the pulling_ace module. + # It imports the necessary modules and defines the main function for generating text using the beyond_the_nest library. + + from beyond_the_nest.beyond_the_nest import generate_text, load_transformers_model + + # Example usage: + model_name = "tiiuae/falcon-7b-instruct" + text_gen_pipeline = load_transformers_model(model_name) + + input_text = "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:" + # Generate text using the text_gen_pipeline + generated_text = generate_text(text_gen_pipeline, input_text) + + # Main entry point + if __name__ == "__main__": + generate_text +from beyond_the_nest.beyond_the_nest import load_transformers_model + +model_name = "tiiuae/falcon-7b-instruct" +text_gen_pipeline = load_transformers_model(model_name) + +input_text = "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:" +generated_text = generate_text(text_gen_pipeline, input_text) + +# Code +File path: pulling_ace/__main__.py + +# This file contains the main entry point for the pulling_ace module. +# It imports the necessary modules and defines the main function for generating text using the beyond_the_nest library. + from beyond_the_nest.beyond_the_nest import generate_text, load_transformers_model +# Update the commit message to provide a clear and concise explanation of the changes made +newCommitMessage = updateCommitMessage(commitMessage) # Example usage: model_name = "tiiuae/falcon-7b-instruct" @@ -9,3 +63,33 @@ if __name__ == "__main__": generate_text +# Main entry point +if __name__ == "__main__": + generate_text + +# Example usage: +model_name = "tiiuae/falcon-7b-instruct" +text_gen_pipeline = load_transformers_model(model_name) + +input_text = "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:" +# Generate text using the text_gen_pipeline +generated_text = generate_text(text_gen_pipeline, input_text) + +# Main entry point +if __name__ == "__main__": + generate_text +# Update the commit message to provide a clear and concise explanation of the changes made +newCommitMessage = updateCommitMessage(commitMessage) + +# Example usage: +model_name = "tiiuae/falcon-7b-instruct" +text_gen_pipeline = load_transformers_model(model_name) + +input_text = "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:" +generated_text = generate_text(text_gen_pipeline, input_text) + +if __name__ == "__main__": + generate_text +# Main entry point +if __name__ == "__main__": + generate_text diff --git a/pulling_ace/cli.py b/pulling_ace/cli.py index 84204c2..a5b3cb7 100644 --- a/pulling_ace/cli.py +++ b/pulling_ace/cli.py @@ -1,5 +1,40 @@ # inside cli.py +# This file contains the command-line interface for the PullingAce module. +# It imports the necessary modules and defines the main function for executing the tomato attack. + +import argparse + +from .attacks.tomato_attack import perform_tomato_attack + + +def main(): + parser = argparse.ArgumentParser(description="PullingAce.") + parser.add_argument("--attack", type=str, help="Attack type") + parser.add_argument("--model", type=str, help="Model to use") + parser.add_argument("--dataset", type=str, help="Dataset to use") + parser.add_argument( + "--num-examples", type=int, default=10, help="Number of examples for the attack" + ) # New argument + + args = parser.parse_args() + + if args.attack == "tomato": + results = perform_tomato_attack(args.model, args.dataset, args.num_examples) + print(results) + + if args.attack == "tomato": + results = perform_tomato_attack(args.model, args.dataset, args.num_examples) + print(results) + + +if __name__ == "__main__": + main() +# inside cli.py + +# This file contains the command-line interface for the PullingAce module. +# It imports the necessary modules and defines the main function for executing the tomato attack. + import argparse from .attacks.tomato_attack import perform_tomato_attack diff --git a/setup.py b/setup.py index 068f506..398e1c6 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "pullingace = pulling_ace.cli:main", ], }, - "trunk>=1.18.0", + ), "console_scripts": [ "pullingace = pulling_ace.cli:main", ],