Skip to content

Instantly share code, notes, and snippets.

View rezamarzban's full-sized avatar
🎯
Focusing

rezamarzban

🎯
Focusing
View GitHub Profile
@rezamarzban
rezamarzban / GPT.py
Last active July 14, 2024 12:58
GPT 3.5
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
# Initialize tokenizer and model
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-2.7B")
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-2.7B")
# Example usage
text = "Replace with your input text here."
# Tokenize input text
Switzerland,
Japan,
South Korea,
Monaco,
Finland,
Denmark,
Austria,
Andorra,
Liechtenstein,
San Marino,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rezamarzban
rezamarzban / quad.py
Created April 19, 2024 05:48
Numerical method integration of function
import numpy as np
from scipy.integrate import quad
import sympy as sp
# Define the symbolic variable
x = sp.Symbol('x')
# Define the integrand as a sympy expression
integrand = sp.exp(-1j * x) / x
program wait_formula
implicit none
real :: beta, a, h
real, dimension(:), allocatable :: rho
complex :: norm_deltaZ
complex :: integral1, integral2, integral3
real :: rho_start, rho_end, rho_step
real :: rho_current
integer :: i
@rezamarzban
rezamarzban / latex.py
Created February 15, 2024 10:14
LaTeX output of sympy formulas
from sympy import *
from sympy.printing.mathml import mathml
init_printing(use_unicode=True) # allow LaTeX printing
# independent variables
x, y, z = symbols('x y z', real = True)
# parameters
nu, rho = symbols('nu rho', real = True, constant = True, positive = True)
@rezamarzban
rezamarzban / radiation-pattern-maxwell.py
Created February 3, 2024 15:51
Radiation pattern and Poynting Vector by MEEP module with Maxwell equations
import math
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import numpy as np
import meep as mp
@rezamarzban
rezamarzban / Conda-pack.ipynb
Last active February 1, 2024 20:43
Conda-pack
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
git config --global user.email 'rezamarzban1987@gmail.com'
git config --global user.name 'rezamarzban'
git clone https://ACCESS_TOKEN@github.com/rezamarzban/electromagnetic
#After making changes
git add .
git commit -m 'Updated by Reza Marzban'
git push
@rezamarzban
rezamarzban / simple linear array of 4 Hertzian dipoles.ipynb
Last active January 23, 2024 15:31
simple linear array of 4 Hertzian dipoles with meep
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.